mirror of https://gerrit.osmocom.org/asn1c
-findirect-choice
git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@942 59561ff5-6e30-0410-9f3c-9617f08c8826
This commit is contained in:
parent
dae8e61278
commit
4cc4572eb5
|
@ -23,7 +23,7 @@ and other encoding standards.
|
||||||
.TP
|
.TP
|
||||||
\fILanguage Options\fR
|
\fILanguage Options\fR
|
||||||
.br
|
.br
|
||||||
\fB\-fall-defs-global \-fbless-SIZE \-fcompound-names
|
\fB\-fall-defs-global \-fbless-SIZE \-fcompound-names \-findirect-choice
|
||||||
.BI "\-fknown-extern-type="<name>
|
.BI "\-fknown-extern-type="<name>
|
||||||
\fB\-fnative-types \-fno-constraints \-fno-include-deps \-funnamed-unions \-ftypes88\fR
|
\fB\-fnative-types \-fno-constraints \-fno-include-deps \-funnamed-unions \-ftypes88\fR
|
||||||
.TP
|
.TP
|
||||||
|
@ -90,9 +90,16 @@ by using complex names for target language structures. (Name collisions
|
||||||
may occur if the ASN.1 module reuses the same identifiers in multiple
|
may occur if the ASN.1 module reuses the same identifiers in multiple
|
||||||
contexts).
|
contexts).
|
||||||
.TP
|
.TP
|
||||||
|
.B \-findirect-choice
|
||||||
|
When generating code for a CHOICE type, compile the CHOICE members as indirect
|
||||||
|
pointers instead of declaring them inline. Consider using this option
|
||||||
|
together with
|
||||||
|
.B \-fno-include-deps
|
||||||
|
to prevent circular references.
|
||||||
|
.TP
|
||||||
.BI "\-fknown-extern-type="<name>
|
.BI "\-fknown-extern-type="<name>
|
||||||
Pretend the specified type is known. The compiler will assume the target
|
Pretend the specified type is known. The compiler will assume the target
|
||||||
language source files for the given type are provided manually.
|
language source files for the given type have been provided manually.
|
||||||
.TP
|
.TP
|
||||||
.B \-fnative-types
|
.B \-fnative-types
|
||||||
Use the native machine's data types (int, double) whenever possible,
|
Use the native machine's data types (int, double) whenever possible,
|
||||||
|
|
|
@ -77,6 +77,8 @@ main(int ac, char **av) {
|
||||||
asn1_fixer_flags |= A1F_EXTENDED_SizeConstraint;
|
asn1_fixer_flags |= A1F_EXTENDED_SizeConstraint;
|
||||||
} else if(strcmp(optarg, "compound-names") == 0) {
|
} else if(strcmp(optarg, "compound-names") == 0) {
|
||||||
asn1_compiler_flags |= A1C_COMPOUND_NAMES;
|
asn1_compiler_flags |= A1C_COMPOUND_NAMES;
|
||||||
|
} else if(strcmp(optarg, "indirect-choice") == 0) {
|
||||||
|
asn1_compiler_flags |= A1C_INDIRECT_CHOICE;
|
||||||
} else if(strncmp(optarg, "known-extern-type=", 18) == 0) {
|
} else if(strncmp(optarg, "known-extern-type=", 18) == 0) {
|
||||||
char *known_type = optarg + 18;
|
char *known_type = optarg + 18;
|
||||||
ret = asn1f_make_known_external_type(known_type);
|
ret = asn1f_make_known_external_type(known_type);
|
||||||
|
@ -313,6 +315,7 @@ usage(const char *av0) {
|
||||||
" -fall-defs-global Don't make the asn1_DEF_'s of structure members \"static\"\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"
|
" -fbless-SIZE Allow SIZE() constraint for INTEGER etc (non-std.)\n"
|
||||||
" -fcompound-names Disambiguate C's struct NAME's inside top-level types\n"
|
" -fcompound-names Disambiguate C's struct NAME's inside top-level types\n"
|
||||||
|
" -findirect-choice Compile members of CHOICE as indirect pointers\n"
|
||||||
" -fknown-extern-type=<name> Pretend the specified type is known\n"
|
" -fknown-extern-type=<name> Pretend the specified type is known\n"
|
||||||
" -fnative-types Use \"long\" instead of INTEGER_t whenever possible, etc.\n"
|
" -fnative-types Use \"long\" instead of INTEGER_t whenever possible, etc.\n"
|
||||||
" -fno-constraints Do not generate constraint checking code\n"
|
" -fno-constraints Do not generate constraint checking code\n"
|
||||||
|
|
|
@ -400,6 +400,19 @@ produce the meaningful code.</FONT></TD></TR>
|
||||||
name clashes in case the module reuses the same identifiers in multiple
|
name clashes in case the module reuses the same identifiers in multiple
|
||||||
contexts.</FONT></TD></TR>
|
contexts.</FONT></TD></TR>
|
||||||
</TBODY><TBODY>
|
</TBODY><TBODY>
|
||||||
|
<TR><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP><FONT SIZE="-1">-findirect-choice</FONT></TD><TD VALIGN=BASELINE ALIGN=LEFT WIDTH="216">
|
||||||
|
<FONT SIZE="-1">When generating code for a CHOICE type, compile
|
||||||
|
the CHOICE members as indirect pointers instead of
|
||||||
|
declaring them inline. Consider using this option
|
||||||
|
together with <B>-fno-include-deps</B> to prevent circular references.
|
||||||
|
</FONT></TD></TR>
|
||||||
|
</TBODY><TBODY>
|
||||||
|
<TR><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP><FONT SIZE="-1">-fknown-extern-type=<I><name></I></FONT></TD><TD VALIGN=BASELINE ALIGN=LEFT WIDTH="216">
|
||||||
|
<FONT SIZE="-1">Pretend the specified type is known. The compiler will
|
||||||
|
assume the target language source files for the given
|
||||||
|
type have been provided manually.
|
||||||
|
</FONT></TD></TR>
|
||||||
|
</TBODY><TBODY>
|
||||||
<TR><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP><FONT SIZE="-1">-fnative-types</FONT></TD><TD VALIGN=BASELINE ALIGN=LEFT WIDTH="216">
|
<TR><TD VALIGN=BASELINE ALIGN=LEFT NOWRAP><FONT SIZE="-1">-fnative-types</FONT></TD><TD VALIGN=BASELINE ALIGN=LEFT WIDTH="216">
|
||||||
<FONT SIZE="-1">Use the native machine's data types (int, double) whenever
|
<FONT SIZE="-1">Use the native machine's data types (int, double) whenever
|
||||||
possible, instead of the compound INTEGER_t, ENUMERATED_t and REAL_t
|
possible, instead of the compound INTEGER_t, ENUMERATED_t and REAL_t
|
||||||
|
|
|
@ -71,7 +71,7 @@ status Open
|
||||||
\backslash
|
\backslash
|
||||||
lhead{This document describes
|
lhead{This document describes
|
||||||
\backslash
|
\backslash
|
||||||
href{http://lionet.info/asn1c}{asn1c-0.9.11}}
|
href{http://lionet.info/asn1c}{asn1c-0.9.17}}
|
||||||
\layout Standard
|
\layout Standard
|
||||||
|
|
||||||
\backslash
|
\backslash
|
||||||
|
@ -169,7 +169,7 @@ END
|
||||||
The compiler would read this ASN.1 definition and produce the following C
|
The compiler would read this ASN.1 definition and produce the following C
|
||||||
type
|
type
|
||||||
\begin_inset Foot
|
\begin_inset Foot
|
||||||
collapsed true
|
collapsed false
|
||||||
|
|
||||||
\layout Standard
|
\layout Standard
|
||||||
|
|
||||||
|
@ -182,8 +182,8 @@ collapsed true
|
||||||
int
|
int
|
||||||
\emph default
|
\emph default
|
||||||
types instead of infinite width INTEGER_t structures.
|
types instead of infinite width INTEGER_t structures.
|
||||||
See Table
|
See Section
|
||||||
\begin_inset LatexCommand \vref{cap:asn1c-cmdopts}
|
\begin_inset LatexCommand \vref{sec:Command-line-options}
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ ell
|
||||||
\emph default
|
\emph default
|
||||||
command may be used to compile the ASN.1 module
|
command may be used to compile the ASN.1 module
|
||||||
\begin_inset Foot
|
\begin_inset Foot
|
||||||
collapsed true
|
collapsed false
|
||||||
|
|
||||||
\layout Standard
|
\layout Standard
|
||||||
|
|
||||||
|
@ -249,8 +249,8 @@ This is probably
|
||||||
not
|
not
|
||||||
\series default
|
\series default
|
||||||
what you want to try out right now -- read through the rest of this chapter
|
what you want to try out right now -- read through the rest of this chapter
|
||||||
and check the Table
|
and check the Section
|
||||||
\begin_inset LatexCommand \vref{cap:asn1c-cmdopts}
|
\begin_inset LatexCommand \vref{sec:Command-line-options}
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
|
@ -438,28 +438,20 @@ int main()
|
||||||
routine.
|
routine.
|
||||||
\layout Section
|
\layout Section
|
||||||
|
|
||||||
Command line options
|
|
||||||
\layout Standard
|
|
||||||
|
|
||||||
The Table
|
\begin_inset LatexCommand \label{sec:Command-line-options}
|
||||||
\begin_inset LatexCommand \vref{cap:asn1c-cmdopts}
|
|
||||||
|
|
||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
summarizes various options affecting the compiler's behavior.
|
Command line options
|
||||||
\layout Standard
|
\layout Standard
|
||||||
|
|
||||||
|
The following table summarizes the asn1c command line options.
|
||||||
\begin_inset Float table
|
|
||||||
placement h
|
|
||||||
wide false
|
|
||||||
collapsed false
|
|
||||||
|
|
||||||
\layout Standard
|
\layout Standard
|
||||||
|
|
||||||
|
|
||||||
\begin_inset Tabular
|
\begin_inset Tabular
|
||||||
<lyxtabular version="3" rows="24" columns="2">
|
<lyxtabular version="3" rows="26" columns="2">
|
||||||
<features islongtable="true">
|
<features islongtable="true">
|
||||||
<column alignment="left" valignment="top" leftline="true" width="0">
|
<column alignment="left" valignment="top" leftline="true" width="0">
|
||||||
<column alignment="block" valignment="top" leftline="true" rightline="true" width="3in">
|
<column alignment="block" valignment="top" leftline="true" rightline="true" width="3in">
|
||||||
|
@ -716,7 +708,7 @@ Enable lexer debugging during the ASN.1 parsing stage.
|
||||||
\end_inset
|
\end_inset
|
||||||
</cell>
|
</cell>
|
||||||
</row>
|
</row>
|
||||||
<row topline="true" bottomline="true">
|
<row topline="true" bottomline="true" newpage="true">
|
||||||
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
|
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
|
||||||
\begin_inset Text
|
\begin_inset Text
|
||||||
|
|
||||||
|
@ -844,6 +836,54 @@ Use complex names for C structures.
|
||||||
|
|
||||||
\layout Standard
|
\layout Standard
|
||||||
|
|
||||||
|
-findirect-choice
|
||||||
|
\end_inset
|
||||||
|
</cell>
|
||||||
|
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
|
||||||
|
\begin_inset Text
|
||||||
|
|
||||||
|
\layout Standard
|
||||||
|
|
||||||
|
When generating code for a CHOICE type, compile the CHOICE members as indirect
|
||||||
|
pointers instead of declaring them inline.
|
||||||
|
Consider using this option together with
|
||||||
|
\series bold
|
||||||
|
-fno-include-deps
|
||||||
|
\series default
|
||||||
|
to prevent circular references.
|
||||||
|
|
||||||
|
\end_inset
|
||||||
|
</cell>
|
||||||
|
</row>
|
||||||
|
<row topline="true">
|
||||||
|
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
|
||||||
|
\begin_inset Text
|
||||||
|
|
||||||
|
\layout Standard
|
||||||
|
|
||||||
|
-fknown-extern-type=
|
||||||
|
\emph on
|
||||||
|
<name>
|
||||||
|
\end_inset
|
||||||
|
</cell>
|
||||||
|
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
|
||||||
|
\begin_inset Text
|
||||||
|
|
||||||
|
\layout Standard
|
||||||
|
|
||||||
|
Pretend the specified type is known.
|
||||||
|
The compiler will assume the target language source files for the given
|
||||||
|
type have been provided manually.
|
||||||
|
|
||||||
|
\end_inset
|
||||||
|
</cell>
|
||||||
|
</row>
|
||||||
|
<row topline="true">
|
||||||
|
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
|
||||||
|
\begin_inset Text
|
||||||
|
|
||||||
|
\layout Standard
|
||||||
|
|
||||||
|
|
||||||
\size small
|
\size small
|
||||||
-fnative-types
|
-fnative-types
|
||||||
|
@ -953,7 +993,7 @@ Pretend to support only ASN.1:1988 embedded types.
|
||||||
\end_inset
|
\end_inset
|
||||||
</cell>
|
</cell>
|
||||||
</row>
|
</row>
|
||||||
<row topline="true" newpage="true">
|
<row topline="true">
|
||||||
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
|
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
|
||||||
\begin_inset Text
|
\begin_inset Text
|
||||||
|
|
||||||
|
@ -1027,17 +1067,6 @@ Generate "-- #line" comments in -E output.
|
||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
|
|
||||||
\layout Caption
|
|
||||||
|
|
||||||
|
|
||||||
\begin_inset LatexCommand \label{cap:asn1c-cmdopts}
|
|
||||||
|
|
||||||
\end_inset
|
|
||||||
|
|
||||||
The list of asn1c command line options
|
|
||||||
\end_inset
|
|
||||||
|
|
||||||
|
|
||||||
\layout Chapter
|
\layout Chapter
|
||||||
|
|
||||||
Using the ASN.1 Compiler
|
Using the ASN.1 Compiler
|
||||||
|
|
Binary file not shown.
|
@ -1865,6 +1865,11 @@ expr_better_indirect(arg_t *arg, asn1p_expr_t *expr) {
|
||||||
if(expr->expr_type != A1TC_REFERENCE)
|
if(expr->expr_type != A1TC_REFERENCE)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
/* -findirect-choice compiles members of CHOICE as indirect pointers */
|
||||||
|
if((arg->flags & A1C_INDIRECT_CHOICE)
|
||||||
|
&& arg->expr->expr_type == ASN_CONSTR_CHOICE)
|
||||||
|
return 1;
|
||||||
|
|
||||||
/* Rewind to the topmost parent expression */
|
/* Rewind to the topmost parent expression */
|
||||||
if((top_parent = expr->parent_expr)) {
|
if((top_parent = expr->parent_expr)) {
|
||||||
while(top_parent->parent_expr)
|
while(top_parent->parent_expr)
|
||||||
|
|
|
@ -47,6 +47,10 @@ enum asn1c_flags {
|
||||||
* Do not generate courtesy #includes for external dependencies.
|
* Do not generate courtesy #includes for external dependencies.
|
||||||
*/
|
*/
|
||||||
A1C_NO_INCLUDE_DEPS = 0x0200,
|
A1C_NO_INCLUDE_DEPS = 0x0200,
|
||||||
|
/*
|
||||||
|
* Compile members of CHOICE as indirect pointers.
|
||||||
|
*/
|
||||||
|
A1C_INDIRECT_CHOICE = 0x0400,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue