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
d8e07c5f
Commit
d8e07c5f
authored
Aug 23, 2017
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parameterized referencing of information object sets
parent
a45518f5
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
402 additions
and
25 deletions
+402
-25
libasn1compiler/Makefile.am
libasn1compiler/Makefile.am
+1
-0
libasn1compiler/asn1c_C.c
libasn1compiler/asn1c_C.c
+13
-9
libasn1compiler/asn1c_ioc.c
libasn1compiler/asn1c_ioc.c
+17
-12
libasn1compiler/asn1c_ioc.h
libasn1compiler/asn1c_ioc.h
+3
-0
libasn1fix/asn1fix_param.c
libasn1fix/asn1fix_param.c
+4
-4
tests/tests-asn1c-compiler/144-ios-parameterization-OK.asn1
tests/tests-asn1c-compiler/144-ios-parameterization-OK.asn1
+34
-0
tests/tests-asn1c-compiler/144-ios-parameterization-OK.asn1.-P
.../tests-asn1c-compiler/144-ios-parameterization-OK.asn1.-P
+330
-0
No files found.
libasn1compiler/Makefile.am
View file @
d8e07c5f
...
@@ -4,6 +4,7 @@ AM_CFLAGS = @ADD_CFLAGS@
...
@@ -4,6 +4,7 @@ AM_CFLAGS = @ADD_CFLAGS@
AM_CPPFLAGS
=
\
AM_CPPFLAGS
=
\
-I
$(top_srcdir)
/libasn1common
\
-I
$(top_srcdir)
/libasn1common
\
-I
$(top_srcdir)
/libasn1parser
\
-I
$(top_srcdir)
/libasn1parser
\
-I
$(top_srcdir)
/libasn1print
\
-I
$(top_srcdir)
/libasn1fix
-I
$(top_srcdir)
/libasn1fix
noinst_LTLIBRARIES
=
libasn1compiler.la
noinst_LTLIBRARIES
=
libasn1compiler.la
...
...
libasn1compiler/asn1c_C.c
View file @
d8e07c5f
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#include "asn1c_out.h"
#include "asn1c_out.h"
#include "asn1c_misc.h"
#include "asn1c_misc.h"
#include "asn1c_ioc.h"
#include "asn1c_ioc.h"
#include <asn1print.h>
#include <asn1fix_crange.h>
/* constraint groker from libasn1fix */
#include <asn1fix_crange.h>
/* constraint groker from libasn1fix */
#include <asn1fix_export.h>
/* other exportables from libasn1fix */
#include <asn1fix_export.h>
/* other exportables from libasn1fix */
#include <asn1parser.h>
#include <asn1parser.h>
...
@@ -320,6 +321,7 @@ is_open_type(arg_t *arg, asn1p_expr_t *expr, asn1c_ioc_table_and_objset_t *opt_i
...
@@ -320,6 +321,7 @@ is_open_type(arg_t *arg, asn1p_expr_t *expr, asn1c_ioc_table_and_objset_t *opt_i
&&
expr
->
reference
->
comp_count
==
2
&&
expr
->
reference
->
comp_count
==
2
&&
expr
->
reference
->
components
[
1
].
lex_type
&&
expr
->
reference
->
components
[
1
].
lex_type
==
RLT_AmpUppercase
)
{
==
RLT_AmpUppercase
)
{
DEBUG
(
"%s is a true open type"
,
MKID
(
expr
));
return
1
;
return
1
;
}
}
...
@@ -461,7 +463,8 @@ asn1c_lang_C_type_SEQUENCE_def(arg_t *arg, asn1c_ioc_table_and_objset_t *opt_ioc
...
@@ -461,7 +463,8 @@ asn1c_lang_C_type_SEQUENCE_def(arg_t *arg, asn1c_ioc_table_and_objset_t *opt_ioc
}
}
if
(
v
->
marker
.
flags
&
EM_OMITABLE
)
if
(
v
->
marker
.
flags
&
EM_OMITABLE
)
comp_mode
==
1
?
++
aoms_count
:
++
roms_count
;
comp_mode
==
1
?
++
aoms_count
:
++
roms_count
;
emit_member_table
(
arg
,
v
,
opt_ioc
);
if
(
emit_member_table
(
arg
,
v
,
opt_ioc
)
<
0
)
return
-
1
;
elements
++
;
elements
++
;
});
});
OUT
(
"};
\n
"
);
OUT
(
"};
\n
"
);
...
@@ -2709,16 +2712,16 @@ emit_member_type_selector(arg_t *arg, asn1p_expr_t *expr, asn1c_ioc_table_and_ob
...
@@ -2709,16 +2712,16 @@ emit_member_type_selector(arg_t *arg, asn1p_expr_t *expr, asn1c_ioc_table_and_ob
return
0
;
return
0
;
}
}
if
(
crc
->
el_count
<=
1
||
crc
->
elements
[
0
]
->
type
!=
ACT_EL_VALUE
const
asn1p_ref_t
*
objset_ref
=
||
crc
->
elements
[
0
]
->
value
->
type
!=
ATV_REFERENCED
asn1c_get_information_object_set_reference_from_constraint
(
arg
,
crc
);
||
crc
->
elements
[
0
]
->
value
->
value
.
reference
->
comp_count
!=
1
)
{
FATAL
(
if
(
!
objset_ref
||
objset_ref
->
comp_count
!=
1
)
{
"Reference does not look like an object set"
);
FATAL
(
"Reference %s does not look like an object set type %s"
,
asn1p_constraint_string
(
crc
),
asn1p_ref_string
(
objset_ref
));
return
-
1
;
return
-
1
;
}
}
const
char
*
objset_name
=
const
char
*
objset_name
=
objset_ref
->
components
[
0
].
name
;
crc
->
elements
[
0
]
->
value
->
value
.
reference
->
components
[
0
].
name
;
if
(
strcmp
(
objset_name
,
opt_ioc
->
objset
->
Identifier
)
!=
0
)
{
if
(
strcmp
(
objset_name
,
opt_ioc
->
objset
->
Identifier
)
!=
0
)
{
FATAL
(
"Object Set references do not match: %s != %s"
,
objset_name
,
FATAL
(
"Object Set references do not match: %s != %s"
,
objset_name
,
opt_ioc
->
objset
->
Identifier
);
opt_ioc
->
objset
->
Identifier
);
...
@@ -3006,7 +3009,8 @@ emit_member_table(arg_t *arg, asn1p_expr_t *expr, asn1c_ioc_table_and_objset_t *
...
@@ -3006,7 +3009,8 @@ emit_member_table(arg_t *arg, asn1p_expr_t *expr, asn1c_ioc_table_and_objset_t *
if
(
C99_MODE
)
OUT
(
".type_selector = "
);
if
(
C99_MODE
)
OUT
(
".type_selector = "
);
if
(
opt_ioc
)
{
if
(
opt_ioc
)
{
emit_member_type_selector
(
arg
,
expr
,
opt_ioc
);
if
(
emit_member_type_selector
(
arg
,
expr
,
opt_ioc
)
<
0
)
return
-
1
;
}
else
{
}
else
{
OUT
(
"0"
);
OUT
(
"0"
);
}
}
...
...
libasn1compiler/asn1c_ioc.c
View file @
d8e07c5f
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include "asn1c_out.h"
#include "asn1c_out.h"
#include "asn1c_misc.h"
#include "asn1c_misc.h"
#include <asn1fix_export.h>
#include <asn1fix_export.h>
#include <asn1print.h>
#define MKID(expr) asn1c_make_identifier(0, (expr), 0)
#define MKID(expr) asn1c_make_identifier(0, (expr), 0)
...
@@ -10,18 +11,26 @@
...
@@ -10,18 +11,26 @@
* Given the table constraint or component relation constraint
* Given the table constraint or component relation constraint
* ({ObjectSetName}{...}) returns "ObjectSetName" as a reference.
* ({ObjectSetName}{...}) returns "ObjectSetName" as a reference.
*/
*/
static
const
asn1p_ref_t
*
const
asn1p_ref_t
*
asn1c_get_information_object_set_reference_from_constraint
(
asn1c_get_information_object_set_reference_from_constraint
(
arg_t
*
arg
,
const
asn1p_constraint_t
*
ct
)
{
const
asn1p_constraint_t
*
ct
)
{
if
(
!
ct
)
return
NULL
;
if
(
!
ct
)
return
NULL
;
assert
(
ct
->
type
==
ACT_CA_CRC
);
assert
(
ct
->
type
==
ACT_CA_CRC
);
assert
(
ct
->
el_count
>=
1
);
assert
(
ct
->
el_count
>=
1
);
DEBUG
(
"Component Relation Constraint: %s"
,
asn1p_constraint_string
(
ct
));
assert
(
ct
->
elements
[
0
]
->
type
==
ACT_EL_VALUE
);
assert
(
ct
->
elements
[
0
]
->
type
==
ACT_EL_VALUE
);
asn1p_value_t
*
val
=
ct
->
elements
[
0
]
->
value
;
asn1p_value_t
*
val
=
ct
->
elements
[
0
]
->
value
;
assert
(
val
->
type
==
ATV_REFERENCED
);
if
(
val
->
type
==
ATV_VALUESET
&&
val
->
value
.
constraint
->
type
==
ACT_EL_TYPE
&&
val
->
value
.
constraint
->
containedSubtype
&&
val
->
value
.
constraint
->
containedSubtype
->
type
==
ATV_REFERENCED
)
{
return
val
->
value
.
constraint
->
containedSubtype
->
value
.
reference
;
}
if
(
val
->
type
!=
ATV_REFERENCED
)
{
FATAL
(
"Set reference: %s"
,
asn1f_printable_value
(
val
));
assert
(
val
->
type
==
ATV_REFERENCED
);
}
return
val
->
value
.
reference
;
return
val
->
value
.
reference
;
}
}
...
@@ -53,17 +62,12 @@ asn1c_get_ioc_table(arg_t *arg) {
...
@@ -53,17 +62,12 @@ asn1c_get_ioc_table(arg_t *arg) {
asn1c_ioc_table_and_objset_t
safe_ioc_tao
=
{
0
,
0
,
0
};
asn1c_ioc_table_and_objset_t
safe_ioc_tao
=
{
0
,
0
,
0
};
asn1c_ioc_table_and_objset_t
failed_ioc_tao
=
{
0
,
0
,
1
};
asn1c_ioc_table_and_objset_t
failed_ioc_tao
=
{
0
,
0
,
1
};
if
(
expr
->
lhs_params
)
{
if
(
0
)
WARNING
(
"Can not process Information Object Set on a parameterized type %s"
,
MKID
(
expr
));
return
safe_ioc_tao
;
}
TQ_FOR
(
memb
,
&
(
expr
->
members
),
next
)
{
TQ_FOR
(
memb
,
&
(
expr
->
members
),
next
)
{
const
asn1p_constraint_t
*
cr_ct
=
asn1p_get_component_relation_constraint
(
memb
->
constraints
);
const
asn1p_ref_t
*
tmpref
=
const
asn1p_ref_t
*
tmpref
=
asn1c_get_information_object_set_reference_from_constraint
(
asn1c_get_information_object_set_reference_from_constraint
(
arg
,
asn1p_get_component_relation_constraint
(
memb
->
constraints
)
);
cr_ct
);
if
(
tmpref
)
{
if
(
tmpref
)
{
if
(
objset_ref
&&
asn1p_ref_compare
(
objset_ref
,
tmpref
)
!=
0
)
{
if
(
objset_ref
&&
asn1p_ref_compare
(
objset_ref
,
tmpref
)
!=
0
)
{
FATAL
(
FATAL
(
...
@@ -74,6 +78,7 @@ asn1c_get_ioc_table(arg_t *arg) {
...
@@ -74,6 +78,7 @@ asn1c_get_ioc_table(arg_t *arg) {
}
}
objset_ref
=
tmpref
;
objset_ref
=
tmpref
;
}
}
}
}
if
(
!
objset_ref
)
{
if
(
!
objset_ref
)
{
...
...
libasn1compiler/asn1c_ioc.h
View file @
d8e07c5f
...
@@ -15,5 +15,8 @@ asn1c_ioc_table_and_objset_t asn1c_get_ioc_table(arg_t *arg);
...
@@ -15,5 +15,8 @@ asn1c_ioc_table_and_objset_t asn1c_get_ioc_table(arg_t *arg);
int
emit_ioc_table
(
arg_t
*
arg
,
asn1p_expr_t
*
context
,
int
emit_ioc_table
(
arg_t
*
arg
,
asn1p_expr_t
*
context
,
asn1c_ioc_table_and_objset_t
);
asn1c_ioc_table_and_objset_t
);
const
asn1p_ref_t
*
asn1c_get_information_object_set_reference_from_constraint
(
arg_t
*
arg
,
const
asn1p_constraint_t
*
ct
);
#endif
/* ASN1_IOC_H */
#endif
/* ASN1_IOC_H */
libasn1fix/asn1fix_param.c
View file @
d8e07c5f
...
@@ -27,10 +27,6 @@ asn1f_parameterization_fork(arg_t *arg, asn1p_expr_t *expr, asn1p_expr_t *rhs_ps
...
@@ -27,10 +27,6 @@ asn1f_parameterization_fork(arg_t *arg, asn1p_expr_t *expr, asn1p_expr_t *rhs_ps
assert
(
expr
->
lhs_params
);
assert
(
expr
->
lhs_params
);
assert
(
expr
->
parent_expr
==
0
);
assert
(
expr
->
parent_expr
==
0
);
DEBUG
(
"Forking parameterization at %d for %s (%d alr)"
,
rhs_pspecs
->
_lineno
,
expr
->
Identifier
,
expr
->
specializations
.
pspecs_count
);
/*
/*
* Find if this exact specialization has been used already.
* Find if this exact specialization has been used already.
*/
*/
...
@@ -45,6 +41,10 @@ asn1f_parameterization_fork(arg_t *arg, asn1p_expr_t *expr, asn1p_expr_t *rhs_ps
...
@@ -45,6 +41,10 @@ asn1f_parameterization_fork(arg_t *arg, asn1p_expr_t *expr, asn1p_expr_t *rhs_ps
}
}
}
}
DEBUG
(
"Forking parameterization at %d for %s (%d alr)"
,
rhs_pspecs
->
_lineno
,
expr
->
Identifier
,
expr
->
specializations
.
pspecs_count
);
rarg
.
resolver
=
resolve_expr
;
rarg
.
resolver
=
resolve_expr
;
rarg
.
arg
=
arg
;
rarg
.
arg
=
arg
;
rarg
.
original_expr
=
expr
;
rarg
.
original_expr
=
expr
;
...
...
tests/tests-asn1c-compiler/144-ios-parameterization-OK.asn1
0 → 100755
View file @
d8e07c5f
-- OK: Everything is fine
-- iso.org.dod.internet.private.enterprise (1.3.6.1.4.1)
-- .spelio.software.asn1c.test (9363.1.5.1)
-- .144
ModuleInformationObjectParameterization
{ iso org(3) dod(6) internet (1) private(4) enterprise(1)
spelio(9363) software(1) asn1c(5) test(1) 144 }
DEFINITIONS ::=
BEGIN
MYID ::= CLASS {
&id INTEGER UNIQUE,
&Type
} WITH SYNTAX {&Type IDENTIFIED BY &id}
RegionalExtension MYID ::= {
{INTEGER IDENTIFIED BY 1} |
{BOOLEAN IDENTIFIED BY 2},
...
}
Message ::= SEQUENCE {
content SpecializedContent {{RegionalExtension}}
}
SpecializedContent {MYID : Set} ::= SEQUENCE {
id MYID.&id({Set}),
value MYID.&Type({Set}{@id})
}
END
tests/tests-asn1c-compiler/144-ios-parameterization-OK.asn1.-P
0 → 100644
View file @
d8e07c5f
This diff is collapsed.
Click to expand it.
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