aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--asn1c/asn1c.110
-rw-r--r--asn1c/asn1c.c24
-rw-r--r--doc/asn1c-usage.lyx27
-rw-r--r--doc/asn1c-usage.pdfbin66895 -> 69290 bytes
-rw-r--r--libasn1compiler/asn1c_C.c8
-rw-r--r--libasn1compiler/asn1compiler.h4
6 files changed, 56 insertions, 17 deletions
diff --git a/asn1c/asn1c.1 b/asn1c/asn1c.1
index f8553d04..f2c3677e 100644
--- a/asn1c/asn1c.1
+++ b/asn1c/asn1c.1
@@ -27,7 +27,7 @@ and other encoding standards.
.TP
\fILanguage Options\fR
.br
-\fB\-fbless-SIZE \-fnative-integers \-funnamed-unions \-ftypes88\fR
+\fB\-fall-defs-global \-fbless-SIZE \-fnative-integers \-funnamed-unions \-ftypes88\fR
.TP
\fIOutput Options\fR
.br
@@ -74,6 +74,14 @@ Enable ASN.1 syntax tree fixer debugging during the fixing stage.
Enable debugging during the actual compile time.
.SH LANGUAGE OPTIONS
.TP
+.B \-fall-defs-global
+Normally the compiler hides the definitions (asn1_DEF_xxx) of the inner
+structure elements (members of SEQUENCE, SET and other types). This option
+makes all such definitions global.
+Enabling this option may pollute the namespace by making lots of asn1_DEF_xxx
+structures globally visible, but will allow you to manipulate
+(encode and decode) the individual members of any complex ASN.1 structure.
+.TP
.B \-fbless-SIZE
Allow SIZE() constraint for INTEGER, ENUMERATED, and other types for which this
constraint is normally prohibited by the standard. This is a violation of
diff --git a/asn1c/asn1c.c b/asn1c/asn1c.c
index db006885..d84d8642 100644
--- a/asn1c/asn1c.c
+++ b/asn1c/asn1c.c
@@ -54,20 +54,20 @@ main(int ac, char **av) {
print_arg__fix_n_print = 1;
break;
case 'f':
- if(strcmp(optarg, "types88") == 0) {
- asn1_parser_flags |= A1P_TYPES_RESTRICT_TO_1988;
- } else if(strcmp(optarg, "constr90") == 0) {
- asn1_parser_flags |= A1P_CONSTRUCTS_RESTRICT_TO_1990;
- } else if(strcmp(optarg, "native-integers") == 0) {
- asn1_compiler_flags |= A1C_USE_NATIVE_INTEGERS;
- } else if(strcmp(optarg, "unnamed-unions") == 0) {
- asn1_compiler_flags |= A1C_UNNAMED_UNIONS;
+ if(strcmp(optarg, "all-defs-global") == 0) {
+ asn1_compiler_flags |= A1C_ALL_DEFS_GLOBAL;
+ } else if(strcmp(optarg, "bless-SIZE") == 0) {
+ asn1_fixer_flags |= A1F_EXTENDED_SizeConstraint;
} else if(strncmp(optarg, "known-extern-type=", 18) == 0) {
char *known_type = optarg + 18;
ret = asn1f_make_known_external_type(known_type);
assert(ret == 0 || errno == EEXIST);
- } else if(strcmp(optarg, "bless-SIZE") == 0) {
- asn1_fixer_flags |= A1F_EXTENDED_SizeConstraint;
+ } else if(strcmp(optarg, "native-integers") == 0) {
+ asn1_compiler_flags |= A1C_USE_NATIVE_INTEGERS;
+ } else if(strcmp(optarg, "unnamed-unions") == 0) {
+ asn1_compiler_flags |= A1C_UNNAMED_UNIONS;
+ } else if(strcmp(optarg, "types88") == 0) {
+ asn1_parser_flags |= A1P_TYPES_RESTRICT_TO_1988;
} else {
fprintf(stderr, "-f%s: Invalid argument\n", optarg);
exit(EX_USAGE);
@@ -286,10 +286,8 @@ usage(char *av0) {
" -Wdebug-compiler --//-- compiler\n"
"\n"
+" -fall-defs-global Don't make the asn1_DEF_'s of structure members \"static\"\n"
" -fbless-SIZE Allow SIZE() constraint for INTEGER etc (non-std.)\n"
-/*
-" -fconstr90 Use only ASN.1:1990 constructs (not available)\n"
-*/
" -fknown-extern-type=<name> Pretend this type is known\n"
" -fnative-integers Use int instead of INTEGER_t whenever possible\n"
" -funnamed-unions Enable unnamed unions in structures\n"
diff --git a/doc/asn1c-usage.lyx b/doc/asn1c-usage.lyx
index 27736a2d..8cd9e30a 100644
--- a/doc/asn1c-usage.lyx
+++ b/doc/asn1c-usage.lyx
@@ -1309,13 +1309,13 @@ The Table
\begin_inset Float table
wide false
-collapsed true
+collapsed false
\layout Standard
\begin_inset Tabular
-<lyxtabular version="3" rows="20" columns="2">
+<lyxtabular version="3" rows="21" columns="2">
<features>
<column alignment="left" valignment="top" leftline="true" width="0">
<column alignment="block" valignment="top" leftline="true" rightline="true" width="3in">
@@ -1602,6 +1602,29 @@ Description
\layout Standard
+-fall-defs-global
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
+Normally the compiler hides the definitions (asn1_DEF_xxx) of the inner
+ structure elements (members of SEQUENCE, SET and other types).
+ This option makes all such definitions global.
+ Enabling this option may pollute the namespace by making lots of asn1_DEF_xxx
+ structures globally visible, but will allow you to manipulate (encode and
+ decode) the individual members of any complex ASN.1 structure.
+\end_inset
+</cell>
+</row>
+<row topline="true">
+<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
+\begin_inset Text
+
+\layout Standard
+
-fbless-SIZE
\end_inset
</cell>
diff --git a/doc/asn1c-usage.pdf b/doc/asn1c-usage.pdf
index 215d99de..0a3313f4 100644
--- a/doc/asn1c-usage.pdf
+++ b/doc/asn1c-usage.pdf
Binary files differ
diff --git a/libasn1compiler/asn1c_C.c b/libasn1compiler/asn1c_C.c
index 10142ca7..a9aa23b3 100644
--- a/libasn1compiler/asn1c_C.c
+++ b/libasn1compiler/asn1c_C.c
@@ -45,6 +45,7 @@ static int emit_type_DEF(arg_t *arg, asn1p_expr_t *expr, int tags_count, int tag
#define C99_MODE (!(arg->flags & A1C_NO_C99))
#define UNNAMED_UNIONS (arg->flags & A1C_UNNAMED_UNIONS)
+#define HIDE_INNER_DEFS (arg->embed && !(arg->flags & A1C_ALL_DEFS_GLOBAL))
#define PCTX_DEF INDENTED( \
OUT("\n"); \
@@ -867,7 +868,10 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) {
REDIR(OT_FUNC_DECLS);
p = MKID(expr->Identifier);
- OUT("extern asn1_TYPE_descriptor_t asn1_DEF_%s;\n", p);
+ if(HIDE_INNER_DEFS) OUT("/* ");
+ OUT("extern asn1_TYPE_descriptor_t asn1_DEF_%s;", p);
+ if(HIDE_INNER_DEFS) OUT(" // (Use -fall-defs-global to expose) */");
+ OUT("\n");
OUT("asn_constr_check_f %s_constraint;\n", p);
OUT("ber_type_decoder_f %s_decode_ber;\n", p);
OUT("der_type_encoder_f %s_encode_der;\n", p);
@@ -1297,6 +1301,8 @@ emit_type_DEF(arg_t *arg, asn1p_expr_t *expr, int tags_count, int tags_impl_skip
char *p;
p = MKID(expr->Identifier);
+ if(HIDE_INNER_DEFS)
+ OUT("static /* Use -fall-defs-global to expose */\n");
OUT("asn1_TYPE_descriptor_t asn1_DEF_%s = {\n", p);
INDENTED(
OUT("\"%s\",\n", expr->_anonymous_type?"":expr->Identifier);
diff --git a/libasn1compiler/asn1compiler.h b/libasn1compiler/asn1compiler.h
index d104dc9a..6b9219a5 100644
--- a/libasn1compiler/asn1compiler.h
+++ b/libasn1compiler/asn1compiler.h
@@ -31,6 +31,10 @@ enum asn1c_flags {
* Enable use of unnamed unions (non-portable feature).
*/
A1C_UNNAMED_UNIONS = 0x0020,
+ /*
+ * Don't make the asn1_DEF_'s of structure members "static".
+ */
+ A1C_ALL_DEFS_GLOBAL = 0x0040,
};
/*