sync/gen_messages.ysl2
author Neal H. Walfield <neal@pep.foundation>
Wed, 08 May 2019 12:20:37 +0200
branchemail_comparison
changeset 3649 1dd837adc30b
parent 3552 12acabcf550f
child 4253 64ff1db68934
permissions -rw-r--r--
Fix public key.
     1 // This file is under GNU General Public License 3.0
     2 // see LICENSE.txt
     3 // generated files of this template are under BSD License 2.0
     4 
     5 // generate message functions
     6 
     7 // Copyleft (c) 2017-2019, p≡p foundation
     8 
     9 // Written by Volker Birk
    10 
    11 include yslt.yml2
    12 
    13 tstylesheet {
    14     include standardlib.ysl2
    15     include ./functions.ysl2
    16 
    17     function "pEp_imports"
    18         | IMPORTS Identity, IdentityList, TID, Hash FROM PEP;
    19 
    20     function "header"
    21     ||
    22     -- This file is under BSD License 2.0
    23 
    24     -- «@name» protocol for p≡p
    25     -- Copyleft 2016-2019 by p≡p foundation
    26 
    27     -- Written by Volker Birk
    28 
    29     ||
    30 
    31     template "/" {
    32         apply "protocol", 0, mode=overview;
    33         apply "protocol/fsm", 0, mode=individual;
    34     }
    35 
    36     template "protocol", mode=overview
    37         document "generated/{yml:lcase(@name)}.asn1", "text" {
    38 
    39         call "header";
    40         ||
    41         «yml:ucase(@name)»
    42             { iso(1) org(3) dod(6) internet(1) private(4) enterprise(1) pEp(47878) «yml:lcase(@name)»(«@id») }
    43 
    44         DEFINITIONS AUTOMATIC TAGS EXTENSIBILITY IMPLIED ::=
    45 
    46         BEGIN
    47 
    48         `` for "fsm" | IMPORTS «@name» FROM «yml:ucase(@name)»;
    49 
    50         «@name» ::= CHOICE {
    51             `` for "fsm" |> «yml:lcase(@name)» [APPLICATION «@id»] «@name»`if "position()!=last()" > , `
    52         }
    53 
    54         END
    55 
    56         ||
    57     }
    58 
    59     template "fsm", mode=individual
    60         document "generated/{yml:lcase(@name)}.asn1", "text" {
    61 
    62         call "header";
    63         ||
    64         «yml:ucase(@name)»
    65             { iso(1) org(3) dod(6) internet(1) private(4) enterprise(1) pEp(47878) «yml:lcase(../@name)»(«../@id») «yml:lcase(@name)»(«@id») }
    66 
    67         DEFINITIONS AUTOMATIC TAGS EXTENSIBILITY IMPLIED ::=
    68 
    69         BEGIN
    70 
    71         EXPORTS «@name»;
    72         `` call "pEp_imports"
    73 
    74         Version ::= SEQUENCE {
    75             major INTEGER (0..255) DEFAULT «version/@major»,
    76             minor INTEGER (0..255) DEFAULT «version/@minor»
    77         }
    78 
    79         `` apply "message", 0, mode=impl;
    80         «@name» ::= CHOICE {
    81         `` for "message" |> «yml:mixedCase(@name)» [APPLICATION «@id»] «@name»`if "position()!=last()" > ,`
    82         }
    83 
    84         END
    85 
    86         ||
    87     }
    88 
    89     template "message", mode=impl
    90     ||
    91     «@name» ::= SEQUENCE {
    92     `` for "field|auto" |> «func:asn1name()» «func:asn1type()»`if "position()!=last()" > ,`
    93     }
    94 
    95     ||
    96 }
    97