summaryrefslogtreecommitdiff
path: root/lib/diameter/src/compiler
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright yearHenrik Nord2018-06-181-1/+1
|
* Don't use deprecated erlang:get_stacktrace/0Anders Svensson2018-06-071-3/+3
|
* Merge branch 'anders/diameter/DOIC/OTP-14588' into maintAnders Svensson2017-09-051-2/+2
|\ | | | | | | | | | | | | | | | | | | * anders/diameter/DOIC/OTP-14588: Exercise avp_dictionaries in traffic suite Let generic AVPs be encoded/decoded in alternate dictionaries Rename field in codec map: dictionary -> app_dictionary Add RFC 7683 Diameter Overload Indicator Conveyance text and dictionary Fix decode undef Fix dictionary compilation error message
| * Fix dictionary compilation error messageAnders Svensson2017-09-041-2/+2
| | | | | | | | | | | | | | | | | | | | Adding a second {Vendor-Id} to the common CER definition results in this error: ** AVP CER at line 85 already referenced at line 84 That is, the error incorrectly refers to the message name (CER) where the AVP name (Vendor-Id) is expected.
* | Don't search forms unnecessarily in diameter_exprecs parse transformAnders Svensson2017-08-101-2/+2
|/ | | | The forms being extracted are in the head of the split.
* Fix obsolete diameter_gen.hrl commentsAnders Svensson2017-08-031-9/+8
| | | | | Most of the contents were moved to module diameter_gen in commit 205521d3.
* Merge branch 'anders/diameter/performance/OTP-14343'Anders Svensson2017-06-141-30/+71
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 ...
| * Move (most of) diameter_gen.hrl to diameter_gen.erlAnders Svensson2017-06-131-11/+14
| | | | | | | | | | | | 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.
| * Change signature associated with dictionary @custom_type/@codecsAnders Svensson2017-06-131-2/+3
| | | | | | | | | | | | 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.
| * Remove use of process dictionary in decodeAnders Svensson2017-06-131-20/+33
| | | | | | | | By passing additional arguments through it.
| * Add dictionary function avp_arity/1Anders Svensson2017-06-121-3/+27
| |
* | diameter: Fix handling of locations and annotationsHans Bolinder2017-03-081-2/+2
|/
* Update copyright-yearErlang/OTP2016-12-071-1/+1
|
* Remove copyright from generated dictionary modulesAnders Svensson2016-08-261-14/+1
| | | | | | | The copyright was a historical remnant of diameter's roots prior to its inclusion in OTP. Thanks to Anatolie Golovco.
* update copyright-yearHenrik Nord2016-03-156-6/+6
|
* Change license text to APLv2Bruce Yinhe2015-06-188-72/+80
|
* diameter: Use module erl_annoHans Bolinder2015-04-302-8/+10
|
* Fix ?MODULE in preprocessed dictionary formsAnders Svensson2014-09-121-5/+28
| | | | | | | | | | | | | | | | | 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.
* Fix broken check for undefined AVPs in @codec and @custom_typesAnders Svensson2014-05-291-5/+4
| | | | | Instead of detecting the error, code generation failed when attempting to lookup the type of an undefined AVP.
* Merge branch 'anders/diameter/unicode_path/OTP-11655'Anders Svensson2014-03-311-12/+20
|\ | | | | | | | | * anders/diameter/unicode_path/OTP-11655: Fix unicode path failure in diameter_make:codec/2
| * Fix unicode path failure in diameter_make:codec/2Anders Svensson2014-03-201-13/+21
| | | | | | | | | | A dictionary path containing a unicode codepoint > 255 caused the function to fail when iolist_to_binary/1 was applied to the path.
* | Use fun encoding to erl_parse:abstract/2Anders Svensson2014-03-252-3/+9
| | | | | | | | | | | | 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.
* | Adapt dictionary compilation to new default encodingAnders Svensson2014-03-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.)
* | Ensure that Grouped AVP's are fully defined in dictionariesAnders Svensson2014-01-161-13/+24
| | | | | | | | | | | | The case in which an AVP was defined as having type Grouped in @avp_types without a corresponding specification in @grouped was missing.
* | Don't format diameter_make:codec/2 errorsAnders Svensson2014-01-161-4/+10
|/ | | | | | | 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.
* Return compilable forms instead of beamAnders Svensson2013-12-012-24/+7
| | | | That is, preprocessed forms that can be passed to compile:forms/1,2.
* Fix diameter_make:flatten/1Anders Svensson2013-12-012-10/+91
| | | | | To set @avp_vendor_id, @codecs and @custom_types as required for imported avps.
* Modify type that currently causes dialyzer woeAnders Svensson2013-12-011-1/+1
| | | | | | 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.
* Simplify and extend diameter_make interfaceAnders Svensson2013-12-012-115/+171
| | | | | | | | | | | 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.
* Add diameter_make:flatten/1, remove reformat/1Anders Svensson2013-12-011-15/+19
| | | | | The latter is now unnecessary given that codec/2 can return a parse and format/1 can return the dictionary format.
* Extend diameter_make:codec/2Anders Svensson2013-11-283-57/+129
| | | | | Function can now take a literal dictionary as input, instead of a path, and can return results instead of writing them to the filesystem.
* Don't pollute process dictionary in diameter_codegen:from_dict/4Anders Svensson2013-11-281-1/+8
| | | | | Didn't matter before diameter_make since the module was only called from diameterc(1).
* Make forms a separate output from diameter_codegenAnders Svensson2013-11-282-6/+7
| | | | Instead of being output as a consequence of a debug option.
* Remove last remnants of "spec"Anders Svensson2013-11-282-127/+127
|
* Write as last step in code generationAnders Svensson2013-11-281-121/+93
| | | | In preparation for allowing return instead of write.
* Change extensions for debug output: .spec/forms -> .D/FAnders Svensson2013-11-281-2/+2
| | | | | "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.
* Remove redundant integer type specifiers from binariesAnders Svensson2013-05-291-3/+3
|
* Update copyright yearsBjörn-Egil Dahlberg2013-02-222-2/+2
|
* Remove dialyzer nowarn_unused_function workaroundAnders Svensson2013-02-182-44/+3
| | | | | | 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).
* Add exprecs '#new-'/1 clause taking list argumentAnders Svensson2013-02-081-5/+10
| | | | As an inverse to '#get-'/1 in the preceding commit.
* Add exprecs '#get-'/1 for transforming records into listsAnders Svensson2013-02-082-9/+37
| | | | | | | | | | | 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.
* Allow module name mapping at dictionary compilationAnders Svensson2011-12-161-1/+16
| | | | | | | 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".
* Fix blunder that broke name/prefix compilation optionsAnders Svensson2011-12-161-1/+1
|
* Tell dialyzer not to warn about unused functionsAnders Svensson2011-12-082-1/+42
| | | | | | | | | | | 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.
* Fix semantic checks on AVP qualifiersAnders Svensson2011-12-082-26/+67
| | | | | | Didn't quite interpret '*' as RFC 3588 dictates. In particular, the interpretation depends on what's being qualified, a required, optional or fixed AVP.
* Minor codegen/debug fixAnders Svensson2011-12-081-9/+9
| | | | Writing a dictionary to file failed.
* Minor diameter_dict_scanner fixAnders Svensson2011-12-061-2/+4
| | | | | Spec was wrong. Scanning a file that ended with $' or contained an empty $'-delimited string would have failed.
* Fix interpretation of vendor id in @groupedAnders Svensson2011-12-052-7/+19
| | | | | | | | | 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.
* Add range checks on dictionary integersAnders Svensson2011-12-051-18/+69
| | | | Check that values that should be Unsigned32 actually are.
* Don't explicitly load inherited modulesAnders Svensson2011-12-041-60/+31
| | | | | | | | | | | 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.