aboutsummaryrefslogtreecommitdiffstats
path: root/libasn1compiler
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2010-10-07 08:25:37 +0000
committerLev Walkin <vlm@lionet.info>2010-10-07 08:25:37 +0000
commit34944f2afbe59314d4c6fd7058e30f85f9d4b3ab (patch)
tree5a1f09207405b2754a709be400b3ea009345189e /libasn1compiler
parent83f2a1cd8b088264b64a62b51733243281f590e3 (diff)
Added -fincludes-quoted to generate #includes in double instead of <angle> quotes.
Diffstat (limited to 'libasn1compiler')
-rw-r--r--libasn1compiler/asn1c_fdeps.c3
-rw-r--r--libasn1compiler/asn1c_out.h7
-rw-r--r--libasn1compiler/asn1c_save.c10
-rw-r--r--libasn1compiler/asn1compiler.h7
4 files changed, 23 insertions, 4 deletions
diff --git a/libasn1compiler/asn1c_fdeps.c b/libasn1compiler/asn1c_fdeps.c
index e34cb6f5..231a47cc 100644
--- a/libasn1compiler/asn1c_fdeps.c
+++ b/libasn1compiler/asn1c_fdeps.c
@@ -25,6 +25,9 @@ asn1c_activate_dependency(asn1c_fdeps_t *deps, asn1c_fdeps_t *cur, const char *d
if(start) {
start++;
end = strchr(start, '>');
+ } else if((start = strchr(data, '\"'))) {
+ start++;
+ end = strchr(start, '\"');
}
if(end) {
char *p = alloca((end - start) + 1);
diff --git a/libasn1compiler/asn1c_out.h b/libasn1compiler/asn1c_out.h
index 04d7ff2f..d68f3a85 100644
--- a/libasn1compiler/asn1c_out.h
+++ b/libasn1compiler/asn1c_out.h
@@ -83,7 +83,12 @@ int asn1c_compiled_output(arg_t *arg, const char *fmt, ...);
} while(0)
/* Generate #include line */
-#define GEN_INCLUDE_STD(typename) GEN_INCLUDE("<" typename ".h>")
+#define GEN_INCLUDE_STD(typename) do { \
+ if((arg->flags & A1C_INCLUDES_QUOTED)) { \
+ GEN_INCLUDE("\"" typename ".h\""); \
+ } else { \
+ GEN_INCLUDE("<" typename ".h>"); \
+ } } while(0)
#define GEN_INCLUDE(filename) do { \
int saved_target = arg->target->target; \
if(!filename) break; \
diff --git a/libasn1compiler/asn1c_save.c b/libasn1compiler/asn1c_save.c
index 1785d7d1..f348f197 100644
--- a/libasn1compiler/asn1c_save.c
+++ b/libasn1compiler/asn1c_save.c
@@ -6,6 +6,11 @@
#include "asn1c_save.h"
#include "asn1c_out.h"
+#define HINCLUDE(s) \
+ ((arg->flags & A1C_INCLUDES_QUOTED) \
+ ? fprintf(fp_h, "#include \"%s\"\n", s) \
+ : fprintf(fp_h, "#include <%s>\n", s)) \
+
static int asn1c_dump_streams(arg_t *arg, asn1c_fdeps_t *, int, char **);
static int asn1c_print_streams(arg_t *arg);
static int asn1c_save_streams(arg_t *arg, asn1c_fdeps_t *, int, char **);
@@ -240,7 +245,8 @@ asn1c_save_streams(arg_t *arg, asn1c_fdeps_t *deps, int optc, char **argv) {
"#define\t_%s_H_\n"
"\n", header_id, header_id);
- fprintf(fp_h, "\n#include <asn_application.h>\n");
+ fprintf(fp_h, "\n");
+ HINCLUDE("asn_application.h");
#define SAVE_STREAM(fp, idx, msg, actdep) do { \
if(TQ_FIRST(&(cs->destination[idx].chunks)) && *msg) \
@@ -265,7 +271,7 @@ asn1c_save_streams(arg_t *arg, asn1c_fdeps_t *deps, int optc, char **argv) {
fprintf(fp_h, "\n#endif\t/* _%s_H_ */\n", header_id);
- fprintf(fp_c, "#include <asn_internal.h>\n\n");
+ HINCLUDE("asn_internal.h");
fprintf(fp_c, "#include \"%s.h\"\n\n", expr->Identifier);
if(arg->flags & A1C_NO_INCLUDE_DEPS)
SAVE_STREAM(fp_c, OT_POST_INCLUDE, "", 1);
diff --git a/libasn1compiler/asn1compiler.h b/libasn1compiler/asn1compiler.h
index 60782626..c8c9b9b2 100644
--- a/libasn1compiler/asn1compiler.h
+++ b/libasn1compiler/asn1compiler.h
@@ -67,7 +67,12 @@ enum asn1c_flags {
*/
A1C_PDU_ALL = 0x2000,
A1C_PDU_AUTO = 0x4000,
- A1C_PDU_TYPE = 0x8000
+ A1C_PDU_TYPE = 0x8000,
+ /*
+ * -fincludes-quoted
+ * Avoid generating #include <foo>, generate "foo" instead.
+ */
+ A1C_INCLUDES_QUOTED = 0x10000
};
/*