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