X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;ds=inline;f=libasn1compiler%2Fasn1c_naming.h;fp=libasn1compiler%2Fasn1c_naming.h;h=c2b94c912b5d9a14d7a58a8950f976ad031547d8;hb=70ee6fc793ec8e828067a3569849b6c216054497;hp=0000000000000000000000000000000000000000;hpb=59f84608ec15c016958a6e0e0ddd813f376c0925;p=com%2Fasn1c.git diff --git a/libasn1compiler/asn1c_naming.h b/libasn1compiler/asn1c_naming.h new file mode 100644 index 0000000..c2b94c9 --- /dev/null +++ b/libasn1compiler/asn1c_naming.h @@ -0,0 +1,47 @@ +#ifndef ASN1_COMPILER_NAMING_H +#define ASN1_COMPILER_NAMING_H + + +/* + * A member or a field name. + */ +struct c_names { + struct { + const char *asn_name; /* "T-Rex" */ + const char *part_name; /* "T_Rex" */ + const char *base_name; /* "T_Rex" */ + const char *c_name; /* "T_Rex_t" */ + const char *constrained_c_name; /* "long" */ + } type; + const char *asn_name; /* "foo" */ + const char *part_name; /* "foo", "signed" */ + const char *base_name; /* "foo" if not, "parent_foo" if compound */ + const char *short_name; /* "foo_t", "e_foo" */ + const char *full_name; /* "struct foo", "enum foo" */ + const char *as_member; /* "foo" (not compounded) */ + const char *presence_enum; /* "enum foo_PR" */ + const char *presence_name; /* "foo_PR" */ + const char *members_enum; /* "enum foo" */ + const char *members_name; /* "e_foo" */ + const char *compound_name; /* always contain "parent_foo" */ +}; + +struct c_names c_name(arg_t *); +struct c_names c_expr_name(arg_t *, asn1p_expr_t *); +const char *c_member_name(arg_t *, asn1p_expr_t *); /* %s_%s */ +const char *c_presence_name(arg_t *, asn1p_expr_t *); /* %s_PR_%s */ + +const char *c_names_format(struct c_names); /* For debugging */ + +/* + * Returns 0 if no C name clashes have been encountered. + * Returns 1 if C name clashes have been encountered. + * Prints out the clashing items and suggests -fcompound-names. + */ +int c_name_clash(arg_t *arg); + +void c_name_clash_finder_init(void); + +void c_name_clash_finder_destroy(void); + +#endif /* ASN1_COMPILER_NAMING_H */