mirror of https://gerrit.osmocom.org/asn1c
-fall-defs-global
git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@269 59561ff5-6e30-0410-9f3c-9617f08c8826
This commit is contained in:
parent
465f3c0249
commit
12c8f69a56
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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>
|
||||
|
|
Binary file not shown.
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue