Commit 34944f2a authored by Lev Walkin's avatar Lev Walkin
Browse files

Added -fincludes-quoted to generate #includes in double instead of <angle> quotes.

parent 83f2a1cd
0.9.23: 2010-Mar-10
0.9.23: 2010-Oct-07
* GeneralizedTime fix for working with time offsets which are not
representable in whole hours. (Severity: low; Security impact: low)
Thanks to IP Fabrics, Inc.
* Added -fincludes-quoted to asn1c to generate #includes in "double"
instead of <angle> quotes.
0.9.22: 2008-Nov-19
......
......@@ -97,6 +97,8 @@ main(int ac, char **av) {
asn1_compiler_flags |= A1C_NO_CONSTRAINTS;
} else if(strcmp(optarg, "no-include-deps") == 0) {
asn1_compiler_flags |= A1C_NO_INCLUDE_DEPS;
} else if(strcmp(optarg, "includes-quoted") == 0) {
asn1_compiler_flags |= A1C_INCLUDES_QUOTED;
} else if(strcmp(optarg, "unnamed-unions") == 0) {
asn1_compiler_flags |= A1C_UNNAMED_UNIONS;
} else if(strcmp(optarg, "skeletons-copy") == 0) {
......@@ -454,6 +456,7 @@ usage(const char *av0) {
" -fbless-SIZE Allow SIZE() constraint for INTEGER etc (non-std.)\n"
" -fcompound-names Disambiguate C's struct NAME's inside top-level types\n"
" -findirect-choice Compile members of CHOICE as indirect pointers\n"
" -fincludes-quoted Generate #includes in \"double\" instead of <angle> quotes\n"
" -fknown-extern-type=<name> Pretend the specified type is known\n"
" -fnative-types Use \"long\" instead of INTEGER_t whenever possible, etc.\n"
" -fno-constraints Do not generate constraint checking code\n"
......
......@@ -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);
......
......@@ -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; \
......
......@@ -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);
......
......@@ -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
};
/*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment