Age | Commit message (Collapse) | Author |
|
|
|
|
|
By replacing literal diameter_gen_relay atoms in forms extracted from
that module by the name of the module in question. This has been wrong
for some time, but only became noticable when the parent commit started
using ?MODULE as more than a process dictionary key or tag to match on.
In particular, the function dict/1 in diameter_gen.hrl (included by
every dictionary module) can now return ?MODULE, which is (not
surprisingly) expected to be the name of the dictionary module in
question. It wasn't in the case of a module compiled from forms: it was
diameter_gen_relay, since that's the module the forms were extracted
from.
The fix only affects dictionaries compiled from forms, as returned by
diameter_make:codec/2. In particular, dictionaries compiled from Erlang
source returned by this function, or by diameterc(1), are unaffected.
|
|
Instead of detecting the error, code generation failed when attempting
to lookup the type of an undefined AVP.
|
|
* anders/diameter/unicode_path/OTP-11655:
Fix unicode path failure in diameter_make:codec/2
|
|
This is an encoding that didn't exist at the time of the previous
commit, but which was added in commit 83b6daef. Use it to restrict
stringification to lists containing printable ascii.
|
|
The problem is that the change in default encoding to utf8 in 17.0, in
commit 00e42967, changes the behaviour of erl_parse:abstract/1, which is
used by the dictionary compiler to turn terms into abstract code. In
particular, it transforms the orddict representation of a parsed
dictionary to contruct the return value of a dictionary module's dict/0
function. This orddict contains various lists, one of which is a list of
tuples of the form
{Name, Code, [VendorId], [Avp]}
where Name is an ASCII string and VendorId is a non-negative integer.
Using erl_parse:abstract/2 instead allows a string encoding to be
specified but regardless of what encoding is used, the result of
transforming our tuple might not be what we really want, which is for
Name to always be represented as a string form and [VendorId] to always
be represented as a cons form: the [VendorId] will always end up as a
string form if the integers are small enough. The only way around this
is to transform the tuple bit by bit, but modifying the code to do this
is quite a lot of work, for not much gain: it would be nice to produce
more readable output but nothing stops working without it.
This commit restores the pre-17.0 conversion by explicilty specifying
latin1 as the string encoding to erl_parse:abstract/2. The utf8 encoding
broke the compilation of some dictionares since unicode strings aren't
expected when writing the generated code to file.
Note that the latin1 encoding does reasonably well in practice, although
it mangles the Ericsson Vendor Id list [193] into a "LATIN CAPITAL
LETTER A WITH ACUTE". The utf8 encoding does worse, mangling the 3GPP
Vendor Id 10415 into "DESERET CAPITAL LETTER CHEE". An ascii encoding
would do better than latin1 but doesn't yet exist. (Encoding isn't
really what the option is. It's a string predicate: if the predicate is
true then represent as a string form, otherwise a cons form.)
|
|
A dictionary path containing a unicode codepoint > 255 caused the
function to fail when iolist_to_binary/1 was applied to the path.
|
|
The case in which an AVP was defined as having type Grouped in
@avp_types without a corresponding specification in @grouped was
missing.
|
|
Instead, add diameter_make:format_error/1 to allow the caller to format
if desired, which is what applications like compiler and yecc do. Use
this to check that the expected error is the one actually generated in
the compiler suite.
|
|
That is, preprocessed forms that can be passed to compile:forms/1,2.
|
|
To set @avp_vendor_id, @codecs and @custom_types as required for
imported avps.
|
|
The intention was that the type would represent an improper list whose
head was an integer and whose tail was an orddict but that doesn't seem
to be dialyzer's interpretation anyway.
|
|
In particular, make codec/2 flexible as to what's generated, the formats
(erl, hrl, parse, forms and beam) being passed in the options list and
defaulting to [erl, hrl]. The 'parse' format is the internal format to
which dictionaries are parsed, which can be manipulated by flatten/1
before being passed back to codec/2 or format/1.
Remove the (undocumented) dict/1,2 since codec/2 now subsumes it with
the 'parse' option.
|
|
The latter is now unnecessary given that codec/2 can return a parse and
format/1 can return the dictionary format.
|
|
Function can now take a literal dictionary as input, instead of a path,
and can return results instead of writing them to the filesystem.
|
|
Didn't matter before diameter_make since the module was only called from
diameterc(1).
|
|
Instead of being output as a consequence of a debug option.
|
|
|
|
In preparation for allowing return instead of write.
|
|
"spec" is an old term the internal representation of a dictionary. The
new extensions are in the style or those that compile(3) can generate.
|
|
|
|
|
|
The workaround (commit 57d5564f) was to dialyzer only understanding
nowarn_unused_function on individual functions. This is no longer the
case as of R15B01 (commit 477fd95a).
|
|
As an inverse to '#get-'/1 in the preceding commit.
|
|
The generated '#get-'/1 has one clause for each exported record r, whose
definition is equivalent to the following.
'#get-'(#r{} = Rec) ->
[r | lists:zip(record_info(r, fields), tl(tuple_to_list(Rec)))];
The record name at the head of the list is the same format that diameter
accepts for outgoing message.
|
|
This is to make the 'inherits' option usable with dictionaries
that inherit specific AVPs. Something like "diameterc -inherts from/to"
effectively replaces "@inherits from" in the source dictionary with
"@inherits to".
|
|
|
|
Depending on the dictionary, generated dictionary modules may contain
unused functions included from diameter_gen.hrl. There may still be
warnings however since even used functions can contain code that
isn't reached for a given dictionary.
It would be useful for diameter to generate spec attributes for
a dictionary's generated records but the format of these is currently
undocumented.
|
|
Didn't quite interpret '*' as RFC 3588 dictates. In particular, the
interpretation depends on what's being qualified, a required, optional
or fixed AVP.
|
|
Writing a dictionary to file failed.
|
|
Spec was wrong. Scanning a file that ended with $' or contained an
empty $'-delimited string would have failed.
|
|
A value is required to be the same as any specified with
@avp_vendor_id but otherwise the two locations are equivalent.
Both possibilities are allowed since @avp_vendor_id is required
for AVPs of types other than Grouped (modulo it not really needing
to exist at all: see commit 943266c9) and since the grammar parsed
in @grouped (from RFC 3588) allows it.
|
|
Check that values that should be Unsigned32 actually are.
|
|
Just use include options to add to the code path and expect that
dependent modules will either already have been loaded or will be
loaded dynamically, thereby avoiding having a module being left as
both current and old code when compiling concurrently. Not a problem
for a human user interactively compiling one module at a time
but the compiler test suite for one will compile concurrently.
In any case, leaving behind old code is probably not what someone
would expect while relying on the code path probably is.
|
|
|
|
|
|
|
|
@vendor is only required if the id is actually needed. That is, if
there is a locally defined AVP whose V flag is set and which does
not have a vendor id set by @avp_vendor_id.
Also, in the case of an inherited AVP, fix avp_name/2 in a generated
dictionary module defaulting vendor id from @vendor in the inheriting
dictionary but avp_header/1 defaulting it from the inherited dictionary.
In both cases the vendor id now defaults from @vendor in the inherited
dictionary.
Note that @avp_vendor_id from the inherited dictionary is
ignored: any changes from @vendor have to be explicit in the
inheriting dictionary. A better alternative to @avp_vendor_id
is to simply inherit from dictionaries setting the appropriate
@vendor but this was previously somewhat broken so @avp_vendor_id
was needed to set the id of an AVP whose definition was copied
from another source into a dictionary that only inherited from
the common dictionary (which doesn't set V on any AVPs).
|
|
|
|
A dictionary need define neither messages nor grouped AVPs, in
which case no record definitions are generated. However, the
generated module still includes diameter_gen.hrl and this
requires some functions diameter_exprecs would otherwise insert,
even if the code that uses these will not be called.
|
|
|
|
Errors are now detected after the parse with format_error/1
providing understandable error messages, pointing to the
offending line number(s) in the dictionary source.
|
|
The previous parse was very adhoc and simply crashed on any kind
of input error, providing no identification of the objectionable input
that caused the parse to fail. The new parser is generated from a yecc
grammar, making it easier both to understand what it is that's being
parsed and to provide useful diagnostics to the user in case of error.
|
|
Simpler, no duplication of similar makefiles and makes for
better dependencies. (Aka, recursive make considered harmful.)
|
|
|
|
As a module-based alternative to the escript diameterc.
|
|
This is to enable dictionaries compiled with --name/--prefix
to be inherited using --inherits.
|
|
|
|
The section simply results in generated macros and has nothing
specifically to do with result codes. It's still not documented,
and neither are the macros generated from @enum, since the generated
names are typically so long as to be impractical/unreadable in source.
Better to use numeric values with a comment or define your own
shorter macros as the need arises.
|