summaryrefslogtreecommitdiff
path: root/lcmodule/customer_config/custom_common.xsl
blob: 76f7e5de5b9a6048c52cd60bedb527c82656cf15 (plain)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Copyright (C) ST-Ericsson SA 2011
* License terms: 3-clause BSD license
-->
<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform" >

<!-- Ugly name-mangling templates. upper-case() did not work in this
     implementation -->
<template name="groupidmain">
  <param name="path" select="../." />
  <value-of select="concat('GROUP_', translate($path/interface[@type='loader']/@name,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'))" />
</template>

  
<template name="groupid">
  <param name="path" select="." />
  <value-of select="concat('GROUP_', translate($path/interface[@type='loader']/@name,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ'))" />
</template>

<template name="commandid">
  <param name="path" select="." />
  <value-of select="translate(concat('COMMAND_', $path/../interface[@type='loader']/@name, '_', $path/interface[@type='loader']/@name),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')" />
</template>



<template match="value" mode="deserialize">
<choose>
  <when test="@type='uint32'">
      uint32 <value-of select="@name" /> = get_uint32(&amp;Data_p);</when>
  <when test="@type='string'">
      const char *<value-of select="@name" /> = get_strdup(&amp;Data_p);</when>
  <when test="@type='buffer' and @length='*'">
      int <value-of select="@name" />Length = Meta_p-&gt;Header.PayloadLength - ((uint32)Data_p - (uint32)Meta_p-&gt;Payload_p);
      const void *<value-of select="@name" /> = Data_p;</when>
  <when test="@type='buffer' and @length!='*'">
      const void *<value-of select="@name" /> = Data_p;</when>
</choose>
<if test="position() = last()"><text>
</text></if>
</template>

<template match="value" mode="serialize">
<choose>
  <when test="@type='uint32'">
  put_uint32(&amp;Data_p, <value-of select="@name" />);</when>
  <when test="@type='string'">
  put_string(&amp;Data_p, <value-of select="@name" />);</when>
  <when test="@type='buffer' and @length='*'">
  put_block(&amp;Data_p, <value-of select="@name" />, <value-of select="@name" />PLSize);</when>
  <when test="@type='buffer' and @length!='*'">
  put_block(&amp;Data_p, <value-of select="@name" />, PLSize);</when>
</choose>
<if test="position() = last()"><text>
</text></if>
</template>

<template match="value" mode="clean">
<choose>
  <when test="@type='string'">
      free(<value-of select="@name" />);</when>
</choose>
</template>

<template match="value" mode="document">
 * @param [in] <value-of select="@name" /><text> </text><value-of select="text()" />
<if test="position() = last()">
 * </if>
</template>

<template match="value" mode="declare">
  <if test="position() > 1">, </if>
<choose>
  <when test="@type='uint32'">const uint32 <value-of select="@name" /></when>
  <when test="@type='string'">const char *<value-of select="@name" /></when>
  <when test="@type='buffer' and @length='*'">int <value-of select="@name" />Length, const void *<value-of select="@name" /></when>
  <when test="@type='buffer' and @length!='*'">const void *<value-of select="@name" /></when>
</choose>
</template>

<template match="input" mode="declare">
<choose>
  <when test="current()=''">void</when>
</choose>
</template> 

<template match="value" mode="call">
  <if test="position() > 1">, </if>
<choose>
  <when test="@type='uint32'"><value-of select="@name" /></when>
  <when test="@type='string'"><value-of select="@name" /></when>
  <when test="@type='buffer' and @length='*'"><value-of select="@name" />Length, <value-of select="@name" /></when>
  <when test="@type='buffer' and @length!='*'"><value-of select="@name" /></when>
</choose>
</template>

<template match="group/documentation">
/*
 * <value-of select="normalize-space(.)"/>
 */
</template>

<template name="prototype">
<param name="name" />
<param name="direction" />
<param name="source" />
<param name="ref" />
<choose>
<when test="name($direction)='input' and contains($source, 'PC')">
/**
 * <value-of select="normalize-space(./documentation/text())"/>
 * \see <value-of select="$ref"/>
 * Call source: <value-of select="$source"/>
 * <apply-templates select="input/value" mode="document" />
 * @return ErrorCode_e ...
 */
ErrorCode_e <value-of select="$name"/>(<choose><when test="count(input/value) > 0"><apply-templates select="input" mode="declare"/><apply-templates select="input/value" mode="declare"/></when><otherwise>void</otherwise></choose>);</when>
<when test="name($direction)='input' and contains($source, 'ME')">
/**
 * <value-of select="normalize-space(./documentation/text())"/>
 * \see <value-of select="$ref"/>
 * Call source: <value-of select="$source"/>
 * <apply-templates select="input/value" mode="document" />
 * @return ErrorCode_e ...
 */
ErrorCode_e <value-of select="$name"/>(uint32 PLSize<if test="count(input/value) > 0">, </if><apply-templates select="input/value" mode="declare"/>);</when>
<when test="name($direction)='output'">
/**
 * Response to \see <value-of select="$ref"/>
 * Call source: <value-of select="$source"/>
 *
 * @param [in] Status Completion status code.
 * <apply-templates select="output/value" mode="document" />
 * @return ErrorCode_e ...
 */
ErrorCode_e <value-of select="$name"/>(uint32 PLSize, ErrorCode_e Status<if test="count(output/value) > 0">, </if><apply-templates select="output/value" mode="declare"></apply-templates>);</when>
</choose>
<text>
</text>
</template>


</stylesheet>