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 | |
vlm | 8a09e0f | 2005-02-25 14:20:30 +0000 | [diff] [blame] | 12 | #ifndef __GNUC__ |
| 13 | #define __attribute__(x) /* unused */ |
| 14 | #endif |
| 15 | |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 16 | static char *asn1p_expr_type2str[] __attribute__ ((unused)) = { |
| 17 | EOM |
| 18 | |
| 19 | while(<>) { |
| 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 | |
| 37 | print<<EOM; |
| 38 | }; |
| 39 | |
| 40 | /* |
| 41 | * Convert the ASN.1 expression type back into the string representation. |
| 42 | */ |
vlm | bacb731 | 2004-06-28 21:20:50 +0000 | [diff] [blame] | 43 | #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 \\ |
vlm | 74ce239 | 2004-09-23 22:21:07 +0000 | [diff] [blame] | 49 | : asn1p_expr_type2str[(int)(type)] \\ |
vlm | fa67ddc | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 50 | ) |
| 51 | |
| 52 | #endif /* ASN1_PARSER_EXPR_STR_H */ |
| 53 | EOM |