Age | Commit message (Collapse) | Author |
|
|
|
introduced by 8e4a9864385242b962ce7446f7daa4f58cfecca5.
|
|
|
|
Just crash if there is an internal error.
|
|
* Remove out-commented code
* Fix obvious typos and bad grammar
* Adhere to the conventions for when to use "%" and "%%".
|
|
Stop up using asn1ct_gen:emit/1 with a tuple instead of a list.
Also remove the remaining uses of asn1ct_gen:demit/1.
|
|
The debug option no longer serves any useful purpose.
|
|
That will make code slightly easier to read.
|
|
ce431409d0daba broke generation of dialyzer suppressions
for per and uper.
While we are it, add type tests to asn1ct_func:is_used/1
to avoid similar problems in the future.
|
|
Most options to the code generation pass are passed through the
process dictionary. At the same time, an Erule or Erules argument
is passed to most code generation functions. The Erule argument
is only an atom indicating the encoding rules ('ber', 'per', or
'uper').
Introduce a new record #gen{} to contain code generation options
and parameters. Pass it as the Erule argument (renaming it to Gen
in functions that we will have to touch anyway). In this commit,
eliminate the use of the variable 'encoding_options' in the process
dictionary.
|
|
|
|
|
|
|
|
We don't want to touch the code used for encoding BIT STRINGs when
'legacy_erl_types' is active, since it will be removed within two
or three major releases. But we do want to suppress the dialyzer
warnings in the meantime. The easiest way is to call
encode_bit_string/4 with unknown types from an exported function
that is never actually called like this:
-export(['dialyzer-suppressions'/0]).
'dialyzer-suppressions'(Arg) ->
{A,B,C,D} = Arg,
encode_bit_string(A, B, C, D),
ok.
|
|
|
|
|
|
Instead of generating:
{assign,Dst,"element(2, Val)"}
generate:
{call,erlang,element,[2,{var,"Val"}],Dst}
The latter expression is easier to understand since there is no
need to parse a string which may contain an arbitrary expression.
While at it, also discontinue the practice to treat "naked"
atoms as variables. A variable must always be given as {var,String}.
|
|
To facilitate inlining of apply calls in the intermediate format.
|
|
The generated code for table constraints has several problems:
* For each object set, a function for getting an encoding or decoding
fun is generated, regardless of whether it is actually used. In many
specifications, the object set actually used is the union of several
other object sets. That means that the code can become a lot bulkier
than it would need to be.
* The funs are not necessary. The funs just add to the code bloat
and generate more unnecessary garbage at run-time. Also, one of
the arguments of the fun is the name of the field in the class which
is known at compile-time, and the fun for decoding has unused arguments.
How to fix the problems:
At each call site where an open type should be encoded/decoded, call a
specific generated function specialized for the actual object set and
the name of the field in the class. When generating the specialized
functions, make sure that we re-use a previously generated function if
possible.
|
|
There are some minor incompatibilities for BIT STRING:
{bit,Position} is now only only supported for a named
BIT STRING type.
Values longer than the maximum size for the BIT STRING type
would be truncated silently - they now cause an exception.
|
|
|
|
|
|
Also extend the test suite with more tests of inlined constructs
in object sets.
|
|
According to the ASN.1 standard, having multiple UNIQUE in class
is allowed. For example:
C ::= CLASS {
&id1 INTEGER UNIQUE,
&id2 INTEGER UNIQUE
}
In practice, no one uses multiple UNIQUE.
The ASN.1 compiler will crash if a class with multiple UNIQUE
is used, but the backends have half-hearted support for multiple
UNIQUE in that they generate helper functions similar to:
getenc_OBJECT_SET(id1, 42) ->
fun enc_XXX/3;
...
Since we have no plans to implement support for multiple UNIQUE
(no one seems to have missed it), simplify the helper functions
like this:
getenc_OBJECT_SET(42) ->
fun enc_XXX/3;
...
|
|
To facilitate optimizing PER encoding using an intermediate
format, we must change asn1rtt_real_common:encode_real/1 so that
it only returns the encoded binary.
|
|
|
|
Simplify the backends by letting asn1ct_check replacing a
with the actual type.
|
|
Since fbcb7fe589edbfe79d10d7fe01be8a9f77926b89, the 'enumval'
variable is no longer used.
|
|
asn1ct_constructed_per:gen_encode_prim_wrapper() no longer serves
any useful purpose, as it is easier to call
asn1ct_per:gen_encode_prim() directly. Also, the DoTag argument
for asn1ct_per:gen_encode_prim() is never actually used, so it can
be eliminated at the same time.
|
|
asn1ct_check does not pass #pobjectdef{} records on to the backends
(all the original #pobjectdef{} records have been instantiated and
changed to #objectdef{} records).
|
|
The last clause in asn1ct_gen:type/1 does a catched call to type2/1.
If the type2/1 fails {notype,X} is returned.
Since the body of type2/1 essentially is:
case lists:member(X, [...]) of
true ->
{primitive,bif};
false ->
case lists:member(X, [...]) of
true ->
{constructed,bif};
false ->
{undefined,user}
end
end
there is no way that type2/1 can fail. Therefore, we can eliminate
the catch and put the body of type2/1 into the last clause of
type/1. We can also eliminate the code in the callers of type/1
that match {notype,X}.
|
|
Almost always, encode_open_type/1 is called with the return value
from complete/1, which always is a binary. In the rare situation
that encode_open_type/1 is called directly with data from the
user application, call iolist_to_binary/1 before calling
encode_open_type/1.
|
|
Hiding the details of decoding an external type will facilitate
changing the calling convention in a future commit.
|
|
asn1ct_check has translated all occurrences of 'ANY' to 'ASN1_OPEN_TYPE'.
|
|
|
|
The record #typereference{} is only used internally within
the asn1ct_parser2 module (the parser translates it to
an #'Externaltypereference{} record).
|
|
The only code that is really different between the PER
and UPER backends is encoding of primitive types.
|
|
|
|
|
|
The wrong backend was used.
|
|
|
|
active/1 always returned 'true' (curr(Var) can never return 'nil',
except if Var =:= 'nil'). Therefore, we can eliminate its use and
remove it.
|
|
Commit f16f43446a04c459486356c0b4ad517cc9201895 broke compilation
of InformationFramework for per and uper.
|
|
|
|
Support in BER was removed in 3d1279f3cebfdd2483c3afea9f225613fe45cd00.
|
|
|
|
|
|
|
|
Add the option 'legacy_bit_string' to decode to the old list format.
|
|
|