*** empty log message ***
diff --git a/libasn1compiler/asn1c_C.c b/libasn1compiler/asn1c_C.c
index 15616ea..3ebd417 100644
--- a/libasn1compiler/asn1c_C.c
+++ b/libasn1compiler/asn1c_C.c
@@ -79,9 +79,9 @@
#define DEPENDENCIES do { \
emit_include_dependencies(arg); \
if(expr->expr_type == ASN_CONSTR_SET_OF) \
- GEN_INCLUDE("asn_SET_OF"); \
+ GEN_INCLUDE_STD("asn_SET_OF"); \
if(expr->expr_type == ASN_CONSTR_SEQUENCE_OF) \
- GEN_INCLUDE("asn_SEQUENCE_OF"); \
+ GEN_INCLUDE_STD("asn_SEQUENCE_OF"); \
} while(0)
/* MKID_safe() without checking for reserved keywords */
@@ -328,7 +328,7 @@
return -1;
}
- GEN_INCLUDE("constr_SEQUENCE");
+ GEN_INCLUDE_STD("constr_SEQUENCE");
if(!arg->embed)
GEN_DECLARE(expr); /* asn_DEF_xxx */
@@ -568,7 +568,7 @@
tag2el_cxer = 0;
}
- GEN_INCLUDE("constr_SET");
+ GEN_INCLUDE_STD("constr_SET");
if(!arg->embed)
GEN_DECLARE(expr); /* asn_DEF_xxx */
@@ -770,9 +770,9 @@
* Print out the table according to which parsing is performed.
*/
if(seq_of) {
- GEN_INCLUDE("constr_SEQUENCE_OF");
+ GEN_INCLUDE_STD("constr_SEQUENCE_OF");
} else {
- GEN_INCLUDE("constr_SET_OF");
+ GEN_INCLUDE_STD("constr_SET_OF");
}
if(!arg->embed)
GEN_DECLARE(expr); /* asn_DEF_xxx */
@@ -921,7 +921,7 @@
return -1;
}
- GEN_INCLUDE("constr_CHOICE");
+ GEN_INCLUDE_STD("constr_CHOICE");
if(!arg->embed)
GEN_DECLARE(expr); /* asn_DEF_xxx */
diff --git a/libasn1compiler/asn1c_misc.c b/libasn1compiler/asn1c_misc.c
index 742c02a..c8adce6 100644
--- a/libasn1compiler/asn1c_misc.c
+++ b/libasn1compiler/asn1c_misc.c
@@ -109,7 +109,7 @@
continue;
}
- if(str != first && !nodelimiter)
+ if(str != first && !nodelimiter && !(flags & AMI_NODELIMITER))
*p++ = '_'; /* Delimiter between tokens */
nodelimiter = 0;
@@ -150,6 +150,7 @@
asn1p_expr_t *exprid = 0;
asn1p_expr_t *top_parent;
asn1p_expr_t *terminal;
+ int stdname = 0;
char *typename;
/* Rewind to the topmost parent expression */
@@ -215,16 +216,25 @@
return "double";
else
return "long";
- default: break;
+ default:
+ typename = 0;
+ switch(expr->expr_type) {
+ case ASN_BASIC_INTEGER:
+ typename = "NativeInteger"; break;
+ case ASN_BASIC_ENUMERATED:
+ typename = "NativeEnumerated"; break;
+ case ASN_BASIC_REAL:
+ typename = "NativeReal"; break;
+ default:
+ break;
+ }
+ break;
}
- switch(expr->expr_type) {
- case ASN_BASIC_INTEGER:
- return "NativeInteger";
- case ASN_BASIC_ENUMERATED:
- return "NativeEnumerated";
- case ASN_BASIC_REAL:
- return "NativeReal";
- default: break;
+ if(typename) {
+ if(_format != TNF_INCLUDE)
+ return typename;
+ stdname = 1;
+ break;
}
}
/* Fall through */
@@ -233,6 +243,7 @@
& (ASN_CONSTR_MASK | ASN_BASIC_MASK | ASN_STRING_MASK)) {
if(_format == TNF_RSAFE)
_format = TNF_CTYPE;
+ stdname = 1;
typename = ASN_EXPR_TYPE2STR(expr->expr_type);
} else {
_format = TNF_RSAFE;
@@ -242,9 +253,14 @@
switch(_format) {
case TNF_UNMODIFIED:
- case TNF_INCLUDE:
return asn1c_make_identifier(AMI_MASK_ONLY_SPACES,
0, exprid ? exprid->Identifier : typename, 0);
+ case TNF_INCLUDE:
+ return asn1c_make_identifier(
+ AMI_MASK_ONLY_SPACES | AMI_NODELIMITER,
+ 0, stdname ? "<" : "\"",
+ exprid ? exprid->Identifier : typename,
+ stdname ? ".h>" : ".h\"", 0);
case TNF_SAFE:
return asn1c_make_identifier(0, exprid, typename, 0);
case TNF_CTYPE: /* C type */
diff --git a/libasn1compiler/asn1c_misc.h b/libasn1compiler/asn1c_misc.h
index 23693a0..b14a155 100644
--- a/libasn1compiler/asn1c_misc.h
+++ b/libasn1compiler/asn1c_misc.h
@@ -9,6 +9,7 @@
enum ami_flags_e {
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 */
};
char *asn1c_make_identifier(enum ami_flags_e, asn1p_expr_t *expr, ...);
diff --git a/libasn1compiler/asn1c_out.h b/libasn1compiler/asn1c_out.h
index fb986cb..3b1f055 100644
--- a/libasn1compiler/asn1c_out.h
+++ b/libasn1compiler/asn1c_out.h
@@ -82,18 +82,19 @@
} while(0)
/* Generate #include line */
+#define GEN_INCLUDE_STD(typename) GEN_INCLUDE("<" typename ".h>")
#define GEN_INCLUDE(filename) do { \
int saved_target = arg->target->target; \
if(!filename) break; \
REDIR(OT_INCLUDES); \
- OUT_NOINDENT("#include <%s.h>\n", filename); \
+ OUT_NOINDENT("#include %s\n", filename); \
REDIR(saved_target); \
} while(0)
#define GEN_POSTINCLUDE(filename) do { \
int saved_target = arg->target->target; \
if(!filename) break; \
REDIR(OT_POST_INCLUDE); \
- OUT_NOINDENT("#include <%s.h>\n", filename); \
+ OUT_NOINDENT("#include %s\n", filename); \
REDIR(saved_target); \
} while(0)