aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/compiler
AgeCommit message (Collapse)Author
2017-08-03Fix obsolete diameter_gen.hrl commentsAnders Svensson
Most of the contents were moved to module diameter_gen in commit 205521d3.
2017-06-14Merge branch 'anders/diameter/performance/OTP-14343'Anders Svensson
* anders/diameter/performance/OTP-14343: (50 commits) Let spawn_opt config replace erlang:spawn_opt/2 for request processes Move (most of) diameter_gen.hrl to diameter_gen.erl Change signature associated with dictionary @custom_type/@codecs Avoid sending answer terms between processes unnecessarily Refactor handling of incoming requests Restore diameter_codec:decode/2, update diameter_codec(3) Add diameter_codec option ordered_encode Restore undocumented Failed-AVP setting convenience Fix/simplify setting of one Failed-AVP Avoid recreating records Avoid recreating records Avoid recreating records Avoid recreating records Adapt test suites to modified encode/decode Simplify diameter_caps construction Don't compute URI defaults unnecessarily Don't deconstruct {TPid, Caps} unnecessarily Remove use of process dictionary in decode Remove minor diameter_config bloat Fix maximum AVP arity check ...
2017-06-13Move (most of) diameter_gen.hrl to diameter_gen.erlAnders Svensson
To remove the requirement that dictionary modules be recompiled whenever the encode/decode implementation changes. The included diameter_gen.hrl now only contains trivial functions that call info diameter_gen.erl.
2017-06-13Change signature associated with dictionary @custom_type/@codecsAnders Svensson
To pass the options map through the encode. This is not backwards compatible, and dictionaries supporting @custom_types or @codecs will need to be updated.
2017-06-13Remove use of process dictionary in decodeAnders Svensson
By passing additional arguments through it.
2017-06-12Add dictionary function avp_arity/1Anders Svensson
2017-03-08diameter: Fix handling of locations and annotationsHans Bolinder
2016-12-07Update copyright-yearErlang/OTP
2016-08-26Remove copyright from generated dictionary modulesAnders Svensson
The copyright was a historical remnant of diameter's roots prior to its inclusion in OTP. Thanks to Anatolie Golovco.
2016-03-15update copyright-yearHenrik Nord
2015-06-18Change license text to APLv2Bruce Yinhe
2015-04-30diameter: Use module erl_annoHans Bolinder
2014-09-12Fix ?MODULE in preprocessed dictionary formsAnders Svensson
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.
2014-05-29Fix broken check for undefined AVPs in @codec and @custom_typesAnders Svensson
Instead of detecting the error, code generation failed when attempting to lookup the type of an undefined AVP.
2014-03-31Merge branch 'anders/diameter/unicode_path/OTP-11655'Anders Svensson
* anders/diameter/unicode_path/OTP-11655: Fix unicode path failure in diameter_make:codec/2
2014-03-25Use fun encoding to erl_parse:abstract/2Anders Svensson
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.
2014-03-21Adapt dictionary compilation to new default encodingAnders Svensson
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.)
2014-03-20Fix unicode path failure in diameter_make:codec/2Anders Svensson
A dictionary path containing a unicode codepoint > 255 caused the function to fail when iolist_to_binary/1 was applied to the path.
2014-01-16Ensure that Grouped AVP's are fully defined in dictionariesAnders Svensson
The case in which an AVP was defined as having type Grouped in @avp_types without a corresponding specification in @grouped was missing.
2014-01-16Don't format diameter_make:codec/2 errorsAnders Svensson
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.
2013-12-01Return compilable forms instead of beamAnders Svensson
That is, preprocessed forms that can be passed to compile:forms/1,2.
2013-12-01Fix diameter_make:flatten/1Anders Svensson
To set @avp_vendor_id, @codecs and @custom_types as required for imported avps.
2013-12-01Modify type that currently causes dialyzer woeAnders Svensson
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.
2013-12-01Simplify and extend diameter_make interfaceAnders Svensson
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.
2013-12-01Add diameter_make:flatten/1, remove reformat/1Anders Svensson
The latter is now unnecessary given that codec/2 can return a parse and format/1 can return the dictionary format.
2013-11-28Extend diameter_make:codec/2Anders Svensson
Function can now take a literal dictionary as input, instead of a path, and can return results instead of writing them to the filesystem.
2013-11-28Don't pollute process dictionary in diameter_codegen:from_dict/4Anders Svensson
Didn't matter before diameter_make since the module was only called from diameterc(1).
2013-11-28Make forms a separate output from diameter_codegenAnders Svensson
Instead of being output as a consequence of a debug option.
2013-11-28Remove last remnants of "spec"Anders Svensson
2013-11-28Write as last step in code generationAnders Svensson
In preparation for allowing return instead of write.
2013-11-28Change extensions for debug output: .spec/forms -> .D/FAnders Svensson
"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.
2013-05-29Remove redundant integer type specifiers from binariesAnders Svensson
2013-02-22Update copyright yearsBjörn-Egil Dahlberg
2013-02-18Remove dialyzer nowarn_unused_function workaroundAnders Svensson
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).
2013-02-08Add exprecs '#new-'/1 clause taking list argumentAnders Svensson
As an inverse to '#get-'/1 in the preceding commit.
2013-02-08Add exprecs '#get-'/1 for transforming records into listsAnders Svensson
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.
2011-12-16Allow module name mapping at dictionary compilationAnders Svensson
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".
2011-12-16Fix blunder that broke name/prefix compilation optionsAnders Svensson
2011-12-08Tell dialyzer not to warn about unused functionsAnders Svensson
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.
2011-12-08Fix semantic checks on AVP qualifiersAnders Svensson
Didn't quite interpret '*' as RFC 3588 dictates. In particular, the interpretation depends on what's being qualified, a required, optional or fixed AVP.
2011-12-08Minor codegen/debug fixAnders Svensson
Writing a dictionary to file failed.
2011-12-06Minor diameter_dict_scanner fixAnders Svensson
Spec was wrong. Scanning a file that ended with $' or contained an empty $'-delimited string would have failed.
2011-12-05Fix interpretation of vendor id in @groupedAnders Svensson
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.
2011-12-05Add range checks on dictionary integersAnders Svensson
Check that values that should be Unsigned32 actually are.
2011-12-04Don't explicitly load inherited modulesAnders Svensson
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.
2011-12-04Tweak diameter_make interfaceAnders Svensson
2011-12-04Add diameter_dict_util:format/1 for reconstructing a dictionary fileAnders Svensson
2011-12-04Minor codegen tweaksAnders Svensson
2011-12-02Vendor id fixesAnders Svensson
@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).
2011-12-02Adapt diameter_makeAnders Svensson