Age | Commit message (Collapse) | Author |
|
For now, do the packaging before call asn1ct_gen:pgen().
|
|
|
|
Note that put(currmod, Mod) is not needed because it has already
been done by the caller.
|
|
|
|
|
|
|
|
When the 'maps' option is given, the SEQUENCE and SET types are
represented as maps instead of as records. Optional and default values
must be not be given as asn1_NOVALUE or asn1_DEFAULT in a map passed
to the M:encode/2 function; they must be omitted from the
map. Similarly, when decoding missing values will be omitted from the
map.
No .hrl files will be generated when the 'maps' options is used.
That means values in an ASN.1 module must be retrieved by calling the
appropriate function in generated module.
Since we one day hope to get rid of the options 'compact_bit_string',
'legacy_bit_string', and 'legacy_erlang_types', we will not allow them
to be combined with the 'maps' option.
|
|
|
|
As a preparation for supporting maps in a future commit, refactor
the functions for encoding optional values.
|
|
|
|
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.
|
|
|
|
asn1ct_check numbers all components in SEQUENCEs and SETs, except
for the associated sequence for INSTANCE OF. Remove this exception
so that the code generation pass can depend on SEQUENCEs being
numbered.
|
|
Introduce helper functions to simplify and reduce the size of
gen_encode_constructed_imm/3.
|
|
The to_encoding_order/1 function can be eliminated if we
incorporate its functionality into textual_order/2.
textual_order/2 has a workaround for TermList being longer
than OrderList. Remove the workaround, because the code
being generated would certainly be wrong (better let the compiler
crash and receive a bug report if it happens). The workaround
was not necessary to successfully compile the entire Erlang/OTP
and to run the asn1 test suite.
|
|
As a preparation for future changes, simplify
gen_dec_constructed_imm_2/6 by breaking it apart to two
functions.
|
|
Remove the entire asn1rt module. All functions in it were deprecated in
OTP 17.
In asn1ct, remove the deprecated functions asn1ct:encode/3 and
asn1ct:decode/3. Also remove asn1ct:encode/2, which has not been
formally deprecated but is undocumented.
|
|
When attempting to build multiple ASN.1 modules in parallel (e.g. by
running 'make -j'), the ASN.1 compiler could crash because the names
of the .asn1db files clashed. For example, if A.asn1 and B.asn1 both
import from C.asn1, the compiler would write a C.asn1db file when
compiling A.asn1 and when compiling B.asn1.
We can avoid this problem if the compiler only writes the
module's own .asn1db file. That is, when compiling A.asn1,
the compiler would only write A.asn1db, not C.asn1db. Also,
make sure that we make the write atomic by first writing to
a temporary file that is then renamed.
|
|
Dialyzer complains that three calls to gen_dec_line/7 ignore
the return value. It turns out that when the last argument to
gen_dec_line/7 is 'false', the return value will always be
{[],[]}. Introduce gen_dec_line/6 as helper to make it clear
that we don't ignore a useful return value.
|
|
|
|
* maint:
Fix a few dialyzer warnings
|
|
|
|
* maint:
asn1: Suppress warnings for improper lists in generated code
|
|
|
|
* maint:
PER: Correct compilation of named INTEGERs
|
|
When a constrained INTEGER has more than 16536 values and named
values, the compiler would crash when compiling to the PER
format. Example:
Longitude ::= INTEGER {
oneMicrodegreeEast(10),
oneMicrodegreeWest(-10),
unavailable(1800000001)
} (-1799999999..1800000001)
Reported-by: Ingars
|
|
In most cases, we don't have to seed the random number generator,
as the rand:uniform/1 takes care about that itself.
|
|
Encoding an empty named BIT STRING would fail for BER.
Noticed-by: Svilen Ivanov
|
|
|
|
|
|
* rickard/time_api/OTP-11997: (22 commits)
Update primary bootstrap
inets: Suppress deprecated warning on erlang:now/0
inets: Cleanup of multiple copies of functions Add inets_lib with common functions used by multiple modules
inets: Update comments
Suppress deprecated warning on erlang:now/0
Use new time API and be back-compatible in inets Remove unused functions and removed redundant test
asn1 test SUITE: Eliminate use of now/0
Disable deprecated warning on erlang:now/0 in diameter_lib
Use new time API and be back-compatible in ssh
Replace all calls to now/0 in CT with new time API functions
test_server: Replace usage of erlang:now() with usage of new API
Replace usage of erlang:now() with usage of new API
Replace usage of erlang:now() with usage of new API
Replace usage of erlang:now() with usage of new API
Replace usage of erlang:now() with usage of new API
otp_SUITE: Warn for calls to erlang:now/0
Replace usage of erlang:now() with usage of new API
Multiple timer wheels
Erlang based BIF timer implementation for scalability
Implement ethread events with timeout
...
Conflicts:
bootstrap/bin/start.boot
bootstrap/bin/start_clean.boot
bootstrap/lib/compiler/ebin/beam_asm.beam
bootstrap/lib/compiler/ebin/compile.beam
bootstrap/lib/kernel/ebin/auth.beam
bootstrap/lib/kernel/ebin/dist_util.beam
bootstrap/lib/kernel/ebin/global.beam
bootstrap/lib/kernel/ebin/hipe_unified_loader.beam
bootstrap/lib/kernel/ebin/inet_db.beam
bootstrap/lib/kernel/ebin/inet_dns.beam
bootstrap/lib/kernel/ebin/inet_res.beam
bootstrap/lib/kernel/ebin/os.beam
bootstrap/lib/kernel/ebin/pg2.beam
bootstrap/lib/stdlib/ebin/dets.beam
bootstrap/lib/stdlib/ebin/dets_utils.beam
bootstrap/lib/stdlib/ebin/erl_tar.beam
bootstrap/lib/stdlib/ebin/escript.beam
bootstrap/lib/stdlib/ebin/file_sorter.beam
bootstrap/lib/stdlib/ebin/otp_internal.beam
bootstrap/lib/stdlib/ebin/qlc.beam
bootstrap/lib/stdlib/ebin/random.beam
bootstrap/lib/stdlib/ebin/supervisor.beam
bootstrap/lib/stdlib/ebin/timer.beam
erts/aclocal.m4
erts/emulator/beam/bif.c
erts/emulator/beam/erl_bif_info.c
erts/emulator/beam/erl_db_hash.c
erts/emulator/beam/erl_init.c
erts/emulator/beam/erl_process.h
erts/emulator/beam/erl_thr_progress.c
erts/emulator/beam/utils.c
erts/emulator/sys/unix/sys.c
erts/preloaded/ebin/erlang.beam
erts/preloaded/ebin/erts_internal.beam
erts/preloaded/ebin/init.beam
erts/preloaded/src/erts_internal.erl
lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl
lib/diameter/src/base/diameter_lib.erl
lib/kernel/src/os.erl
lib/ssh/test/ssh_basic_SUITE.erl
system/doc/efficiency_guide/advanced.xml
|
|
|
|
The BEAM compiler now warns more aggressively for expressions whose
values are not used. For example, the generated Erlang code for
the following ASN.1 code will now cause a warning:
Seq ::= SEQUENCE {
...,
os OCTET STRING (SIZE (17000..30000))
}
The generated Erlang code looks similar to the following:
Enc9@bin = iolist_to_binary(Enc9@output),
Enc9@len = byte_size(Enc9@bin),
[align|encode_fragmented(Enc9@bin, 8)]
The variable Enc9@len is not used and the BEAM compiler will
complain that the value returned from the byte_size/1 call is
not used.
Improve the optimization of the intermediate code to eliminate
the assignment to the unused variable.
|
|
* maint:
asn1ct_gen: Correct generation of .hrl files for multiple ellipses
Fix BER code generation
|
|
|
|
PKIX1Explicit-2009 did not compile.
This commit was cherry-picked from 3ab3b07a already
merged into master.
|
|
* oliv3/math_log2/OTP-12411:
Add math:log2/1
|
|
|
|
|
|
|
|
As currently implemented, there is one call to asn1db:dbget() and
asn1db:dbput() for each type/value definitions in an ASN.1 specification.
If we check for duplicate definitions locally, we can send all
definitions in a single call.
|
|
Three fields ('type','value', and 'vname') are almost unused. They
are set, but almost never read. Eliminate the last remaining uses
and the fields themselves.
|
|
|
|
And while we are at it cleanup and rewrite code to use try catch.
|
|
|
|
|
|
|
|
In the parsing of a value assignment, such as:
value INTEGER ::= 42
there is call to a function called lookahead_assignment/1 that
will ensure that the sequence of tokens that follows the value
is a valid assignment. The problem is that if the next assignment
is a value assignment, that too will look ahead to the next
assignment. That means that the complexity will be quadratic
if there are many value assignments following each other.
The reason for the test in the first place is unclear; my guess
is that it was an attempt to provide better error reporting.
|
|
Errors were reported using a throw like this:
throw({asn1_error,{get_line(hd(Tokens)),get(asn1_module),
[got,get_token(hd(Tokens)),expected,typereference]}}).
The attempt to tell the user what was expected was often mis-leading.
It is time-consuming and non-trival to provide correct information
of what is expected. Therefore, we will not even try. Instead we will
spend more effort to report the token where the error was discovered.
We will replace each throw with a function call:
parse_error(Tokens).
Also add the syntax_SUITE test suite to test error reporting and to
cover all error reporting code. Remove the old c_syntax/1 test case.
Also remove all out-commented code.
|
|
Responsibilities for parse error handling were split between
asn1ct and asn1ct_parser2 in a confusing way. Let asn1ct_parser2
return structured_error tuples in the same way as the check
pass.
|