VirtualBox

source: vbox/trunk/src/VBox/Installer/win/VirtualBox_TypeLibWithInterfaces.xsl

Last change on this file was 98103, checked in by vboxsync, 16 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 11.9 KB
Line 
1<?xml version="1.0"?>
2
3<!--
4 Generates a wiX include files with Interface elements for
5 the stuff in the proxy stub DLLs.
6-->
7<!--
8 Copyright (C) 2007-2023 Oracle and/or its affiliates.
9
10 This file is part of VirtualBox base platform packages, as
11 available from https://www.virtualbox.org.
12
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License
15 as published by the Free Software Foundation, in version 3 of the
16 License.
17
18 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, see <https://www.gnu.org/licenses>.
25
26 SPDX-License-Identifier: GPL-3.0-only
27-->
28
29<xsl:stylesheet version="1.0"
30 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
31
32<xsl:output method="xml"
33 version="1.0"
34 encoding="utf-8"
35 indent="yes"/>
36
37<xsl:strip-space elements="*"/>
38
39<xsl:param name="a_sTarget">all</xsl:param>
40<xsl:param name ="a_sWithSDS" select="no"/>
41<xsl:param name="a_sProxyStubClsid">{0BB3B78C-1807-4249-5BA5-EA42D66AF0BF}</xsl:param>
42<xsl:variable name="g_sProxyStubClsid" select="translate($a_sProxyStubClsid,'abcdef','ABCDEF')"/>
43
44
45<!--
46// templates
47/////////////////////////////////////////////////////////////////////////////
48-->
49
50<!--
51 * header
52-->
53<xsl:template match="/idl">
54 <xsl:comment>
55
56 DO NOT EDIT! This is a generated file.
57
58 WiX include script for the VirtualBox Type Library
59 generated from XIDL (XML interface definition).
60
61 Source : src/VBox/Main/idl/VirtualBox.xidl
62 Generator : src/VBox/Installer/win/VirtualBox_Interfaces.xsl
63 Arguments : a_sTarget=<xsl:value-of select="$a_sTarget"/>
64 a_sProxyStubClsid=<xsl:value-of select="$a_sProxyStubClsid"/>
65
66 </xsl:comment>
67 <xsl:apply-templates/>
68</xsl:template>
69
70
71<!-- - - - - - - - - - - - - - - - - - - - - - -
72 Key for more efficiently looking up of parent interfaces.
73 - - - - - - - - - - - - - - - - - - - - - - -->
74
75<xsl:key name="G_keyInterfacesByName" match="//interface[@name]" use="@name"/>
76
77<!--
78* filters to skip VBoxSDS class and interfaces if a VBOX_WITH_SDS is not defined in kmk
79-->
80 <xsl:template match="application[@uuid='ec0e78e8-fa43-43e8-ac0a-02c784c4a4fa']">
81 <xsl:if test="$a_sWithSDS='yes'" >
82 <xsl:call-template name="application_template" />
83 </xsl:if>
84 </xsl:template>
85
86<!--
87 Libraries.
88-->
89<xsl:template match="library">
90 <Include>
91 <TypeLib>
92 <xsl:attribute name="Id"><xsl:value-of select="@uuid"/></xsl:attribute>
93 <xsl:attribute name="Advertise">yes</xsl:attribute>
94 <xsl:attribute name="MajorVersion"><xsl:value-of select="substring(@version,1,1)"/></xsl:attribute>
95 <xsl:attribute name="MinorVersion"><xsl:value-of select="substring(@version,3)"/></xsl:attribute>
96 <xsl:attribute name="Language">0</xsl:attribute>
97 <xsl:attribute name="Description"><xsl:value-of select="@name"/></xsl:attribute>
98 <xsl:attribute name="HelpDirectory"><xsl:text>msm_VBoxApplicationFolder</xsl:text></xsl:attribute>
99 <xsl:apply-templates select="application | if[@target='midl']/application" />
100 </TypeLib>
101 </Include>
102</xsl:template>
103
104<!--
105Applications.
106-->
107<xsl:template match="application" name="application_template">
108 <AppId>
109 <xsl:attribute name="Id">
110 <xsl:value-of select="@uuid"/>
111 </xsl:attribute>
112 <xsl:attribute name="Description">
113 <xsl:value-of select="@name"/> Application
114 </xsl:attribute>
115 <!--
116 The name of windows service should be defined as module name in .xidl.
117 It's viable for correct registration of COM windows service.
118 -->
119 <xsl:if test="module/@context = 'LocalService'">
120 <xsl:attribute name="LocalService" >
121 <xsl:value-of select="module/@name"/>
122 </xsl:attribute>
123 </xsl:if>
124 <xsl:choose>
125 <xsl:when test="$a_sTarget = 'VBoxClient-x86'">
126 <xsl:apply-templates select="module[@name='VBoxC']/class"/>
127 </xsl:when>
128 <xsl:otherwise>
129 <xsl:apply-templates select="module/class"/>
130 </xsl:otherwise>
131 </xsl:choose>
132 </AppId>
133 <xsl:apply-templates select="interface | if/interface">
134 <xsl:sort select="translate(@uuid,'abcdef','ABCDEF')"/>
135 </xsl:apply-templates>
136</xsl:template>
137
138<!--
139 Classes.
140-->
141<xsl:template match="library//module/class">
142 <Class>
143 <xsl:attribute name="Id"><xsl:value-of select="@uuid"/></xsl:attribute>
144 <xsl:attribute name="Description"><xsl:value-of select="@name"/> Class</xsl:attribute>
145 <xsl:attribute name="Server">
146 <xsl:choose>
147 <xsl:when test="$a_sTarget = 'VBoxClient-x86' and ../@name = 'VBoxC'"><xsl:text>VBoxClient_x86</xsl:text></xsl:when>
148 <xsl:otherwise><xsl:value-of select="../@name"/></xsl:otherwise>
149 </xsl:choose>
150 </xsl:attribute>
151 <xsl:attribute name="Context">
152 <xsl:choose>
153 <xsl:when test="../@context='InprocServer'">InprocServer32</xsl:when>
154 <xsl:when test="../@context='LocalServer'" >LocalServer32</xsl:when>
155 <xsl:when test="../@context='LocalService'">LocalServer32</xsl:when>
156 <xsl:otherwise>
157 <xsl:message terminate="yes">
158 <xsl:value-of select="concat(../../@name,'::',../@name,': ')"/>
159 <xsl:text>module context </xsl:text>
160 <xsl:value-of select="concat('&quot;',../@context,'&quot;')"/>
161 <xsl:text> is invalid!</xsl:text>
162 </xsl:message>
163 </xsl:otherwise>
164 </xsl:choose>
165 </xsl:attribute>
166 <xsl:if test="../@context='InprocServer'">
167 <xsl:variable name="tmodel" select="(./@threadingModel | ../@threadingModel)[last()]"/>
168 <xsl:attribute name="ThreadingModel">
169 <xsl:choose>
170 <xsl:when test="$tmodel='Apartment'">apartment</xsl:when>
171 <xsl:when test="$tmodel='Free'">free</xsl:when>
172 <xsl:when test="$tmodel='Both'">both</xsl:when>
173 <xsl:when test="$tmodel='Neutral'">neutral</xsl:when>
174 <xsl:when test="$tmodel='Single'">single</xsl:when>
175 <xsl:when test="$tmodel='Rental'">rental</xsl:when>
176 <xsl:otherwise>
177 <xsl:message terminate="yes">
178 <xsl:value-of select="concat(../../@name,'::',@name,': ')"/>
179 <xsl:text>class (or module) threading model </xsl:text>
180 <xsl:value-of select="concat('&quot;',$tmodel,'&quot;')"/>
181 <xsl:text> is invalid!</xsl:text>
182 </xsl:message>
183 </xsl:otherwise>
184 </xsl:choose>
185 </xsl:attribute>
186 </xsl:if>
187 <ProgId>
188 <xsl:attribute name="Id">
189 <xsl:value-of select="concat(//library/@name,'.',@name,'.1')"/>
190 </xsl:attribute>
191 <xsl:attribute name="Description"><xsl:value-of select="@name"/> Class</xsl:attribute>
192 <ProgId>
193 <xsl:attribute name="Id">
194 <xsl:value-of select="concat(//library/@name,'.',@name)"/>
195 </xsl:attribute>
196 <xsl:attribute name="Description"><xsl:value-of select="@name"/> Class</xsl:attribute>
197 </ProgId>
198 </ProgId>
199 </Class>
200</xsl:template>
201
202
203<!--
204 Interfaces.
205-->
206<xsl:template match=" library/application/interface
207 | library/application/if[@target='midl']/interface
208 | library/if[@target='midl']/application/interface
209 ">
210 <Interface>
211<!-- Interface Id="{00C8F974-92C5-44A1-8F3F-702469FDD04B}" Name="IDHCPServer" ProxyStubClassId32="{0BB3B78C-1807-4249-5BA5-EA42D66AF0BF}" NumMethods="33" -->
212 <xsl:attribute name="Id">
213 <xsl:text>{</xsl:text>
214 <xsl:value-of select="translate(@uuid,'abcdef','ABCDEF')"/>
215 <xsl:text>}</xsl:text>
216 </xsl:attribute>
217 <xsl:attribute name="Name"><xsl:value-of select="@name"/></xsl:attribute>
218 <xsl:attribute name="ProxyStubClassId32"><xsl:value-of select="$g_sProxyStubClsid"/></xsl:attribute>
219 <xsl:attribute name="NumMethods"><xsl:call-template name="fnCountMethods"/></xsl:attribute>
220 </Interface>
221</xsl:template>
222
223
224
225<!--
226 Count the number of methods. This must match what midl.exe initializes
227 CInterfaceStubVtbl::header::DispatchTableCount with in VirtualBox_p.c!
228 -->
229<xsl:template name="fnCountMethods">
230 <xsl:variable name="sParent" select="@extends"/>
231
232 <!-- Count immediate methods and attributes by kind. -->
233 <xsl:variable name="cMethods"
234 select="count(child::method)
235 + count(child::if[@target='midl']/method)"/>
236 <xsl:variable name="cReadOnlyAttributes"
237 select="count(child::attribute[@readonly='yes'])
238 + count(child::if[@target='midl']/attribute[@readonly='yes'])"/>
239 <xsl:variable name="cReadWriteAttributes"
240 select="count(child::attribute[not(@readonly) or not(@readonly='yes')])
241 + count(child::if[@target = 'midl']/attribute[not(@readonly) or not(@readonly='yes')])"/>
242 <xsl:variable name="cReservedMethods">
243 <xsl:choose>
244 <xsl:when test="not(@reservedMethods)">0</xsl:when>
245 <xsl:otherwise><xsl:value-of select="@reservedMethods"/></xsl:otherwise>
246 </xsl:choose>
247 </xsl:variable>
248 <xsl:variable name="cReservedAttributes">
249 <xsl:choose>
250 <xsl:when test="not(@reservedAttributes)">0</xsl:when>
251 <xsl:otherwise><xsl:value-of select="@reservedAttributes"/></xsl:otherwise>
252 </xsl:choose>
253 </xsl:variable>
254
255 <!-- Recursively figure out the parent -->
256 <xsl:variable name="cParent">
257 <xsl:choose>
258 <xsl:when test="@extends = '$unknown'">
259 <xsl:value-of select='7'/>
260 </xsl:when>
261 <xsl:when test="@extends = '$errorinfo'">
262 <xsl:value-of select='8'/> <!-- check this one! -->
263 </xsl:when>
264 <xsl:otherwise>
265 <xsl:if test="count(key('G_keyInterfacesByName', $sParent)) != 1">
266 <xsl:message terminate="yes">Couldn't find parent (<xsl:value-of select="$sParent"/>) to <xsl:value-of select="@name"/></xsl:message>
267 </xsl:if>
268 <xsl:for-each select="key('G_keyInterfacesByName', $sParent)">
269 <xsl:call-template name="fnCountMethods"/>
270 </xsl:for-each>
271 </xsl:otherwise>
272 </xsl:choose>
273 </xsl:variable>
274
275 <!-- Compute the result. -->
276 <xsl:variable name="cMethodsTotal"
277 select="$cMethods + $cReservedMethods + $cReadOnlyAttributes
278 + ($cReadWriteAttributes * 2) + $cReservedAttributes + $cParent"/>
279 <xsl:value-of select="$cMethodsTotal"/>
280
281 <!-- For debugging! -->
282 <xsl:if test="0 or $cMethodsTotal > 256">
283 <xsl:message terminate="no">
284 <xsl:text>Debug: cMethods=</xsl:text><xsl:value-of select="$cMethods"/>
285 <xsl:text> cReadOnlyAttributes=</xsl:text><xsl:value-of select="$cReadOnlyAttributes"/>
286 <xsl:text> cReadWriteAttributes=</xsl:text><xsl:value-of select="$cReadWriteAttributes"/>
287 <xsl:text> cReservedMethods=</xsl:text><xsl:value-of select="$cReservedMethods"/>
288 <xsl:text> cReservedAttributes=</xsl:text><xsl:value-of select="$cReservedAttributes"/>
289 <xsl:text> cParent=</xsl:text><xsl:value-of select="$cParent"/>
290 <xsl:text> name=</xsl:text><xsl:value-of select="@name"/>
291 <xsl:text> parent=</xsl:text><xsl:value-of select="$sParent"/>
292 </xsl:message>
293 <xsl:if test="$cMethodsTotal > 256">
294 <xsl:message terminate="yes">
295 <xsl:text>
296Fatal xidl error: Interface </xsl:text><xsl:value-of select="@name"/>
297 <xsl:text> has </xsl:text><xsl:value-of select="$cMethodsTotal"/>
298 <xsl:text>! The maximum that older windows allows for proxy stubs is 256.
299 Please try adjust the number of reserved methods or attributes,
300 though it's clearly time to consider splitting up this monster interface.
301
302</xsl:text>
303 </xsl:message>
304 </xsl:if>
305 </xsl:if>
306</xsl:template>
307
308
309
310<!--
311 Eat everything else not explicitly matched.
312-->
313<xsl:template match="*">
314</xsl:template>
315
316
317</xsl:stylesheet>
318
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use