Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
20879ba2
Commit
20879ba2
authored
Nov 06, 2017
by
Bi-Ruei, Chiu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set expr_type to SEQUENCE type
Mimic what OAI's asnfix.c of generate_asn1 script does.
parent
18971e7c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
4 deletions
+29
-4
libasn1compiler/asn1c_C.c
libasn1compiler/asn1c_C.c
+20
-0
libasn1parser/asn1p_y.c
libasn1parser/asn1p_y.c
+5
-2
libasn1parser/asn1p_y.y
libasn1parser/asn1p_y.y
+4
-2
No files found.
libasn1compiler/asn1c_C.c
View file @
20879ba2
...
...
@@ -329,6 +329,7 @@ asn1c_lang_C_type_SEQUENCE(arg_t *arg) {
int
comp_mode
=
0
;
/* {root,ext=1,root,root,...} */
int
saved_target
=
arg
->
target
->
target
;
asn1c_ioc_table_and_objset_t
ioc_tao
;
int
ext_num
=
1
;
DEPENDENCIES
;
...
...
@@ -373,6 +374,15 @@ asn1c_lang_C_type_SEQUENCE(arg_t *arg) {
INDENT
(
-
1
);
tmp_arg
.
embed
--
;
}
else
{
char
ext_name
[
20
];
if
((
v
->
expr_type
==
ASN_CONSTR_SEQUENCE
)
&&
(
v
->
marker
.
flags
&
EM_OPTIONAL
)
&&
(
v
->
Identifier
==
NULL
))
{
sprintf
(
ext_name
,
"ext%d"
,
ext_num
++
);
v
->
Identifier
=
strdup
(
ext_name
);
}
EMBED_WITH_IOCT
(
v
,
ioc_tao
);
}
}
...
...
@@ -568,6 +578,7 @@ asn1c_lang_C_type_SET(arg_t *arg) {
const
char
*
id
;
int
comp_mode
=
0
;
/* {root,ext=1,root,root,...} */
int
saved_target
=
arg
->
target
->
target
;
int
ext_num
=
1
;
DEPENDENCIES
;
...
...
@@ -603,11 +614,20 @@ asn1c_lang_C_type_SET(arg_t *arg) {
}
TQ_FOR
(
v
,
&
(
expr
->
members
),
next
)
{
char
ext_name
[
20
];
if
(
v
->
expr_type
==
A1TC_EXTENSIBLE
)
if
(
comp_mode
<
3
)
comp_mode
++
;
if
(
comp_mode
==
1
)
v
->
marker
.
flags
|=
EM_OMITABLE
|
EM_INDIRECT
;
try_inline_default
(
arg
,
v
,
1
);
if
((
v
->
expr_type
==
ASN_CONSTR_SEQUENCE
)
&&
(
v
->
marker
.
flags
&
EM_OPTIONAL
)
&&
(
v
->
Identifier
==
NULL
))
{
sprintf
(
ext_name
,
"ext%d"
,
ext_num
++
);
v
->
Identifier
=
strdup
(
ext_name
);
}
EMBED
(
v
);
}
...
...
libasn1parser/asn1p_y.c
View file @
20879ba2
...
...
@@ -349,6 +349,7 @@ void asn1p_lexer_hack_push_encoding_control(void);
extern
int
asn1p_lineno
;
const
char
*
asn1p_parse_debug_filename
;
#define ASN_FILENAME asn1p_parse_debug_filename
int
ext_num
=
1
;
/*
* Process directives as <ASN1C:RepresentAsPointer>
...
...
@@ -3086,8 +3087,10 @@ yyreduce:
#line 1034 "asn1p_y.y"
{
(
yyval
.
a_expr
)
=
(
yyvsp
[(
1
)
-
(
5
)].
a_expr
);
asn1p_expr_add_many
((
yyval
.
a_expr
),
(
yyvsp
[(
4
)
-
(
5
)].
a_expr
));
asn1p_expr_free
((
yyvsp
[(
4
)
-
(
5
)].
a_expr
));
(
yyvsp
[(
4
)
-
(
5
)].
a_expr
)
->
meta_type
=
AMT_TYPE
;
(
yyvsp
[(
4
)
-
(
5
)].
a_expr
)
->
expr_type
=
ASN_CONSTR_SEQUENCE
;
(
yyvsp
[(
4
)
-
(
5
)].
a_expr
)
->
marker
.
flags
|=
EM_OPTIONAL
;
asn1p_expr_add
((
yyval
.
a_expr
),
(
yyvsp
[(
4
)
-
(
5
)].
a_expr
));
}
break
;
...
...
libasn1parser/asn1p_y.y
View file @
20879ba2
...
...
@@ -1033,8 +1033,10 @@ ComponentTypeLists:
}
| ComponentTypeLists ',' TOK_VBracketLeft ComponentTypeLists TOK_VBracketRight {
$$ = $1;
asn1p_expr_add_many($$, $4);
asn1p_expr_free($4);
$4->meta_type = AMT_TYPE;
$4->expr_type = ASN_CONSTR_SEQUENCE;
$4->marker.flags |= EM_OPTIONAL;
asn1p_expr_add($$, $4);
}
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment