2016-03-14 09:57:07 +00:00
|
|
|
#ifndef ASN1_COMPILER_MISC_H
|
|
|
|
#define ASN1_COMPILER_MISC_H
|
2004-06-03 03:38:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Make the target language identifier out of one or more names.
|
|
|
|
* The function will concatenate the names and replace unsafe characters
|
|
|
|
* with safe ones.
|
|
|
|
*/
|
2005-01-28 12:18:50 +00:00
|
|
|
enum ami_flags_e {
|
2017-05-07 13:00:51 +00:00
|
|
|
AMI_MASK_ONLY_SPACES = 1, /* Mask only spaces, everything else's safe */
|
|
|
|
AMI_CHECK_RESERVED = 2, /* Check against reserved keywords */
|
|
|
|
AMI_NODELIMITER = 4, /* Do not put delimiter, just concatenate */
|
|
|
|
AMI_USE_PREFIX = 8, /* Use Prefix when generating identifier */
|
2005-01-28 12:18:50 +00:00
|
|
|
};
|
2017-09-05 09:53:05 +00:00
|
|
|
const char *asn1c_make_identifier(enum ami_flags_e, asn1p_expr_t *expr, ...);
|
2004-06-03 03:38:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Return the type name of the specified expression.
|
2017-08-23 11:34:15 +00:00
|
|
|
* The returned string is a pointer to a statically allocated buffer which is
|
|
|
|
* going to be clobbered by the subsequent invocation of this function.
|
2004-06-03 03:38:44 +00:00
|
|
|
*/
|
|
|
|
enum tnfmt {
|
2005-01-28 12:18:50 +00:00
|
|
|
TNF_UNMODIFIED = 0x10, /* Return unmodified type name */
|
|
|
|
TNF_INCLUDE = 0x20, /* Format for #include <> */
|
|
|
|
TNF_CTYPE = 0x30, /* Format as normal C-ish type (append "_t") */
|
|
|
|
TNF_SAFE = 0x40, /* Replace unsafe characters with _ */
|
|
|
|
TNF_RSAFE = 0x50, /* Recursion-safe C type format */
|
2004-06-03 03:38:44 +00:00
|
|
|
};
|
2017-08-23 11:34:15 +00:00
|
|
|
const char *asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format);
|
2004-06-03 03:38:44 +00:00
|
|
|
|
2005-08-14 02:18:27 +00:00
|
|
|
/*
|
|
|
|
* Check whether the specified INTEGER or ENUMERATED type can be represented
|
|
|
|
* using the generic 'long' type.
|
|
|
|
* Return values:
|
|
|
|
* FL_NOTFIT: No, it cannot be represented using long.
|
2007-12-03 13:41:36 +00:00
|
|
|
* FL_FITS_SIGNED: It can be represented using signed long.
|
|
|
|
* FL_FITS_UNSIGN: It can be represented using unsigned long.
|
2013-03-27 08:56:23 +00:00
|
|
|
* FL_PRESUMED: Probably can't, but -fwide-types is not in effect.
|
2005-08-14 02:18:27 +00:00
|
|
|
*/
|
|
|
|
enum asn1c_fitslong_e {
|
|
|
|
FL_NOTFIT,
|
2007-12-03 13:41:36 +00:00
|
|
|
FL_FITS_SIGNED,
|
|
|
|
FL_FITS_UNSIGN,
|
2013-03-27 08:56:23 +00:00
|
|
|
FL_PRESUMED,
|
2005-08-14 02:18:27 +00:00
|
|
|
};
|
|
|
|
enum asn1c_fitslong_e asn1c_type_fits_long(arg_t *arg, asn1p_expr_t *expr);
|
|
|
|
|
2016-03-14 09:57:07 +00:00
|
|
|
#endif /* ASN1_COMPILER_MISC_H */
|