you can redistribute it and/or modify it under the terms of the GNU General Public License (GPL) as published by the Free Software Foundation, in version 2 as it comes in the "COPYING" file of the VirtualBox OSE distribution. VirtualBox OSE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa additional information or have any questions. <
xsl:
stylesheet version="1.0"<
xsl:
output method="text"/>
<
xsl:
strip-
space elements="*"/>
<
xsl:
param name="mode" expr=''/>
//////////////////////////////////////////////////////////////////////////////// * Extract the specified value and assign it to an enum member with the given <
xsl:
template name="defineEnumMember">
<
xsl:
param name="member"/>
<
xsl:
param name="select"/>
<
xsl:
value-
of select="concat($member, ' = ', $select, ',
')"/>
//////////////////////////////////////////////////////////////////////////////// * shut down all implicit templates <
xsl:
template match="*"/>
<
xsl:
template match="*" mode="declare"/>
<
xsl:
template match="*" mode="define"/>
<
xsl:
when test="$mode='declare'">
<
xsl:
apply-
templates select="/" mode="declare"/>
<
xsl:
when test="$mode='define'">
<
xsl:
apply-
templates select="/" mode="define"/>
<
xsl:
message terminate="yes">
Value '<
xsl:
value-
of select="$mode"/>' of parameter 'mode' is invalid!
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * declare mode (C++ header file) * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <
xsl:
template match="/" mode="declare">
* This header is automatically generated from the VirtualBox XML Settings
* Schema and contains selected schema constraints declared in C++.
<
xsl:
apply-
templates select="xsd:schema" mode="declare.enum"/>
<
xsl:
apply-
templates select="xsd:schema" mode="declare"/>
#endif // ____H_SCHEMADEFS
<!-- process include statements --> <
xsl:
for-
each select="xsd:include">
<
xsl:
apply-
templates select="document(@schemaLocation)/xsd:schema" mode="declare.enum"/>
<
xsl:
call-
template name="defineEnumMember">
<
xsl:
with-
param name="member" select="' MinGuestRAM'"/>
<
xsl:
with-
param name="select" select=" xsd:complexType[@name='TMemory']/xsd:attribute[@name='RAMSize']//xsd:minInclusive/@value <
xsl:
call-
template name="defineEnumMember">
<
xsl:
with-
param name="member" select="' MaxGuestRAM'"/>
<
xsl:
with-
param name="select" select=" xsd:complexType[@name='TMemory']/xsd:attribute[@name='RAMSize']//xsd:maxInclusive/@value <
xsl:
call-
template name="defineEnumMember">
<
xsl:
with-
param name="member" select="' MinGuestVRAM'"/>
<
xsl:
with-
param name="select" select=" xsd:complexType[@name='TDisplay']/xsd:attribute[@name='VRAMSize']//xsd:minInclusive/@value <
xsl:
call-
template name="defineEnumMember">
<
xsl:
with-
param name="member" select="' MaxGuestVRAM'"/>
<
xsl:
with-
param name="select" select=" xsd:complexType[@name='TDisplay']/xsd:attribute[@name='VRAMSize']//xsd:maxInclusive/@value <
xsl:
call-
template name="defineEnumMember">
<
xsl:
with-
param name="member" select="' MinCPUCount'"/>
<
xsl:
with-
param name="select" select=" xsd:complexType[@name='TCPUCount']/xsd:attribute[@name='count']//xsd:minInclusive/@value <
xsl:
call-
template name="defineEnumMember">
<
xsl:
with-
param name="member" select="' MaxCPUCount'"/>
<
xsl:
with-
param name="select" select=" xsd:complexType[@name='TCPUCount']/xsd:attribute[@name='count']//xsd:maxInclusive/@value <
xsl:
call-
template name="defineEnumMember">
<
xsl:
with-
param name="member" select="' MaxGuestMonitors'"/>
<
xsl:
with-
param name="select" select=" xsd:complexType[@name='TDisplay']/xsd:attribute[@name='MonitorCount']//xsd:maxInclusive/@value <
xsl:
call-
template name="defineEnumMember">
<
xsl:
with-
param name="member" select="' NetworkAdapterCount'"/>
<
xsl:
with-
param name="select" select=" xsd:complexType[@name='TNetworkAdapter']/xsd:attribute[@name='slot']//xsd:maxExclusive/@value <
xsl:
call-
template name="defineEnumMember">
<
xsl:
with-
param name="member" select="' SerialPortCount'"/>
<
xsl:
with-
param name="select" select=" xsd:complexType[@name='TUARTPort']/xsd:attribute[@name='slot']//xsd:maxExclusive/@value <
xsl:
call-
template name="defineEnumMember">
<
xsl:
with-
param name="member" select="' ParallelPortCount'"/>
<
xsl:
with-
param name="select" select=" xsd:complexType[@name='TLPTPort']/xsd:attribute[@name='slot']//xsd:maxExclusive/@value <
xsl:
call-
template name="defineEnumMember">
<
xsl:
with-
param name="member" select="' MaxBootPosition'"/>
<
xsl:
with-
param name="select" select=" xsd:complexType[@name='TBoot']//xsd:element[@name='Order']//xsd:attribute[@name='position']//xsd:maxInclusive/@value * aliases (defines) for individual OSTypeIds array elements <
xsl:
template match="xsd:schema" mode="declare">
<
xsl:
text>
 extern const char *OSTypeIds[];
</
xsl:
text>
<
xsl:
text>
 enum { OSTypeId_COUNT = </
xsl:
text>
<
xsl:
value-
of select="count ( xsd:simpleType[@name='TGuestOSType']/xsd:restriction[@base='xsd:string']/xsd:enumeration | document(xsd:include[not(@schemaLocation='VirtualBox-settings-root.xsd')]/@schemaLocation)/xsd:schema/xsd:simpleType[@name='TGuestOSType']/xsd:restriction[@base='xsd:string']/xsd:enumeration <
xsl:
text> };

</
xsl:
text>
xsd:simpleType[@name='TGuestOSType']/xsd:restriction[@base='xsd:string']/xsd:enumeration | document(xsd:include[not(@schemaLocation='VirtualBox-settings-root.xsd')]/@schemaLocation)/xsd:schema/xsd:simpleType[@name='TGuestOSType']/xsd:restriction[@base='xsd:string']/xsd:enumeration <
xsl:
text> #define SchemaDefs_OSTypeId_</
xsl:
text>
<
xsl:
value-
of select="@value"/>
<
xsl:
text> SchemaDefs::OSTypeIds [</
xsl:
text>
<
xsl:
value-
of select="position()-1"/>
<
xsl:
text>]
</
xsl:
text>
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * define mode (C++ source file) * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <
xsl:
template match="/" mode="define">
* This source is automatically generated from the VirtualBox XML Settings
* Schema and contains selected schema constraints defined in C++.
<
xsl:
apply-
templates select="xsd:schema" mode="define"/>
<
xsl:
template match="xsd:schema" mode="define">
<
xsl:
text> const char *OSTypeIds[] =
xsd:simpleType[@name='TGuestOSType']/xsd:restriction[@base='xsd:string']/xsd:enumeration | document(xsd:include[not(@schemaLocation='VirtualBox-settings-root.xsd')]/@schemaLocation)/xsd:schema/xsd:simpleType[@name='TGuestOSType']/xsd:restriction[@base='xsd:string']/xsd:enumeration <
xsl:
value-
of select="@value"/>
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -