summaryrefslogtreecommitdiffstats
path: root/src/VBox/Main/idl/apiwrap-server-filelist.xsl
blob: ea23101415b40fd18cd1185ab840eaa3931d0045 (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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<?xml version="1.0"?>

<!--
    apiwrap-server-filelist.xsl:

        XSLT stylesheet that generate a makefile include with
        the lists of files that apiwrap-server.xsl produces
        from VirtualBox.xidl.
-->
<!--
    Copyright (C) 2015-2023 Oracle and/or its affiliates.

    This file is part of VirtualBox base platform packages, as
    available from https://www.virtualbox.org.

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation, in version 3 of the
    License.

    This program is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, see <https://www.gnu.org/licenses>.

    SPDX-License-Identifier: GPL-3.0-only
-->

<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:exsl="http://exslt.org/common"
    extension-element-prefixes="exsl">

<xsl:output method="text"/>

<xsl:strip-space elements="*"/>

<!-- - - - - - - - - - - - - - - - - - - - - - -
   XSLT parameters
 - - - - - - - - - - - - - - - - - - - - - - -->

<!-- Whether to generate wrappers for VBoxSDS-->
<xsl:param name="g_fVBoxWithSDS" select="'no'"/>

<!-- - - - - - - - - - - - - - - - - - - - - - -
  global XSLT variables
 - - - - - - - - - - - - - - - - - - - - - - -->

<xsl:variable name="G_sNewLine">
    <xsl:choose>
        <xsl:when test="$KBUILD_HOST = 'win'">
            <xsl:value-of select="'&#13;&#10;'"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="'&#10;'"/>
        </xsl:otherwise>
    </xsl:choose>
</xsl:variable>


<!-- - - - - - - - - - - - - - - - - - - - - - -
  wildcard match, ignore everything which has no explicit match
 - - - - - - - - - - - - - - - - - - - - - - -->

<xsl:template match="*" mode="filelist-even-sources"/>
<xsl:template match="*" mode="filelist-odd-sources"/>
<xsl:template match="*" mode="filelist-headers"/>

<!-- - - - - - - - - - - - - - - - - - - - - - -
  interface match
 - - - - - - - - - - - - - - - - - - - - - - -->

<xsl:template match="interface" mode="filelist-even-sources">
    <xsl:if test="not(@internal='yes') and not(@autogen='VBoxEvent') and not(@supportsErrorInfo='no') and (position() mod 2) = 0">
        <xsl:value-of select="concat(' \', $G_sNewLine, '&#9;$(VBOX_MAIN_APIWRAPPER_DIR)/', substring(@name, 2), 'Wrap.cpp')"/>
    </xsl:if>
</xsl:template>

<xsl:template match="interface" mode="filelist-odd-sources">
    <xsl:if test="not(@internal='yes') and not(@autogen='VBoxEvent') and not(@supportsErrorInfo='no') and (position() mod 2) = 1">
        <xsl:value-of select="concat(' \', $G_sNewLine, '&#9;$(VBOX_MAIN_APIWRAPPER_DIR)/', substring(@name, 2), 'Wrap.cpp')"/>
    </xsl:if>
</xsl:template>

<xsl:template match="interface" mode="filelist-headers">
    <xsl:if test="not(@internal='yes') and not(@autogen='VBoxEvent') and not(@supportsErrorInfo='no')">
        <xsl:value-of select="concat(' \', $G_sNewLine, '&#9;$(VBOX_MAIN_APIWRAPPER_DIR)/', substring(@name, 2), 'Wrap.h')"/>
    </xsl:if>
</xsl:template>

<!-- - - - - - - - - - - - - - - - - - - - - - -
  ignore all if tags except those for XPIDL or MIDL target
 - - - - - - - - - - - - - - - - - - - - - - -->

<xsl:template match="if" mode="filelist-even-sources">
    <xsl:if test="(@target = 'xpidl') or (@target = 'midl')">
        <xsl:apply-templates mode="filelist-even-sources"/>
    </xsl:if>
</xsl:template>

<xsl:template match="if" mode="filelist-odd-sources">
    <xsl:if test="(@target = 'xpidl') or (@target = 'midl')">
        <xsl:apply-templates mode="filelist-odd-sources"/>
    </xsl:if>
</xsl:template>

<xsl:template match="if" mode="filelist-headers">
    <xsl:if test="(@target = 'xpidl') or (@target = 'midl')">
        <xsl:apply-templates mode="filelist-headers"/>
    </xsl:if>
</xsl:template>

<!-- - - - - - - - - - - - - - - - - - - - - - -
  application match
 - - - - - - - - - - - - - - - - - - - - - - -->

<xsl:template match="application" mode="filelist-even-sources" name="template_app_filelist_even_sources">
    <xsl:apply-templates mode="filelist-even-sources"/>
</xsl:template>

<xsl:template match="application" mode="filelist-odd-sources" name="template_app_filelist_odd_sources">
    <xsl:apply-templates mode="filelist-odd-sources"/>
</xsl:template>

<xsl:template match="application" mode="filelist-headers" name="template_app_filelist_headers">
    <xsl:apply-templates mode="filelist-headers"/>
</xsl:template>

<!-- - - - - - - - - - - - - - - - - - - - - - -
  library match
 - - - - - - - - - - - - - - - - - - - - - - -->

<xsl:template match="library" mode="filelist-even-sources">
    <xsl:apply-templates mode="filelist-even-sources"/>
</xsl:template>

<xsl:template match="library" mode="filelist-odd-sources">
    <xsl:apply-templates mode="filelist-odd-sources"/>
</xsl:template>

<xsl:template match="library" mode="filelist-headers">
    <xsl:apply-templates mode="filelist-headers"/>
</xsl:template>

<!-- - - - - - - - - - - - - - - - - - - - - - -
  root match
 - - - - - - - - - - - - - - - - - - - - - - -->

<xsl:template match="/idl">
    <xsl:text>VBOX_MAIN_APIWRAPPER_GEN_SRCS_EVEN := </xsl:text>
    <xsl:apply-templates mode="filelist-even-sources"/>
    <xsl:value-of select="concat($G_sNewLine, $G_sNewLine)"/>

    <xsl:text>VBOX_MAIN_APIWRAPPER_GEN_SRCS_ODD := </xsl:text>
    <xsl:apply-templates mode="filelist-odd-sources"/>
    <xsl:value-of select="concat($G_sNewLine, $G_sNewLine)"/>

    <xsl:text>VBOX_MAIN_APIWRAPPER_GEN_SRCS := $(VBOX_MAIN_APIWRAPPER_GEN_SRCS_EVEN) $(VBOX_MAIN_APIWRAPPER_GEN_SRCS_ODD)</xsl:text>
    <xsl:value-of select="concat($G_sNewLine, $G_sNewLine)"/>

    <xsl:text>VBOX_MAIN_APIWRAPPER_GEN_HDRS := </xsl:text>
    <xsl:apply-templates mode="filelist-headers"/>
    <xsl:value-of select="concat($G_sNewLine, $G_sNewLine)"/>
</xsl:template>


    <xsl:template match="application[@uuid='ec0e78e8-fa43-43e8-ac0a-02c784c4a4fa']" mode="filelist-even-sources" >
        <xsl:if test="$g_fVBoxWithSDS='yes'" >
            <xsl:call-template name="template_app_filelist_even_sources" />
        </xsl:if>
    </xsl:template>

    <xsl:template match="application[@uuid='ec0e78e8-fa43-43e8-ac0a-02c784c4a4fa']" mode="filelist-headers" >
        <xsl:if test="$g_fVBoxWithSDS='yes'" >
            <xsl:call-template name="template_app_filelist_headers" />
        </xsl:if>
    </xsl:template>

    <xsl:template match="application[@uuid='ec0e78e8-fa43-43e8-ac0a-02c784c4a4fa']" mode="filelist-odd-sources" >
        <xsl:if test="$g_fVBoxWithSDS='yes'" >
            <xsl:call-template name="template_app_filelist_odd_sources" />
        </xsl:if>
    </xsl:template>


</xsl:stylesheet>
<!-- vi: set tabstop=4 shiftwidth=4 expandtab: -->