Permalink
Browse files

FIX default value. Added warning for inconsistent default value in Va…

…riantDictionary
  • Loading branch information...
1 parent cd970ab commit 06a8b69d88dc98e8079f24efd6aa4dae3233c2dc @AliSoftware committed Aug 27, 2012
Showing with 18 additions and 4 deletions.
  1. +6 −2 Plugins/TemplateInfoStructDef.xcpp
  2. +1 −1 xcpc/xcpc
  3. +11 −1 xcpc/xcpcompiler.xslt
@@ -62,7 +62,11 @@
<!-- Options -->
- <definition name="OptionsList" class="Array" arrayElementClass="OptionsEntry" />
+ <definition name="OptionsList" class="Array" arrayElementClass="OptionsEntry">
+ <arrayEntries>
+ <entry class="textElement" />
+ </arrayEntries>
+ </definition>
<xc:define id="CommonOptionProperties">
<key name="Identifier" localizedString="Identifier" class="String" use="required"/>
@@ -72,7 +76,7 @@
<key name="RequiredOptions" localizedString="Required Options to enabled this option" class="RequiredOptionsType"/>
</xc:define>
- <definition name="OptionsEntry" class="VariantDictionary" default="OptionsEntry_Text">
+ <definition name="OptionsEntry" class="VariantDictionary" default="textElement">
<xc:variants variantKey="Type" localizedString="Type">
<xc:variant variantValue="text" localizedString="Text Field" identifyingKey="Identifier">
<xc:paste idref="CommonOptionProperties" />
View
@@ -29,7 +29,7 @@ if [ $onlyPreprocess ]; then
echo "Failed to preprocess plugin source."
fi
else
- cat "${inputFile}" | /usr/bin/xsltproc "${xsltDir}/xcppreprocessor.xslt" - | /usr/bin/xsltproc "${xsltDir}/xcpcompiler.xslt" - >"${outputFile}"
+ cat "${inputFile}" | /usr/bin/xsltproc "${xsltDir}/xcppreprocessor.xslt" - | /usr/bin/xsltproc -o "${outputFile}" "${xsltDir}/xcpcompiler.xslt" -
if [ $? -eq 0 ]; then
echo "Plugin generated to: ${outputFile}. Please restart Xcode."
else
View
@@ -2,8 +2,9 @@
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:xcpp="urn:X-AliSoftware:xcodeplugin:preprocessor"
- exclude-result-prefixes="xcpp">
+ exclude-result-prefixes="fn xcpp">
<xsl:output method="xml" version="1.0" encoding="UTF-8" standalone="yes"
doctype-public="-//Apple//DTD PLIST 1.0//EN"
@@ -61,6 +62,7 @@
<xsl:copy-of select="." />
<xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
</string>
+ <xsl:apply-templates select="definition" />
</dict>
</xsl:template>
@@ -70,5 +72,13 @@
<string><xsl:value-of select="@pattern" /></string>
</dict>
</xsl:template>
+
+<xsl:template match="definition[@class='VariantDictionary']">
+ <xsl:if test="count(../definition[@name=current()/@default]) != 1">
+ <xsl:message> Warning: definition for VariantDictionary '<xsl:value-of select="@name" />' has invalid default value '<xsl:value-of select="@default" />'.
+ Note that VariantDictionaries generated using &lt;xc:variants&gt; preprocessor tag have names build by appending 'Element' at the end of the corresponding variantValue
+ </xsl:message>
+ </xsl:if>
+</xsl:template>
</xsl:stylesheet>

0 comments on commit 06a8b69

Please sign in to comment.