1 | <?xml version="1.0"?>
|
---|
2 |
|
---|
3 | <!--
|
---|
4 | * A template to generate a RGS resource script that contains
|
---|
5 | * registry definitions necessary to properly register
|
---|
6 | * VirtualBox Main API COM components.
|
---|
7 | -->
|
---|
8 | <!--
|
---|
9 | Copyright (C) 2007-2022 Oracle and/or its affiliates.
|
---|
10 |
|
---|
11 | This file is part of VirtualBox base platform packages, as
|
---|
12 | available from https://www.virtualbox.org.
|
---|
13 |
|
---|
14 | This program is free software; you can redistribute it and/or
|
---|
15 | modify it under the terms of the GNU General Public License
|
---|
16 | as published by the Free Software Foundation, in version 3 of the
|
---|
17 | License.
|
---|
18 |
|
---|
19 | This program is distributed in the hope that it will be useful, but
|
---|
20 | WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
22 | General Public License for more details.
|
---|
23 |
|
---|
24 | You should have received a copy of the GNU General Public License
|
---|
25 | along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
26 |
|
---|
27 | SPDX-License-Identifier: GPL-3.0-only
|
---|
28 | -->
|
---|
29 |
|
---|
30 | <xsl:stylesheet version="1.0"
|
---|
31 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
---|
32 |
|
---|
33 | <xsl:output method="text"/>
|
---|
34 |
|
---|
35 | <xsl:strip-space elements="*"/>
|
---|
36 |
|
---|
37 | <!--
|
---|
38 | // parameters
|
---|
39 | /////////////////////////////////////////////////////////////////////////////
|
---|
40 | -->
|
---|
41 |
|
---|
42 | <!-- Name of the application to generate the RGS script for -->
|
---|
43 | <xsl:param name="Application"/>
|
---|
44 | <!-- Name of the module to generate the RGS script for -->
|
---|
45 | <xsl:param name="Module"/>
|
---|
46 |
|
---|
47 |
|
---|
48 | <!--
|
---|
49 | // templates
|
---|
50 | /////////////////////////////////////////////////////////////////////////////
|
---|
51 | -->
|
---|
52 |
|
---|
53 | <!--
|
---|
54 | * header
|
---|
55 | -->
|
---|
56 | <xsl:template match="/idl">
|
---|
57 | <xsl:apply-templates/>
|
---|
58 | </xsl:template>
|
---|
59 |
|
---|
60 |
|
---|
61 | <!--
|
---|
62 | * libraries
|
---|
63 | -->
|
---|
64 | <xsl:template match="library">
|
---|
65 | <xsl:apply-templates/>
|
---|
66 | </xsl:template>
|
---|
67 |
|
---|
68 |
|
---|
69 | <!--
|
---|
70 | * applications
|
---|
71 | -->
|
---|
72 | <xsl:template match="application">
|
---|
73 | <xsl:if test="@name=$Application">
|
---|
74 | <xsl:variable name="context" select="//module[@name=$Module]/@context"/>
|
---|
75 | <xsl:text>HKCR
|
---|
76 | {
|
---|
77 | NoRemove AppID
|
---|
78 | {
|
---|
79 | ForceRemove {</xsl:text><xsl:value-of select="@uuid"/>} = s '<xsl:value-of select="@name"/><xsl:text> </xsl:text>
|
---|
80 | <xsl:choose>
|
---|
81 | <xsl:when test="$context='LocalService'">
|
---|
82 | <xsl:text>Service</xsl:text>
|
---|
83 | </xsl:when>
|
---|
84 | <xsl:otherwise>
|
---|
85 | <xsl:text>Application</xsl:text>
|
---|
86 | </xsl:otherwise>
|
---|
87 | </xsl:choose>
|
---|
88 | <xsl:text>'
|
---|
89 | </xsl:text>
|
---|
90 | <xsl:if test="$context='LocalService'">
|
---|
91 | <xsl:text> {
|
---|
92 | val LocalService = s '</xsl:text><xsl:value-of select="$Module"/><xsl:text>'
|
---|
93 | }
|
---|
94 | </xsl:text>
|
---|
95 | </xsl:if>
|
---|
96 | <xsl:text> '</xsl:text><xsl:value-of select="$Module"/>
|
---|
97 | <xsl:choose>
|
---|
98 | <xsl:when test="$context='InprocServer'">
|
---|
99 | <xsl:text>.dll</xsl:text>
|
---|
100 | </xsl:when>
|
---|
101 | <xsl:otherwise>
|
---|
102 | <xsl:text>.exe</xsl:text>
|
---|
103 | </xsl:otherwise>
|
---|
104 | </xsl:choose>
|
---|
105 | <xsl:text>'
|
---|
106 | {
|
---|
107 | val AppID = s '{</xsl:text><xsl:value-of select="//library/application[@name=$Application]/@uuid"/><xsl:text>}'
|
---|
108 | }
|
---|
109 | }
|
---|
110 |
|
---|
111 | </xsl:text>
|
---|
112 | <xsl:apply-templates select="module[@name=$Module]/class"/>
|
---|
113 | <xsl:text>}
|
---|
114 | </xsl:text>
|
---|
115 | </xsl:if>
|
---|
116 | </xsl:template>
|
---|
117 |
|
---|
118 |
|
---|
119 | <!--
|
---|
120 | * classes
|
---|
121 | -->
|
---|
122 | <xsl:template match="library//module/class">
|
---|
123 | <xsl:variable name="cname" select="concat(//library/application/@name,'.',@name)"/>
|
---|
124 | <xsl:variable name="desc" select="concat(@name,' Class')"/>
|
---|
125 | <xsl:text> </xsl:text>
|
---|
126 | <xsl:value-of select="concat($cname,'.1')"/> = s '<xsl:value-of select="$desc"/>'
|
---|
127 | {
|
---|
128 | CLSID = s '{<xsl:value-of select="@uuid"/>}'
|
---|
129 | }
|
---|
130 | <xsl:value-of select="$cname"/> = s '<xsl:value-of select="$desc"/>'
|
---|
131 | {
|
---|
132 | CLSID = s '{<xsl:value-of select="@uuid"/>}'
|
---|
133 | CurVer = s '<xsl:value-of select="concat($cname,'.1')"/>'
|
---|
134 | }
|
---|
135 | NoRemove CLSID
|
---|
136 | {
|
---|
137 | ForceRemove {<xsl:value-of select="@uuid"/>} = s '<xsl:value-of select="$desc"/>'
|
---|
138 | {
|
---|
139 | val AppID = s '{<xsl:value-of select="//library/application[@name=$Application]/@uuid"/><xsl:text>}'
|
---|
140 | </xsl:text>
|
---|
141 | <xsl:if test="../@context!='LocalService'">
|
---|
142 | <xsl:text> ProgID = s '</xsl:text><xsl:value-of select="concat($cname,'.1')"/><xsl:text>'
|
---|
143 | VersionIndependentProgID = s '</xsl:text><xsl:value-of select="$cname"/><xsl:text>'
|
---|
144 | </xsl:text>
|
---|
145 | <xsl:choose>
|
---|
146 | <xsl:when test="../@context='InprocServer'">InprocServer32</xsl:when>
|
---|
147 | <xsl:when test="../@context='LocalServer'">LocalServer32</xsl:when>
|
---|
148 | <xsl:otherwise>
|
---|
149 | <xsl:message terminate="yes">
|
---|
150 | <xsl:value-of select="concat(../../@name,'::',../@name,': ')"/>
|
---|
151 | <xsl:text>module context </xsl:text>
|
---|
152 | <xsl:value-of select="concat('"',../@context,'"')"/>
|
---|
153 | <xsl:text> is invalid!</xsl:text>
|
---|
154 | </xsl:message>
|
---|
155 | </xsl:otherwise>
|
---|
156 | </xsl:choose><xsl:text> = s '%MODULE%'
|
---|
157 | </xsl:text>
|
---|
158 | <xsl:if test="../@context='InprocServer'">
|
---|
159 | <xsl:variable name="tmodel" select="(./@threadingModel | ../@threadingModel)[last()]"/><xsl:text> {
|
---|
160 | val ThreadingModel = s '</xsl:text>
|
---|
161 | <xsl:choose>
|
---|
162 | <xsl:when test="$tmodel='Apartment'">Apartment</xsl:when>
|
---|
163 | <xsl:when test="$tmodel='Free'">Free</xsl:when>
|
---|
164 | <xsl:when test="$tmodel='Both'">Both</xsl:when>
|
---|
165 | <xsl:when test="$tmodel='Neutral'">Neutral</xsl:when>
|
---|
166 | <xsl:when test="$tmodel='Single'">Single</xsl:when>
|
---|
167 | <xsl:when test="$tmodel='Rental'">Rental</xsl:when>
|
---|
168 | <xsl:otherwise>
|
---|
169 | <xsl:message terminate="yes">
|
---|
170 | <xsl:value-of select="concat(../../@name,'::',@name,': ')"/>
|
---|
171 | <xsl:text>class (or module) threading model </xsl:text>
|
---|
172 | <xsl:value-of select="concat('"',$tmodel,'"')"/>
|
---|
173 | <xsl:text> is invalid!</xsl:text>
|
---|
174 | </xsl:message>
|
---|
175 | </xsl:otherwise>
|
---|
176 | </xsl:choose><xsl:text>'
|
---|
177 | }
|
---|
178 | </xsl:text>
|
---|
179 | </xsl:if>
|
---|
180 | <xsl:text> TypeLib = s '{</xsl:text><xsl:value-of select="//library/@uuid"/><xsl:text>}'
|
---|
181 | </xsl:text>
|
---|
182 | </xsl:if>
|
---|
183 | <xsl:text> }
|
---|
184 | }
|
---|
185 | </xsl:text>
|
---|
186 | </xsl:template>
|
---|
187 |
|
---|
188 |
|
---|
189 | <!--
|
---|
190 | * eat everything else not explicitly matched
|
---|
191 | -->
|
---|
192 | <xsl:template match="*">
|
---|
193 | </xsl:template>
|
---|
194 |
|
---|
195 |
|
---|
196 | </xsl:stylesheet>
|
---|