Enhance FIX generator

* Remove whitespace and tab
* Add information how to generate packet-fix.h (in top of packet-fix.h)

Regenerate packet-fix.h

svn path=/trunk/; revision=47178
This commit is contained in:
Alexis La Goutte 2013-01-20 18:32:23 +00:00
parent 1a182e2a79
commit 48cef7c61a
4 changed files with 9831 additions and 9805 deletions

File diff suppressed because it is too large Load Diff

View File

@ -8,22 +8,23 @@ Syntax: xsltproc Values.xsl FIX44.xml
<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
*
* $Id$
*
*/
typedef struct _fix_field {
int tag; /* FIX tag */
int hf_id;
int type; /* */
const void *table;
int tag; /* FIX tag */
int hf_id;
int type; /* */
const void *table;
} fix_field;
<xsl:apply-templates/>
<xsl:apply-templates/>
</xsl:template>
<!--
translate(@description,$uppercase,$smallcase)
-->
@ -34,34 +35,34 @@ translate(@description,$uppercase,$smallcase)
<xsl:template match="fix/fields">
<xsl:for-each select="field[value]">
<xsl:variable name="val_type" >
<xsl:choose>
<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: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>
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: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: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: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>
{ "", NULL }
};
static const string_string messages_val[] = {<xsl:for-each select="message">
{ "<xsl:value-of select="@msgtype"/>", "<xsl:value-of select="@name"/>" },</xsl:for-each>
{ "", NULL }
};
</xsl:template>
</xsl:stylesheet>

View File

@ -8,27 +8,27 @@
<xsl:template match="/">
static fix_field fix_fields[] = {
<xsl:apply-templates/>
};
</xsl:template>
<xsl:apply-templates/>
};
</xsl:template>
<xsl:template match="fields">
<xsl:for-each select="field">
<xsl:sort select="@number" data-type="number"/>
<xsl:choose>
<xsl:when test="count( value ) != 0">
<xsl:variable name="val_type" >
<xsl:choose>
<xsl:when test="@type='INT'">0</xsl:when>
<xsl:when test="@type='STRING'">1</xsl:when>
<xsl:otherwise>2</xsl:otherwise>
</xsl:choose>
<xsl:sort select="@number" data-type="number"/>
<xsl:choose>
<xsl:when test="count( value ) != 0">
<xsl:variable name="val_type" >
<xsl:choose>
<xsl:when test="@type='INT'">0</xsl:when>
<xsl:when test="@type='STRING'">1</xsl:when>
<xsl:otherwise>2</xsl:otherwise>
</xsl:choose>
</xsl:variable>
{ <xsl:value-of select="@number"/>, -1, <xsl:copy-of select="$val_type" /> , <xsl:value-of select="@name"/>_val }, </xsl:when>
<xsl:otherwise>
{ <xsl:value-of select="@number"/>, -1, 0, NULL }, /* <xsl:value-of select="@name"/> */ </xsl:otherwise>
</xsl:choose>
{ <xsl:value-of select="@number"/>, -1, <xsl:copy-of select="$val_type" />, <xsl:value-of select="@name"/>_val },</xsl:when>
<xsl:otherwise>
{ <xsl:value-of select="@number"/>, -1, 0, NULL }, /* <xsl:value-of select="@name"/> */</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
</xsl:template>
</xsl:stylesheet>

View File

@ -2,22 +2,34 @@
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" encoding="UTF-8"/>
<xsl:output method="text" encoding="UTF-8"/>
<xsl:template match="text()"/>
<xsl:template match="text()"/>
<xsl:template match="/">
<xsl:template match="/">
static hf_register_info hf_FIX[] = {
<xsl:apply-templates/>
};
<xsl:apply-templates/>
};
/*
* Editor modelines
*
* Local Variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/
</xsl:template>
<xsl:template match="fields">
<xsl:for-each select="field">
<xsl:sort select="@number" data-type="number"/>
{ &amp;fix_fields[<xsl:value-of select="position( ) -1" />].hf_id,
<xsl:sort select="@number" data-type="number"/>
{ &amp;fix_fields[<xsl:value-of select="position( ) -1" />].hf_id,
{ "<xsl:value-of select="@name"/> (<xsl:value-of select="@number"/>)", "fix.<xsl:value-of select="@name"/>",
FT_STRING, BASE_NONE, NULL, 0x00,
NULL, HFILL }