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
c78cbfbd
Commit
c78cbfbd
authored
Sep 14, 2004
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
REAL support
parent
2888f274
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
45 deletions
+55
-45
ChangeLog
ChangeLog
+3
-1
libasn1compiler/asn1c_C.c
libasn1compiler/asn1c_C.c
+10
-29
libasn1compiler/asn1c_C.h
libasn1compiler/asn1c_C.h
+5
-5
libasn1compiler/asn1c_constraint.c
libasn1compiler/asn1c_constraint.c
+20
-2
libasn1compiler/asn1c_misc.c
libasn1compiler/asn1c_misc.c
+15
-6
libasn1compiler/asn1compiler.h
libasn1compiler/asn1compiler.h
+2
-2
No files found.
ChangeLog
View file @
c78cbfbd
0.9.5: 2004-Sep-1
3
0.9.5: 2004-Sep-1
4
* Fixed CER (common BER) decoder code. See check-25.c/VisibleString
case for details. X.690 specifies that inner structures in BER
...
...
@@ -10,6 +10,8 @@
* Added converters between any generic type and the ANY type.
* Parser fixed: Information Object Class fields may be taged.
* Parser fixed: tagged types inside SEQUENCE OF/SET OF support.
* Real REAL support! (Haven't tested denormals support yet!)
See skeletons/tests/check-REAL.c
0.9.4: 2004-Sep-10
...
...
libasn1compiler/asn1c_C.c
View file @
c78cbfbd
...
...
@@ -78,45 +78,21 @@ static int emit_type_DEF(arg_t *arg, asn1p_expr_t *expr, enum tvm_compat tv_mode
#define MKID(id) asn1c_make_identifier(0, (id), 0)
int
asn1c_lang_C_type_ENUMERATED
(
arg_t
*
arg
)
{
asn1p_expr_t
*
expr
=
arg
->
expr
;
asn1p_expr_t
*
v
;
asn1c_lang_C_type_REAL
(
arg_t
*
arg
)
{
REDIR
(
OT_DEPS
);
OUT
(
"typedef enum %s {
\n
"
,
MKID
(
expr
->
Identifier
));
TQ_FOR
(
v
,
&
(
expr
->
members
),
next
)
{
switch
(
v
->
expr_type
)
{
case
A1TC_UNIVERVAL
:
OUT
(
"
\t
%s
\t
= %lld,
\n
"
,
asn1c_make_identifier
(
0
,
expr
->
Identifier
,
v
->
Identifier
,
0
),
v
->
value
->
value
.
v_integer
);
break
;
case
A1TC_EXTENSIBLE
:
OUT
(
"
\t
/*
\n
"
);
OUT
(
"
\t
* Enumeration is extensible
\n
"
);
OUT
(
"
\t
*/
\n
"
);
break
;
default:
return
-
1
;
}
}
OUT
(
"} %s_e;
\n
"
,
MKID
(
expr
->
Identifier
));
return
asn1c_lang_C_type_SIMPLE_TYPE
(
arg
);
}
int
asn1c_lang_C_type_INTEGER
(
arg_t
*
arg
)
{
asn1c_lang_C_type_
common_
INTEGER
(
arg_t
*
arg
)
{
asn1p_expr_t
*
expr
=
arg
->
expr
;
asn1p_expr_t
*
v
;
REDIR
(
OT_DEPS
);
if
(
TQ_FIRST
(
&
(
expr
->
members
)))
{
if
(
expr
->
expr_type
==
ASN_BASIC_ENUMERATED
||
TQ_FIRST
(
&
(
expr
->
members
))
)
{
OUT
(
"typedef enum %s {
\n
"
,
MKID
(
expr
->
Identifier
));
TQ_FOR
(
v
,
&
(
expr
->
members
),
next
)
{
switch
(
v
->
expr_type
)
{
...
...
@@ -127,6 +103,11 @@ asn1c_lang_C_type_INTEGER(arg_t *arg) {
v
->
Identifier
,
0
),
v
->
value
->
value
.
v_integer
);
break
;
case
A1TC_EXTENSIBLE
:
OUT
(
"
\t
/*
\n
"
);
OUT
(
"
\t
* Enumeration is extensible
\n
"
);
OUT
(
"
\t
*/
\n
"
);
break
;
default:
return
-
1
;
}
...
...
libasn1compiler/asn1c_C.h
View file @
c78cbfbd
...
...
@@ -11,8 +11,8 @@ int asn1c_lang_C_type_SET(arg_t *);
int
asn1c_lang_C_type_SEx_OF
(
arg_t
*
);
/* SET OF or SEQUENCE OF */
int
asn1c_lang_C_type_CHOICE
(
arg_t
*
);
int
asn1c_lang_C_type_INTEGER
(
arg_t
*
);
int
asn1c_lang_C_type_
ENUMERATED
(
arg_t
*
);
int
asn1c_lang_C_type_
common_
INTEGER
(
arg_t
*
);
int
asn1c_lang_C_type_
REAL
(
arg_t
*
);
int
asn1c_lang_C_type_SIMPLE_TYPE
(
arg_t
*
);
static
asn1_language_map_t
asn1_lang_C
[]
__attribute__
((
unused
))
=
{
...
...
@@ -38,9 +38,9 @@ static asn1_language_map_t asn1_lang_C[] __attribute__ ((unused)) = {
*/
{
AMT_TYPE
,
ASN_BASIC_BOOLEAN
,
asn1c_lang_C_type_SIMPLE_TYPE
},
{
AMT_TYPE
,
ASN_BASIC_NULL
,
asn1c_lang_C_type_SIMPLE_TYPE
},
{
AMT_TYPE
,
ASN_BASIC_INTEGER
,
asn1c_lang_C_type_INTEGER
},
/* [Skipped REAL] */
{
AMT_TYPE
,
ASN_BASIC_ENUMERATED
,
asn1c_lang_C_type_ENUMERATED
},
{
AMT_TYPE
,
ASN_BASIC_INTEGER
,
asn1c_lang_C_type_
common_
INTEGER
},
{
AMT_TYPE
,
ASN_BASIC_REAL
,
asn1c_lang_C_type_REAL
},
{
AMT_TYPE
,
ASN_BASIC_ENUMERATED
,
asn1c_lang_C_type_common_INTEGER
},
{
AMT_TYPE
,
ASN_BASIC_BIT_STRING
,
asn1c_lang_C_type_SIMPLE_TYPE
},
{
AMT_TYPE
,
ASN_BASIC_OCTET_STRING
,
asn1c_lang_C_type_SIMPLE_TYPE
},
{
AMT_TYPE
,
ASN_BASIC_OBJECT_IDENTIFIER
,
asn1c_lang_C_type_SIMPLE_TYPE
},
...
...
libasn1compiler/asn1c_constraint.c
View file @
c78cbfbd
...
...
@@ -65,7 +65,8 @@ asn1c_emit_constraint_checking_code(arg_t *arg) {
switch
(
etype
)
{
case
ASN_BASIC_INTEGER
:
case
ASN_BASIC_ENUMERATED
:
if
(
!
(
arg
->
flags
&
A1C_USE_NATIVE_INTEGERS
))
case
ASN_BASIC_REAL
:
if
(
!
(
arg
->
flags
&
A1C_USE_NATIVE_TYPES
))
produce_st
=
1
;
break
;
case
ASN_BASIC_BIT_STRING
:
...
...
@@ -91,6 +92,9 @@ asn1c_emit_constraint_checking_code(arg_t *arg) {
case
ASN_BASIC_ENUMERATED
:
OUT
(
"long value;
\n
"
);
break
;
case
ASN_BASIC_REAL
:
OUT
(
"double value;
\n
"
);
break
;
case
ASN_BASIC_BOOLEAN
:
OUT
(
"int value;
\n
"
);
break
;
...
...
@@ -549,7 +553,7 @@ emit_value_determination_code(arg_t *arg, asn1p_expr_type_e etype, asn1cnst_rang
switch
(
etype
)
{
case
ASN_BASIC_INTEGER
:
case
ASN_BASIC_ENUMERATED
:
if
(
arg
->
flags
&
A1C_USE_NATIVE_
INTEGER
S
)
{
if
(
arg
->
flags
&
A1C_USE_NATIVE_
TYPE
S
)
{
OUT
(
"value = *(const int *)sptr;
\n
"
);
}
else
{
if
(
r_value
->
el_count
==
0
...
...
@@ -579,6 +583,20 @@ emit_value_determination_code(arg_t *arg, asn1p_expr_type_e etype, asn1cnst_rang
OUT
(
"}
\n
"
);
}
break
;
case
ASN_BASIC_REAL
:
if
(
arg
->
flags
&
A1C_USE_NATIVE_TYPES
)
{
OUT
(
"value = *(const double *)sptr;
\n
"
);
}
else
{
OUT
(
"if(asn1_REAL2double(st, &value)) {
\n
"
);
INDENT
(
+
1
);
OUT
(
"_ASN_ERRLOG(app_errlog, app_key,
\n
"
);
OUT
(
"
\t\"
%%s: value too large (%%s:%%d)
\"
,
\n
"
);
OUT
(
"
\t
td->name, __FILE__, __LINE__);
\n
"
);
OUT
(
"return -1;
\n
"
);
INDENT
(
-
1
);
OUT
(
"}
\n
"
);
}
break
;
case
ASN_BASIC_BOOLEAN
:
OUT
(
"value = (*(const int *)sptr) ? 1 : 0;
\n
"
);
break
;
...
...
libasn1compiler/asn1c_misc.c
View file @
c78cbfbd
...
...
@@ -150,16 +150,25 @@ asn1c_type_name(arg_t *arg, asn1p_expr_t *expr, enum tnfmt _format) {
#endif
case
ASN_BASIC_INTEGER
:
case
ASN_BASIC_ENUMERATED
:
if
((
arg
->
flags
&
A1C_USE_NATIVE_INTEGERS
))
{
case
ASN_BASIC_REAL
:
if
((
arg
->
flags
&
A1C_USE_NATIVE_TYPES
))
{
switch
(
_format
)
{
case
TNF_CTYPE
:
case
TNF_RSAFE
:
return
"int"
;
default:
if
(
expr
->
expr_type
==
ASN_BASIC_INTEGER
)
return
"NativeInteger"
;
if
(
expr
->
expr_type
==
ASN_BASIC_REAL
)
return
"double"
;
else
return
"NativeEnumerated"
;
return
"int"
;
default:
break
;
}
switch
(
expr
->
expr_type
)
{
case
ASN_BASIC_INTEGER
:
return
"NativeInteger"
;
case
ASN_BASIC_ENUMERATED
:
return
"NativeEnumerated"
;
case
ASN_BASIC_REAL
:
return
"NativeReal"
;
default:
break
;
}
}
/* Fall through */
...
...
libasn1compiler/asn1compiler.h
View file @
c78cbfbd
...
...
@@ -20,9 +20,9 @@ enum asn1c_flags {
*/
A1C_OMIT_SUPPORT_CODE
=
0x0004
,
/*
* Use native
integers instead of INTEGER_t and ENUMERATED_t types
.
* Use native
data types instead of INTEGER_t et al
.
*/
A1C_USE_NATIVE_
INTEGER
S
=
0x0008
,
A1C_USE_NATIVE_
TYPE
S
=
0x0008
,
/*
* Do not use C99 extensions.
*/
...
...
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