File: Values.xsl

package info (click to toggle)
wireshark 4.6.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 351,352 kB
  • sloc: ansic: 3,102,875; cpp: 129,717; xml: 100,972; python: 56,513; perl: 24,575; sh: 5,874; lex: 4,383; pascal: 4,304; makefile: 166; ruby: 113; objc: 91; tcl: 35
file content (65 lines) | stat: -rw-r--r-- 2,283 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!--
Syntax: xsltproc Values.xsl FIX44.xml
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 <xsl:output  method="text" encoding="UTF-8"/>

 <xsl:template match="text()"/>
 <xsl:template match="/">/* DO NOT EDIT
 * This file is autogenerated
 * Look fix/README for more information how to generate this file
 *
 */

typedef struct _fix_field {
    int      tag;         /* FIX tag */
    int      type;        /* */
    const void *table;
} fix_field;

<xsl:apply-templates/>

</xsl:template>

<!--
translate(@description,$uppercase,$smallcase)
-->

<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />

<xsl:template match="fix/fields">
<xsl:for-each select="field[value]">
    <xsl:variable name="val_type"  >
    <xsl:choose>
           <xsl:when test="@type='STRING'"> string_string </xsl:when>
           <xsl:when test="@type='MULTIPLESTRINGVALUE'"> string_string </xsl:when>
           <xsl:otherwise> value_string </xsl:otherwise>
    </xsl:choose>
    </xsl:variable>
    static const <xsl:copy-of select="$val_type" /> <xsl:value-of select="@name"/>_val[] = {<xsl:for-each select="value"> <xsl:choose>
             <xsl:when test="../@type='INT'">
        { <xsl:value-of select="@enum"/>, "<xsl:value-of select="translate(@description,'_',' ')"/>" },</xsl:when>
             <xsl:when test="../@type='STRING'">
        { "<xsl:value-of select="@enum"/>", "<xsl:value-of select="translate(@description,'_',' ')"/>" },</xsl:when>
             <xsl:when test="../@type='MULTIPLESTRINGVALUE'">
        { "<xsl:value-of select="@enum"/>", "<xsl:value-of select="translate(@description,'_',' ')"/>" },</xsl:when>
             <xsl:otherwise>
        { '<xsl:value-of select="@enum"/>', "<xsl:value-of select="translate(@description,'_',' ')"/>" },</xsl:otherwise>
           </xsl:choose>
        </xsl:for-each>
        { 0, NULL }
    };

</xsl:for-each>
</xsl:template>

<xsl:template match="fix/messages">
    static const string_string messages_val[] = {<xsl:for-each select="message">
        { "<xsl:value-of select="@msgtype"/>", "<xsl:value-of select="@name"/>" },</xsl:for-each>
        { 0, NULL }
    };
</xsl:template>

</xsl:stylesheet>