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
5a8219a1
Commit
5a8219a1
authored
Sep 08, 2004
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better handling of recursive definitions
parent
61c7069b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
29 deletions
+40
-29
libasn1compiler/asn1c_C.c
libasn1compiler/asn1c_C.c
+24
-24
libasn1compiler/asn1c_misc.c
libasn1compiler/asn1c_misc.c
+16
-5
No files found.
libasn1compiler/asn1c_C.c
View file @
5a8219a1
...
@@ -1145,32 +1145,32 @@ emit_tags_vector(arg_t *arg, asn1p_expr_t *expr, int *tags_impl_skip, int choice
...
@@ -1145,32 +1145,32 @@ emit_tags_vector(arg_t *arg, asn1p_expr_t *expr, int *tags_impl_skip, int choice
p
=
MKID
(
expr
->
Identifier
);
p
=
MKID
(
expr
->
Identifier
);
OUT
(
"static ber_tlv_tag_t asn1_DEF_%s_tags[] = {
\n
"
,
p
);
OUT
(
"static ber_tlv_tag_t asn1_DEF_%s_tags[] = {
\n
"
,
p
);
INDENTED
(
INDENT
(
+
1
);
if
(
expr
->
tag
.
tag_class
)
{
if
(
expr
->
tag
.
tag_class
)
{
tags_count
++
;
_print_tag
(
arg
,
expr
,
&
expr
->
tag
);
if
(
expr
->
tag
.
tag_mode
!=
TM_EXPLICIT
)
(
*
tags_impl_skip
)
++
;
}
else
{
if
(
!
choice_mode
)
(
*
tags_impl_skip
)
++
;
}
if
(
!
choice_mode
)
{
if
(
!
expr
->
tag
.
tag_class
||
(
expr
->
meta_type
==
AMT_TYPE
&&
expr
->
tag
.
tag_mode
==
TM_EXPLICIT
))
{
struct
asn1p_type_tag_s
tag
;
if
(
expr
->
tag
.
tag_class
)
OUT
(
",
\n
"
);
tag
.
tag_class
=
TC_UNIVERSAL
;
tag
.
tag_mode
=
TM_IMPLICIT
;
tag
.
tag_value
=
expr_type2uclass_value
[
expr
->
expr_type
];
_print_tag
(
arg
,
expr
,
&
tag
);
tags_count
++
;
tags_count
++
;
_print_tag
(
arg
,
expr
,
&
expr
->
tag
);
if
(
expr
->
tag
.
tag_mode
!=
TM_EXPLICIT
)
(
*
tags_impl_skip
)
++
;
}
else
{
if
(
!
choice_mode
)
(
*
tags_impl_skip
)
++
;
}
}
if
(
!
choice_mode
)
{
}
if
(
!
expr
->
tag
.
tag_class
OUT
(
"
\n
"
);
||
(
expr
->
meta_type
==
AMT_TYPE
INDENT
(
-
1
);
&&
expr
->
tag
.
tag_mode
==
TM_EXPLICIT
))
{
struct
asn1p_type_tag_s
tag
;
if
(
expr
->
tag
.
tag_class
)
OUT
(
",
\n
"
);
tag
.
tag_class
=
TC_UNIVERSAL
;
tag
.
tag_mode
=
TM_IMPLICIT
;
tag
.
tag_value
=
expr_type2uclass_value
[
expr
->
expr_type
];
_print_tag
(
arg
,
expr
,
&
tag
);
tags_count
++
;
}
}
OUT
(
"
\n
"
);
);
OUT
(
"};
\n
"
);
OUT
(
"};
\n
"
);
return
tags_count
;
return
tags_count
;
...
...
libasn1compiler/asn1c_misc.c
View file @
5a8219a1
...
@@ -85,8 +85,14 @@ asn1c_make_identifier(int unsafe_only_spaces, char *arg1, ...) {
...
@@ -85,8 +85,14 @@ asn1c_make_identifier(int unsafe_only_spaces, char *arg1, ...) {
char
*
char
*
asn1c_type_name
(
arg_t
*
arg
,
asn1p_expr_t
*
expr
,
enum
tnfmt
_format
)
{
asn1c_type_name
(
arg_t
*
arg
,
asn1p_expr_t
*
expr
,
enum
tnfmt
_format
)
{
asn1p_expr_t
*
top_parent
;
char
*
typename
;
char
*
typename
;
/* Rewind to the topmost parent expression */
if
((
top_parent
=
expr
->
parent_expr
))
while
(
top_parent
->
parent_expr
)
top_parent
=
top_parent
->
parent_expr
;
switch
(
expr
->
expr_type
)
{
switch
(
expr
->
expr_type
)
{
case
A1TC_REFERENCE
:
case
A1TC_REFERENCE
:
typename
=
expr
->
reference
->
components
[
typename
=
expr
->
reference
->
components
[
...
@@ -104,7 +110,9 @@ asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format) {
...
@@ -104,7 +110,9 @@ asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format) {
tmp
.
mod
=
tmp
.
expr
->
module
;
tmp
.
mod
=
tmp
.
expr
->
module
;
return
asn1c_type_name
(
&
tmp
,
tmp
.
expr
,
_format
);
return
asn1c_type_name
(
&
tmp
,
tmp
.
expr
,
_format
);
}
else
if
(
_format
==
TNF_RSAFE
)
{
}
if
(
_format
==
TNF_RSAFE
||
_format
==
TNF_CTYPE
)
{
/*
/*
* The recursion-safe format is requested.
* The recursion-safe format is requested.
* The problem here is that only constructed types
* The problem here is that only constructed types
...
@@ -115,10 +123,13 @@ asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format) {
...
@@ -115,10 +123,13 @@ asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format) {
asn1p_expr_t
*
terminal
;
asn1p_expr_t
*
terminal
;
terminal
=
asn1f_find_terminal_type_ex
(
terminal
=
asn1f_find_terminal_type_ex
(
arg
->
asn
,
arg
->
mod
,
arg
->
expr
);
arg
->
asn
,
arg
->
mod
,
arg
->
expr
);
if
(
terminal
if
(
terminal
)
{
&&
(
terminal
->
expr_type
if
(
terminal
->
expr_type
&
(
ASN_BASIC_MASK
|
ASN_STRING_MASK
)))
&
(
ASN_BASIC_MASK
|
ASN_STRING_MASK
))
_format
=
TNF_CTYPE
;
_format
=
TNF_CTYPE
;
if
(
terminal
==
top_parent
)
_format
=
TNF_RSAFE
;
}
}
}
break
;
break
;
#if 0
#if 0
...
...
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