Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Anett Jakab
titan.EclipsePlug-ins
Commits
914acfc8
Commit
914acfc8
authored
Dec 16, 2021
by
Miklos Magyari
Browse files
Merge branch 'anettjakab/titan.EclipsePlug-ins-master'
parents
78766c89
71a73694
Changes
2
Hide whitespace changes
Inline
Side-by-side
org.eclipse.titan.runtime/src/org/eclipse/titan/runtime/core/Base_Type.java
View file @
914acfc8
...
@@ -9,6 +9,8 @@ package org.eclipse.titan.runtime.core;
...
@@ -9,6 +9,8 @@ package org.eclipse.titan.runtime.core;
import
java.math.BigInteger
;
import
java.math.BigInteger
;
import
java.text.MessageFormat
;
import
java.text.MessageFormat
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.eclipse.titan.runtime.core.BER.ASN_BER_TLV
;
import
org.eclipse.titan.runtime.core.BER.ASN_BER_TLV
;
import
org.eclipse.titan.runtime.core.BER.ASN_BERdescriptor
;
import
org.eclipse.titan.runtime.core.BER.ASN_BERdescriptor
;
...
@@ -25,7 +27,6 @@ import org.eclipse.titan.runtime.core.TTCN_EncDec.error_type;
...
@@ -25,7 +27,6 @@ import org.eclipse.titan.runtime.core.TTCN_EncDec.error_type;
import
org.eclipse.titan.runtime.core.TTCN_EncDec.raw_order_t
;
import
org.eclipse.titan.runtime.core.TTCN_EncDec.raw_order_t
;
import
org.eclipse.titan.runtime.core.TTCN_Logger.Severity
;
import
org.eclipse.titan.runtime.core.TTCN_Logger.Severity
;
import
javafx.util.Pair
;
/**
/**
* The base class of all types.
* The base class of all types.
...
@@ -693,16 +694,19 @@ public abstract class Base_Type {
...
@@ -693,16 +694,19 @@ public abstract class Base_Type {
}
}
public
Pair
<
Boolean
,
TitanInteger
>
BER_decode_TLV_Integer
(
ASN_BER_TLV
p_tlv
,
int
p_unsigned
,
TitanInteger
p_int_val
)
{
public
Map
<
Boolean
,
TitanInteger
>
BER_decode_TLV_Integer
(
ASN_BER_TLV
p_tlv
,
int
p_unsigned
,
TitanInteger
p_int_val
)
{
p_tlv
.
chk_constructedFlag
(
false
);
p_tlv
.
chk_constructedFlag
(
false
);
Map
<
Boolean
,
TitanInteger
>
result
=
new
HashMap
<
Boolean
,
TitanInteger
>();
if
(!
p_tlv
.
isComplete
)
{
if
(!
p_tlv
.
isComplete
)
{
return
new
Pair
<
Boolean
,
TitanInteger
>
(
false
,
p_int_val
);
result
.
put
(
false
,
p_int_val
);
return
result
;
}
}
if
(
p_tlv
.
Vlen
==
0
)
{
if
(
p_tlv
.
Vlen
==
0
)
{
TTCN_EncDec_ErrorContext
.
error
(
error_type
.
ET_INVAL_MSG
,
"Length of V-part is 0."
);
TTCN_EncDec_ErrorContext
.
error
(
error_type
.
ET_INVAL_MSG
,
"Length of V-part is 0."
);
return
new
Pair
<
Boolean
,
TitanInteger
>
(
false
,
p_int_val
);
result
.
put
(
false
,
p_int_val
);
return
result
;
}
}
int
Vlen
=
p_tlv
.
Vlen
;
int
Vlen
=
p_tlv
.
Vlen
;
...
@@ -711,8 +715,8 @@ public abstract class Base_Type {
...
@@ -711,8 +715,8 @@ public abstract class Base_Type {
if
(
Vlen
>=
Integer
.
BYTES
)
{
if
(
Vlen
>=
Integer
.
BYTES
)
{
BigInteger
D
=
new
BigInteger
(
p_tlv
.
Vstr
);
BigInteger
D
=
new
BigInteger
(
p_tlv
.
Vstr
);
result
.
put
(
true
,
new
TitanInteger
(
D
));
return
new
Pair
<
Boolean
,
TitanInteger
>
(
true
,
new
TitanInteger
(
D
))
;
return
result
;
}
}
...
@@ -737,7 +741,9 @@ public abstract class Base_Type {
...
@@ -737,7 +741,9 @@ public abstract class Base_Type {
p_int_val
=
new
TitanInteger
(
intVal
);
p_int_val
=
new
TitanInteger
(
intVal
);
return
new
Pair
<
Boolean
,
TitanInteger
>
(
true
,
p_int_val
);
result
.
put
(
true
,
p_int_val
);
return
result
;
}
}
public
ASN_BER_TLV
BER_encode_chk_bound
(
boolean
p_isbound
)
{
public
ASN_BER_TLV
BER_encode_chk_bound
(
boolean
p_isbound
)
{
...
...
org.eclipse.titan.runtime/src/org/eclipse/titan/runtime/core/TitanInteger.java
View file @
914acfc8
...
@@ -9,6 +9,7 @@ package org.eclipse.titan.runtime.core;
...
@@ -9,6 +9,7 @@ package org.eclipse.titan.runtime.core;
import
java.math.BigInteger
;
import
java.math.BigInteger
;
import
java.text.MessageFormat
;
import
java.text.MessageFormat
;
import
java.util.Map
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicReference
;
import
java.util.concurrent.atomic.AtomicReference
;
...
@@ -37,8 +38,6 @@ import org.eclipse.titan.runtime.core.TTCN_EncDec.error_type;
...
@@ -37,8 +38,6 @@ import org.eclipse.titan.runtime.core.TTCN_EncDec.error_type;
import
org.eclipse.titan.runtime.core.TTCN_EncDec.raw_order_t
;
import
org.eclipse.titan.runtime.core.TTCN_EncDec.raw_order_t
;
import
org.eclipse.titan.runtime.core.TitanCharString.CharCoding
;
import
org.eclipse.titan.runtime.core.TitanCharString.CharCoding
;
import
javafx.util.Pair
;
/**
/**
* TTCN-3 integer
* TTCN-3 integer
...
@@ -1346,7 +1345,6 @@ public class TitanInteger extends Base_Type {
...
@@ -1346,7 +1345,6 @@ public class TitanInteger extends Base_Type {
TTCN_EncDec_ErrorContext
.
error_internal
(
"No BER descriptor available for type '%s'."
,
p_td
.
name
);
TTCN_EncDec_ErrorContext
.
error_internal
(
"No BER descriptor available for type '%s'."
,
p_td
.
name
);
}
}
//int L_form = flavour;
ASN_BER_TLV
tlv
=
new
ASN_BER_TLV
();
ASN_BER_TLV
tlv
=
new
ASN_BER_TLV
();
BER_decode_str2TLV
(
p_buf
,
tlv
,
flavour
);
BER_decode_str2TLV
(
p_buf
,
tlv
,
flavour
);
...
@@ -2354,7 +2352,7 @@ public class TitanInteger extends Base_Type {
...
@@ -2354,7 +2352,7 @@ public class TitanInteger extends Base_Type {
else
return
null
;
else
return
null
;
}
}
public
ASN_BER_TLV
BER_encode_TLV
(
final
TTCN_Typedescriptor
p_td
,
int
coding
)
{
public
ASN_BER_TLV
BER_encode_TLV
(
final
TTCN_Typedescriptor
p_td
,
int
coding
)
{
ASN_BER_TLV
newTlv
=
BER_encode_chk_bound
(
is_bound
());
ASN_BER_TLV
newTlv
=
BER_encode_chk_bound
(
is_bound
());
...
@@ -2371,37 +2369,40 @@ public class TitanInteger extends Base_Type {
...
@@ -2371,37 +2369,40 @@ public class TitanInteger extends Base_Type {
return
newTlv
;
return
newTlv
;
}
}
public
boolean
BER_decode_TLV
(
TTCN_Typedescriptor
p_td
,
ASN_BER_TLV
p_tlv
,
int
L_form
)
{
public
boolean
BER_decode_TLV
(
TTCN_Typedescriptor
p_td
,
ASN_BER_TLV
p_tlv
,
int
L_form
)
{
boundFlag
=
false
;
boundFlag
=
false
;
ASN_BER_TLV
strippedTlv
=
new
ASN_BER_TLV
();
ASN_BER_TLV
strippedTlv
=
new
ASN_BER_TLV
();
strippedTlv
=
BER_decode_strip_tags
(
p_td
.
ber
,
p_tlv
,
L_form
,
strippedTlv
);
strippedTlv
=
BER_decode_strip_tags
(
p_td
.
ber
,
p_tlv
,
L_form
,
strippedTlv
);
TitanInteger
tmp
=
new
TitanInteger
();
TitanInteger
tmp
=
new
TitanInteger
();
Pair
<
Boolean
,
TitanInteger
>
p
=
BER_decode_TLV_Integer
(
strippedTlv
,
L_form
,
tmp
);
Map
<
Boolean
,
TitanInteger
>
p
=
BER_decode_TLV_Integer
(
strippedTlv
,
L_form
,
tmp
);
boolean
returnVal
=
p
.
getKey
();
tmp
=
p
.
getValue
();
if
(
tmp
.
is_native
())
{
for
(
Map
.
Entry
<
Boolean
,
TitanInteger
>
me:
p
.
entrySet
())
{
nativeFlag
=
true
;
boolean
returnVal
=
me
.
getKey
();
if
(
strippedTlv
.
getVstr
()[
0
]
>=
0
&&
tmp
.
nativeInt
<
0
)
{
tmp
=
me
.
getValue
();
nativeInt
=
-
tmp
.
nativeInt
;
if
(
tmp
.
is_native
())
{
nativeFlag
=
true
;
if
(
strippedTlv
.
getVstr
()[
0
]
>=
0
&&
tmp
.
nativeInt
<
0
)
{
nativeInt
=
-
tmp
.
nativeInt
;
}
else
{
nativeInt
=
tmp
.
nativeInt
;
}
}
else
{
}
else
{
nativeInt
=
tmp
.
nativeInt
;
nativeFlag
=
false
;
if
(
strippedTlv
.
getVstr
()[
0
]
<
0
&&
tmp
.
openSSL
.
compareTo
(
BigInteger
.
ZERO
)
<
0
)
{
openSSL
=
tmp
.
openSSL
.
negate
();
}
openSSL
=
tmp
.
openSSL
;
}
}
}
else
{
nativeFlag
=
false
;
if
(
returnVal
)
{
if
(
strippedTlv
.
getVstr
()[
0
]
<
0
&&
tmp
.
openSSL
.
compareTo
(
BigInteger
.
ZERO
)
<
0
)
{
boundFlag
=
true
;
openSSL
=
tmp
.
openSSL
.
negate
();
}
}
openSSL
=
tmp
.
openSSL
;
return
returnVal
;
}
}
return
false
;
if
(
returnVal
)
{
boundFlag
=
true
;
}
return
returnVal
;
}
}
}
}
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