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
6938d044
Commit
6938d044
authored
Mar 04, 2005
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring
parent
fe7f6ecd
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
16 deletions
+37
-16
asn1c/tests/check-50.c
asn1c/tests/check-50.c
+23
-0
libasn1compiler/asn1c_C.c
libasn1compiler/asn1c_C.c
+3
-1
libasn1compiler/asn1c_constraint.c
libasn1compiler/asn1c_constraint.c
+11
-14
libasn1parser/asn1p_constr.h
libasn1parser/asn1p_constr.h
+0
-1
No files found.
asn1c/tests/check-50.c
0 → 100644
View file @
6938d044
#undef NDEBUG
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include <assert.h>
#include <Int5.h>
#include <Str4.h>
#include <Utf8-4.h>
#include <VisibleIdentifier.h>
int
main
(
int
ac
,
char
**
av
)
{
(
void
)
ac
;
/* Unused argument */
(
void
)
av
;
/* Unused argument */
/*
* No plans to fill it up: just checking whether it compiles or not.
*/
return
0
;
}
libasn1compiler/asn1c_C.c
View file @
6938d044
...
...
@@ -967,7 +967,9 @@ asn1c_lang_C_type_SIMPLE_TYPE(arg_t *arg) {
}
if
((
!
expr
->
constraints
||
(
arg
->
flags
&
A1C_NO_CONSTRAINTS
))
&&
(
arg
->
embed
||
expr
->
tag
.
tag_class
==
TC_NOCLASS
)
&&
etd_spec
==
ETD_NO_SPECIFICS
)
{
&&
etd_spec
==
ETD_NO_SPECIFICS
&&
0
/* This shortcut is incompatible with XER */
)
{
char
*
type_name
;
REDIR
(
OT_FUNC_DECLS
);
type_name
=
asn1c_type_name
(
arg
,
expr
,
TNF_SAFE
);
...
...
libasn1compiler/asn1c_constraint.c
View file @
6938d044
...
...
@@ -13,8 +13,6 @@ static int emit_size_determination_code(arg_t *arg, asn1p_expr_type_e etype);
static
asn1p_expr_type_e
_find_terminal_type
(
arg_t
*
arg
);
static
int
emit_range_comparison_code
(
arg_t
*
arg
,
asn1cnst_range_t
*
range
,
const
char
*
varname
,
asn1c_integer_t
natural_start
,
asn1c_integer_t
natural_stop
);
static
int
global_compile_mark
;
int
asn1c_emit_constraint_checking_code
(
arg_t
*
arg
)
{
asn1cnst_range_t
*
r_size
;
...
...
@@ -23,6 +21,7 @@ asn1c_emit_constraint_checking_code(arg_t *arg) {
asn1p_expr_type_e
etype
;
asn1p_constraint_t
*
ct
;
int
got_something
=
0
;
int
alphabet_table_compiled
;
int
produce_st
=
0
;
ct
=
expr
->
combined_constraints
;
...
...
@@ -125,7 +124,8 @@ asn1c_emit_constraint_checking_code(arg_t *arg) {
INDENT
(
-
1
);
REDIR
(
OT_CTABLES
);
/* Emit FROM() tables */
asn1c_emit_constraint_tables
(
arg
,
r_size
?
1
:
0
);
alphabet_table_compiled
=
(
asn1c_emit_constraint_tables
(
arg
,
r_size
?
1
:
0
)
==
1
);
REDIR
(
OT_CODE
);
INDENT
(
+
1
);
...
...
@@ -152,10 +152,11 @@ asn1c_emit_constraint_checking_code(arg_t *arg) {
"value"
,
-
1
,
-
1
);
OUT
(
")"
);
}
if
(
ct
->
_compile_mark
)
{
if
(
alphabet_table_compiled
)
{
if
(
got_something
++
)
{
OUT
(
"
\n
"
);
OUT
(
" && "
);
}
OUT
(
"!check_permitted_alphabet_%d(sptr)"
,
ct
->
_compile_mark
);
OUT
(
"!check_permitted_alphabet_%d(%s)"
,
arg
->
expr
->
_type_unique_index
,
produce_st
?
"st"
:
"sptr"
);
}
if
(
!
got_something
)
{
OUT
(
"1 /* No applicable constraints whatsoever */"
);
...
...
@@ -252,9 +253,6 @@ asn1c_emit_constraint_tables(arg_t *arg, int got_size) {
max_table_size
=
128
;
}
if
(
!
ct
->
_compile_mark
)
ct
->
_compile_mark
=
++
global_compile_mark
;
if
(
use_table
)
{
int
i
,
n
=
0
;
int
untl
;
...
...
@@ -278,7 +276,7 @@ asn1c_emit_constraint_tables(arg_t *arg, int got_size) {
untl
=
(
range_stop
-
range_start
)
+
1
;
untl
+=
(
untl
%
16
)
?
16
-
(
untl
%
16
)
:
0
;
OUT
(
"static int permitted_alphabet_table_%d[%d] = {
\n
"
,
ct
->
_compile_mark
,
max_table_size
);
arg
->
expr
->
_type_unique_index
,
max_table_size
);
for
(
n
=
0
;
n
<
untl
;
n
++
)
{
OUT
(
"%d,"
,
table
[
n
]
?
1
:
0
);
if
(
!
((
n
+
1
)
%
16
))
{
...
...
@@ -316,7 +314,6 @@ asn1c_emit_constraint_tables(arg_t *arg, int got_size) {
* for the syntax validity, so we don't have
* to repeat this process twice.
*/
ct
->
_compile_mark
=
0
;
/* Don't generate code */
asn1constraint_range_free
(
range
);
return
0
;
}
else
{
...
...
@@ -332,7 +329,7 @@ asn1c_emit_constraint_tables(arg_t *arg, int got_size) {
}
OUT
(
"static int check_permitted_alphabet_%d(const void *sptr) {
\n
"
,
ct
->
_compile_mark
);
arg
->
expr
->
_type_unique_index
);
INDENT
(
+
1
);
if
(
utf8_full_alphabet_check
)
{
OUT
(
"if(UTF8String_length((const UTF8String_t *)sptr) < 0)
\n
"
);
...
...
@@ -341,7 +338,7 @@ asn1c_emit_constraint_tables(arg_t *arg, int got_size) {
}
else
{
if
(
use_table
)
{
OUT
(
"int *table = permitted_alphabet_table_%d;
\n
"
,
ct
->
_compile_mark
);
arg
->
expr
->
_type_unique_index
);
emit_alphabet_check_loop
(
arg
,
0
);
}
else
{
emit_alphabet_check_loop
(
arg
,
range
);
...
...
@@ -354,7 +351,7 @@ asn1c_emit_constraint_tables(arg_t *arg, int got_size) {
asn1constraint_range_free
(
range
);
return
0
;
return
1
;
}
static
int
...
...
libasn1parser/asn1p_constr.h
View file @
6938d044
...
...
@@ -57,7 +57,6 @@ typedef struct asn1p_constraint_s {
unsigned
int
el_size
;
/* Size of the allocated (elements) */
int
_lineno
;
/* Position in a source file */
int
_compile_mark
;
/* Marker used by the compiler */
}
asn1p_constraint_t
;
/* Human-readable constraint type description */
...
...
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