blob: 8da261df8c07915e069fb6fff73efa3a947a7ef3 [file] [log] [blame]
Lev Walkinf15320b2004-06-03 03:38:44 +00001#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 Walkin801fabc2005-01-28 12:18:50 +00009enum 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 */
12};
13char *asn1c_make_identifier(enum ami_flags_e, char *arg1, ...);
Lev Walkinf15320b2004-06-03 03:38:44 +000014
15/*
16 * Return the type name of the specified expression.
17 */
18enum tnfmt {
Lev Walkin801fabc2005-01-28 12:18:50 +000019 TNF_UNMODIFIED = 0x10, /* Return unmodified type name */
20 TNF_INCLUDE = 0x20, /* Format for #include <> */
21 TNF_CTYPE = 0x30, /* Format as normal C-ish type (append "_t") */
22 TNF_SAFE = 0x40, /* Replace unsafe characters with _ */
23 TNF_RSAFE = 0x50, /* Recursion-safe C type format */
Lev Walkinf15320b2004-06-03 03:38:44 +000024};
25char *asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format);
26
Lev Walkin082cadc2005-08-14 02:18:27 +000027/*
28 * Check whether the specified INTEGER or ENUMERATED type can be represented
29 * using the generic 'long' type.
30 * Return values:
31 * FL_NOTFIT: No, it cannot be represented using long.
32 * FL_FITSOK: It can be represented using long.
33 * FL_FORCED: Probably can't, but -fnative-types is in force.
34 */
35enum asn1c_fitslong_e {
36 FL_NOTFIT,
37 FL_FITSOK,
38 FL_FORCED,
39};
40enum asn1c_fitslong_e asn1c_type_fits_long(arg_t *arg, asn1p_expr_t *expr);
41
Lev Walkinf15320b2004-06-03 03:38:44 +000042#endif /* _ASN1_COMPILER_MISC_H_ */