Age | Commit message (Collapse) | Author |
|
|
|
Dialyzer will warn for default clauses that cannot possible match.
|
|
|
|
In the BER run-time code (asn1rtt_ber), there is a general function
for decoding a string:
decode_restricted_string(Tlv, Range, StringType, TagsIn)
But the StringType argument is not important. It is only used
internally in asn1rtt_ber to distinguish universal strings and BMP
strings from other strings. By slightly refactoring the string
decoding code, we can eliminate the StringType argument and a
subsequent run-time test on the string type. That will slightly reduce
code size, slightly increase speed, and eliminate Dialyzer warnings.
|
|
Refactor decoding of BIT STRINGs so that the run-time code does
not spend testing conditions that are known already at compile-time
(which wastes time and produces unnecessary Dialyzer warnings).
There are three ways to decode BIT STRINGs:
1) To a list of bit names (and {bit,Position} for unnamed positions)
if the BIT STRING type has any bit names.
2a) To a list of ones and zeros if there are no named bits, and the
compact_bit_string option was NOT given.
2b) To a {Unused,Bin} tuple if there are no named bits compact_bit_string
option WAS given.
Structure the decoding functions in the same way.
|
|
Always pre-encode the values for the enumeration. Clean up the
code and let the per and uper back-ends share the code.
|
|
|
|
Also make sure that the error handling is contained within the
asn1rt_nif module and does not leak out to generated code.
|
|
|
|
|
|
|
|
|
|
The template modules (asn1rtt_*.erl) are based on the existing
run-time modules, but with some simplifications and improvements,
for example:
The run-time functions for BER encoding took a Constraint argument which
was not used. It has been eliminated, along with the unused StringType
argument for the encode_restricted_string function.
The Range argument for decode_enumerated() has been dropped since it
was not used.
|
|
|
|
|
|
* nox/enable-silent-rules/OTP-10726:
Implement ./otp_build configure --enable-silent-rules
|
|
With silent rules, the output of make is less verbose and compilation
warnings are easier to spot. Silent rules are disabled by default and
can be disabled or enabled at will by make V=0 and make V=1.
|
|
* bjorn/asn1/extension-addition-groups/OTP-10664:
Fix a bug for multiple extension addition groups
|
|
Encoding would fail.
|
|
|
|
It seems that the code was duplicated only to avoid emitting
a semi-colon before the first case clause. Handle that by passing
a Sep argument instead.
While at it, also do the following clean-ups:
* Replace lists:keysearch/3 with lists:keyfind/3.
* Replace the use of is_record/2 with matching
|
|
Do the following optimizations:
* Optimize construction of OCTET STRINGs of size 2 by using
the 45 opcode instead of the 10 opcode for each character.
* Use exact comparison (implicit by matching) instead of '=='.
* Use list literals when more than one integer is added to a
list (e.g. [[45,16,2],...] instead of [45,16,2,...]). Results
in fewer BEAM instructions and less garbage.
* Cons instead of building a nested list when possible. Example:
[20,TempLen|TmpVal] instead of [20,TempLen,TmpVal].
* Omit the "2" opcode (align to byte boundary) before the "20" and
"21" opcodes (because they imply alignment).
* Assign the value to be encoded to a temporary variable, to avoid
calling element/2 more than once.
|
|
|
|
Support for the notation was removed in 6ef8cbdaaaa1c30a7dc462063.
|
|
UNION and "|" are synonyms, as are INTERSECTION and "^". Use the same
parsing code for the synonyms.
|
|
The constraint simplification pass need to be seriously rethought
and rewritten.
As a starting point, add a test case to test that equivalent ways
to write a constraint are reduced to the same simplified constraint.
Fix a few obvious bugs to make the test cases to pass.
|
|
|
|
Extensions following a double bracket group were not skipped correctly.
Fix this bug and add tests to ensure that extensions are skipped
correctly.
|
|
Commit 1b622484ea984f3bc424d2a6760e2d961bfcf816 changed the type of
the extension bitmap for uper (from a tuple to a bitstring), but did
not do the the corresponding change to the run-time module.
|
|
|
|
|
|
|
|
In order to optimize the generated code, we will need data structures
that can be traversed in several passes before the actual code is
generated.
Refactor the code so that if first builds (essentially) a list of
funs that do the actual code generation, and a second function
that will call the funs one at the time.
|
|
|
|
Decoding of fragmented OCTET STRINGs was only implemented when the size
was constrained to a single value. While at it, support decoding
fragmented OCTET STRINGS in all circumstances.
|
|
Decoding of a fragmented OCTET STRING with the size constrained to a
single value is implemented, but encoding is not implemented, and
decoding is not tested in any test case.
There is no urgent need to support encoding of fragmented OCTET STRINGs,
but not being able to encode such values complicates testing of decoding.
For example, eif we add the following type to PrimStrings.asn1 in the test
suite:
FixedOs65536 ::= OCTET STRING (SIZE (65536))
then asn1ct:test('PrimStrings') will fail because this value cannot
be encoded.
|
|
A long term goal is to eleminate the asn1ct_gen_per_rt2ct module
in favor of the asn1ct_gen_per module, so will have
asn1ct_gen_per_rt2ct call asn1ct_gen_per.
|
|
It is error-prone to have several copies of the same function.
|
|
|
|
|
|
|
|
|
|
Don't waste time calling a trivial function in the run-time library
for encoding and decoding of NULL values.
|
|
Currently, the generated code suppresses warnings for unusued variables
by assigning to the "_Val" variable, for example:
_Val = Tmpval5
To be completely safe, that should have been:
_ = Tmpval5
in case there happens to more than one such assignment in the same
scope.
However, a better way to suppress warnings is to simply use the
'nowarn_unused_vars' compiler option. That method will also work
for more complicated expressions there it would be cumbersome to
suppress warnings by assignment to "_".
|
|
While at it, also make the generated code for the attributes
more readable.
|
|
The NIF library is now mandatory.
The call to application:get_env/2 to find out whether the NIF
library is loaded is surprisingly expensive.
|
|
|
|
|
|
|
|
|