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
729eb86b
Commit
729eb86b
authored
Sep 21, 2006
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
generate PER code tables for known-multiplier strings
parent
f714ecdf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
5 deletions
+29
-5
libasn1compiler/asn1c_C.c
libasn1compiler/asn1c_C.c
+7
-0
libasn1compiler/asn1c_constraint.c
libasn1compiler/asn1c_constraint.c
+22
-5
No files found.
libasn1compiler/asn1c_C.c
View file @
729eb86b
...
...
@@ -1905,6 +1905,13 @@ emit_single_member_PER_constraints(arg_t *arg, asn1p_expr_t *expr) {
tmprng
.
right
.
value
=
eidx
<
0
?
0
:
eidx
;
if
(
emit_single_member_PER_constraint
(
arg
,
&
tmprng
,
0
))
return
-
1
;
}
else
if
(
etype
&
ASN_STRING_KM_MASK
)
{
range
=
asn1constraint_compute_PER_range
(
etype
,
expr
->
combined_constraints
,
ACT_CT_FROM
,
0
,
0
,
0
);
if
(
emit_single_member_PER_constraint
(
arg
,
range
,
0
))
return
-
1
;
asn1constraint_range_free
(
range
);
}
else
{
range
=
asn1constraint_compute_PER_range
(
etype
,
expr
->
combined_constraints
,
ACT_EL_RANGE
,
...
...
libasn1compiler/asn1c_constraint.c
View file @
729eb86b
...
...
@@ -31,7 +31,7 @@ asn1c_emit_constraint_checking_code(arg_t *arg) {
etype
=
_find_terminal_type
(
arg
);
r_value
=
asn1constraint_compute_PER_range
(
etype
,
ct
,
ACT_EL_RANGE
,
0
,
0
,
0
);
r_size
=
asn1constraint_compute_PER_range
(
etype
,
ct
,
ACT_CT_SIZE
,
0
,
0
,
0
);
r_size
=
asn1constraint_compute_PER_range
(
etype
,
ct
,
ACT_CT_SIZE
,
0
,
0
,
0
);
if
(
r_value
)
{
if
(
r_value
->
incompatible
||
r_value
->
empty_constraint
...
...
@@ -133,7 +133,7 @@ asn1c_emit_constraint_checking_code(arg_t *arg) {
INDENT
(
+
1
);
/*
* Here is an if() {} else {} constaint checking code.
* Here is an if() {} else {} cons
r
taint checking code.
*/
OUT
(
"
\n
"
);
OUT
(
"if("
);
...
...
@@ -251,7 +251,7 @@ asn1c_emit_constraint_tables(arg_t *arg, int got_size) {
if
(
range
->
el_count
==
0
)
{
/*
* It's better to have a short if() check
* than waste
4
k of table space
* than waste
1
k of table space
*/
use_table
=
0
;
}
...
...
@@ -265,6 +265,7 @@ asn1c_emit_constraint_tables(arg_t *arg, int got_size) {
}
if
(
use_table
)
{
int
cardinal
=
0
;
int
i
,
n
=
0
;
int
untl
;
memset
(
table
,
0
,
sizeof
(
table
));
...
...
@@ -289,10 +290,11 @@ asn1c_emit_constraint_tables(arg_t *arg, int got_size) {
OUT
(
"static int permitted_alphabet_table_%d[%d] = {
\n
"
,
arg
->
expr
->
_type_unique_index
,
max_table_size
);
for
(
n
=
0
;
n
<
untl
;
n
++
)
{
OUT
(
"%d,"
,
table
[
n
]
?
1
:
0
);
cardinal
+=
table
[
n
]
?
1
:
0
;
OUT
(
"%2d,"
,
table
[
n
]);
if
(
!
((
n
+
1
)
%
16
))
{
int
c
;
if
(
!
n
)
{
if
(
!
n
||
(
n
-
15
)
+
range_start
>=
0x80
)
{
OUT
(
"
\n
"
);
continue
;
}
...
...
@@ -313,6 +315,21 @@ asn1c_emit_constraint_tables(arg_t *arg, int got_size) {
}
}
OUT
(
"};
\n
"
);
if
((
arg
->
flags
&
A1C_GEN_PER
))
{
int
c
;
OUT
(
"static int permitted_alphabet_code2value_%d[%d] = {
\n
"
,
arg
->
expr
->
_type_unique_index
,
cardinal
);
for
(
n
=
c
=
0
;
c
<
max_table_size
;
c
++
)
{
if
(
table
[
c
])
{
OUT
(
"%d,"
,
c
);
if
(
!
((
++
n
)
%
16
))
OUT
(
"
\n
"
);
}
}
OUT
(
"};
\n
"
);
OUT
(
"
\n
"
);
}
OUT
(
"
\n
"
);
}
else
if
(
etype
==
ASN_STRING_UTF8String
)
{
/*
...
...
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