Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 1 | #ifndef _ASN1_COMPILER_MISC_H_ |
| 2 | #define _ASN1_COMPILER_MISC_H_ |
| 3 | |
| 4 | /* |
| 5 | * Make the target language identifier out of one or more names. |
| 6 | * The function will concatenate the names and replace unsafe characters |
| 7 | * with safe ones. |
| 8 | */ |
Lev Walkin | 801fabc | 2005-01-28 12:18:50 +0000 | [diff] [blame] | 9 | enum ami_flags_e { |
| 10 | AMI_MASK_ONLY_SPACES = 1, /* Mask only spaces, everything else's safe */ |
| 11 | AMI_CHECK_RESERVED = 2, /* Check against reserved keywords */ |
Lev Walkin | 22b5ed4 | 2006-09-13 02:51:20 +0000 | [diff] [blame] | 12 | AMI_NODELIMITER = 4, /* Do not put delimiter, just concatenate */ |
Lev Walkin | 801fabc | 2005-01-28 12:18:50 +0000 | [diff] [blame] | 13 | }; |
Lev Walkin | a00d6b3 | 2006-03-21 03:40:38 +0000 | [diff] [blame] | 14 | char *asn1c_make_identifier(enum ami_flags_e, asn1p_expr_t *expr, ...); |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 15 | |
| 16 | /* |
| 17 | * Return the type name of the specified expression. |
| 18 | */ |
| 19 | enum tnfmt { |
Lev Walkin | 801fabc | 2005-01-28 12:18:50 +0000 | [diff] [blame] | 20 | TNF_UNMODIFIED = 0x10, /* Return unmodified type name */ |
| 21 | TNF_INCLUDE = 0x20, /* Format for #include <> */ |
| 22 | TNF_CTYPE = 0x30, /* Format as normal C-ish type (append "_t") */ |
| 23 | TNF_SAFE = 0x40, /* Replace unsafe characters with _ */ |
| 24 | TNF_RSAFE = 0x50, /* Recursion-safe C type format */ |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 25 | }; |
| 26 | char *asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format); |
| 27 | |
Lev Walkin | 082cadc | 2005-08-14 02:18:27 +0000 | [diff] [blame] | 28 | /* |
| 29 | * Check whether the specified INTEGER or ENUMERATED type can be represented |
| 30 | * using the generic 'long' type. |
| 31 | * Return values: |
| 32 | * FL_NOTFIT: No, it cannot be represented using long. |
Lev Walkin | 8bb57a2 | 2007-12-03 13:41:36 +0000 | [diff] [blame] | 33 | * FL_FITS_SIGNED: It can be represented using signed long. |
| 34 | * FL_FITS_UNSIGN: It can be represented using unsigned long. |
Lev Walkin | 082cadc | 2005-08-14 02:18:27 +0000 | [diff] [blame] | 35 | * FL_FORCED: Probably can't, but -fnative-types is in force. |
| 36 | */ |
| 37 | enum asn1c_fitslong_e { |
| 38 | FL_NOTFIT, |
Lev Walkin | 8bb57a2 | 2007-12-03 13:41:36 +0000 | [diff] [blame] | 39 | FL_FITS_SIGNED, |
| 40 | FL_FITS_UNSIGN, |
Lev Walkin | 082cadc | 2005-08-14 02:18:27 +0000 | [diff] [blame] | 41 | FL_FORCED, |
| 42 | }; |
| 43 | enum asn1c_fitslong_e asn1c_type_fits_long(arg_t *arg, asn1p_expr_t *expr); |
| 44 | |
Lev Walkin | f15320b | 2004-06-03 03:38:44 +0000 | [diff] [blame] | 45 | #endif /* _ASN1_COMPILER_MISC_H_ */ |