Adds Relax NG Compact syntax grammars for most of the XML formats in the engine.

Adds converted Relax NG XML grammars for each (Note: don't edit these
directly, modify the compact syntax .rnc files instead, then use a
conversion tool http://relaxng.org/#conversion to generate the .rng
files).
Adds Perl script to validate the XML files using the new grammars

This was SVN commit r15377.
This commit is contained in:
historic_bruno 2014-06-17 03:31:40 +00:00
parent d11e48cd85
commit 2c9939ac74
26 changed files with 2840 additions and 205 deletions

View File

@ -0,0 +1,68 @@
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
##
# NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
# and use a converter tool like trang to generate the Relax NG XML (.rng) file
##
element actor {
attribute version { xsd:positiveInteger }, (
element group {
element variant {
attribute name { text }? &
attribute frequency { xsd:nonNegativeInteger }? &
element mesh {
text
}? &
element textures {
element texture {
attribute file { text }? &
attribute name { text }
}*
}? &
element decal {
attribute width { xsd:float } & # X
attribute depth { xsd:float } & # Z
attribute angle { xsd:float } &
attribute offsetx { xsd:float } &
attribute offsetz { xsd:float }
}? &
element particles {
attribute file { text }
}? &
element colour { list {
xsd:nonNegativeInteger, # R
xsd:nonNegativeInteger, # G
xsd:nonNegativeInteger # B
} }? &
element animations {
element animation {
attribute name { text } &
attribute file { text }? &
attribute speed { xsd:nonNegativeInteger } &
attribute event { xsd:decimal { minInclusive = "0" maxInclusive = "1" } }? &
attribute load { xsd:decimal { minInclusive = "0" maxInclusive = "1" } }? &
attribute sound { xsd:decimal { minInclusive = "0" maxInclusive = "1" } }?
}*
}? &
element props {
element prop {
(attribute actor { text }? &
attribute attachpoint { text } &
attribute minheight { xsd:float }? &
attribute maxheight { xsd:float }? &
attribute selectable { "true" | "false" }?)
}*
}?
}*
}* &
element castshadow { # flag; true if present
empty
}? &
element float { # flag; true if present
empty
}? &
element material {
text
}?
)
}

View File

@ -0,0 +1,183 @@
<?xml version="1.0" encoding="UTF-8"?>
<element name="actor" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<a:documentation/>
<!--
NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
and use a converter tool like trang to generate the Relax NG XML (.rng) file
-->
<a:documentation/>
<attribute name="version">
<data type="positiveInteger"/>
</attribute>
<interleave>
<zeroOrMore>
<element name="group">
<zeroOrMore>
<element name="variant">
<interleave>
<optional>
<attribute name="name"/>
</optional>
<optional>
<attribute name="frequency">
<data type="nonNegativeInteger"/>
</attribute>
</optional>
<optional>
<element name="mesh">
<text/>
</element>
</optional>
<optional>
<element name="textures">
<zeroOrMore>
<element name="texture">
<interleave>
<optional>
<attribute name="file"/>
</optional>
<attribute name="name"/>
</interleave>
</element>
</zeroOrMore>
</element>
</optional>
<optional>
<element name="decal">
<interleave>
<attribute name="width">
<data type="float"/>
</attribute>
<!-- X -->
<attribute name="depth">
<data type="float"/>
</attribute>
<!-- Z -->
<attribute name="angle">
<data type="float"/>
</attribute>
<attribute name="offsetx">
<data type="float"/>
</attribute>
<attribute name="offsetz">
<data type="float"/>
</attribute>
</interleave>
</element>
</optional>
<optional>
<element name="particles">
<attribute name="file"/>
</element>
</optional>
<optional>
<element name="colour">
<list>
<group>
<data type="nonNegativeInteger"/>
<!-- R -->
<data type="nonNegativeInteger"/>
<!-- G -->
<data type="nonNegativeInteger"/>
</group>
<!-- B -->
</list>
</element>
</optional>
<optional>
<element name="animations">
<zeroOrMore>
<element name="animation">
<interleave>
<attribute name="name"/>
<optional>
<attribute name="file"/>
</optional>
<attribute name="speed">
<data type="nonNegativeInteger"/>
</attribute>
<optional>
<attribute name="event">
<data type="decimal">
<param name="minInclusive">0</param>
<param name="maxInclusive">1</param>
</data>
</attribute>
</optional>
<optional>
<attribute name="load">
<data type="decimal">
<param name="minInclusive">0</param>
<param name="maxInclusive">1</param>
</data>
</attribute>
</optional>
<optional>
<attribute name="sound">
<data type="decimal">
<param name="minInclusive">0</param>
<param name="maxInclusive">1</param>
</data>
</attribute>
</optional>
</interleave>
</element>
</zeroOrMore>
</element>
</optional>
<optional>
<element name="props">
<zeroOrMore>
<element name="prop">
<interleave>
<optional>
<attribute name="actor"/>
</optional>
<attribute name="attachpoint"/>
<optional>
<attribute name="minheight">
<data type="float"/>
</attribute>
</optional>
<optional>
<attribute name="maxheight">
<data type="float"/>
</attribute>
</optional>
<optional>
<attribute name="selectable">
<choice>
<value>true</value>
<value>false</value>
</choice>
</attribute>
</optional>
</interleave>
</element>
</zeroOrMore>
</element>
</optional>
</interleave>
</element>
</zeroOrMore>
</element>
</zeroOrMore>
<optional>
<element name="castshadow">
<!-- flag; true if present -->
<empty/>
</element>
</optional>
<optional>
<element name="float">
<!-- flag; true if present -->
<empty/>
</element>
</optional>
<optional>
<element name="material">
<text/>
</element>
</optional>
</interleave>
</element>

View File

@ -0,0 +1,42 @@
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
##
# NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
# and use a converter tool like trang to generate the Relax NG XML (.rng) file
##
element material {
element alternative {
attribute material { text } &
attribute quality { xsd:decimal { minInclusive = "0" } }? &
attribute if { text }?
}* &
element alpha_blending { # flag; true if present
empty
}? &
element shader {
attribute effect { text }
} &
element define {
attribute name { text },
attribute value { text }
}* &
element conditional_define {
attribute name { text },
attribute value { text },
attribute type { text },
(attribute conf { text }
| ( attribute min { xsd:float }?, attribute max { xsd:float }? ))
}* &
element uniform {
attribute name { text },
attribute value { list { # X Y Z W
xsd:float,
xsd:float?,
xsd:float?,
xsd:float?
} }
}* &
element renderquery {
attribute name { text }
}*
}

View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<element name="material" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<a:documentation/>
<!--
NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
and use a converter tool like trang to generate the Relax NG XML (.rng) file
-->
<a:documentation/>
<interleave>
<zeroOrMore>
<element name="alternative">
<interleave>
<attribute name="material"/>
<optional>
<attribute name="quality">
<data type="decimal">
<param name="minInclusive">0</param>
</data>
</attribute>
</optional>
<optional>
<attribute name="if"/>
</optional>
</interleave>
</element>
</zeroOrMore>
<optional>
<element name="alpha_blending">
<!-- flag; true if present -->
<empty/>
</element>
</optional>
<element name="shader">
<attribute name="effect"/>
</element>
<zeroOrMore>
<element name="define">
<attribute name="name"/>
<attribute name="value"/>
</element>
</zeroOrMore>
<zeroOrMore>
<element name="conditional_define">
<attribute name="name"/>
<attribute name="value"/>
<attribute name="type"/>
<choice>
<attribute name="conf"/>
<group>
<optional>
<attribute name="min">
<data type="float"/>
</attribute>
</optional>
<optional>
<attribute name="max">
<data type="float"/>
</attribute>
</optional>
</group>
</choice>
</element>
</zeroOrMore>
<zeroOrMore>
<element name="uniform">
<attribute name="name"/>
<attribute name="value">
<list>
<!-- X Y Z W -->
<data type="float"/>
<optional>
<data type="float"/>
</optional>
<optional>
<data type="float"/>
</optional>
<optional>
<data type="float"/>
</optional>
</list>
</attribute>
</element>
</zeroOrMore>
<zeroOrMore>
<element name="renderquery">
<attribute name="name"/>
</element>
</zeroOrMore>
</interleave>
</element>

View File

@ -0,0 +1,44 @@
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
##
# NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
# and use a converter tool like trang to generate the Relax NG XML (.rng) file
##
element particles {
element texture {
text
}? &
element blend {
attribute mode { "add" | "subtract" | "over" | "multiply" }
}? &
element start_full { # flag; true if present
empty
}? &
element use_relative_velocity { # flag; true if present
empty
}? &
element constant {
attribute name { text } &
attribute value { xsd:float }
}* &
element uniform {
attribute name { text } &
attribute min { xsd:float } &
attribute max { xsd:float }
}* &
element copy {
attribute name { text } &
attribute from { text }
}* &
element expr {
attribute name { text } &
attribute from { text } &
attribute mul { xsd:float } &
attribute max { xsd:float }
}* &
element force {
attribute x { xsd:float }? &
attribute y { xsd:float }? &
attribute z { xsd:float }?
}*
}

View File

@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<element name="particles" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<a:documentation/>
<!--
NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
and use a converter tool like trang to generate the Relax NG XML (.rng) file
-->
<a:documentation/>
<interleave>
<optional>
<element name="texture">
<text/>
</element>
</optional>
<optional>
<element name="blend">
<attribute name="mode">
<choice>
<value>add</value>
<value>subtract</value>
<value>over</value>
<value>multiply</value>
</choice>
</attribute>
</element>
</optional>
<optional>
<element name="start_full">
<!-- flag; true if present -->
<empty/>
</element>
</optional>
<optional>
<element name="use_relative_velocity">
<!-- flag; true if present -->
<empty/>
</element>
</optional>
<zeroOrMore>
<element name="constant">
<interleave>
<attribute name="name"/>
<attribute name="value">
<data type="float"/>
</attribute>
</interleave>
</element>
</zeroOrMore>
<zeroOrMore>
<element name="uniform">
<interleave>
<attribute name="name"/>
<attribute name="min">
<data type="float"/>
</attribute>
<attribute name="max">
<data type="float"/>
</attribute>
</interleave>
</element>
</zeroOrMore>
<zeroOrMore>
<element name="copy">
<interleave>
<attribute name="name"/>
<attribute name="from"/>
</interleave>
</element>
</zeroOrMore>
<zeroOrMore>
<element name="expr">
<interleave>
<attribute name="name"/>
<attribute name="from"/>
<attribute name="mul">
<data type="float"/>
</attribute>
<attribute name="max">
<data type="float"/>
</attribute>
</interleave>
</element>
</zeroOrMore>
<zeroOrMore>
<element name="force">
<interleave>
<optional>
<attribute name="x">
<data type="float"/>
</attribute>
</optional>
<optional>
<attribute name="y">
<data type="float"/>
</attribute>
</optional>
<optional>
<attribute name="z">
<data type="float"/>
</attribute>
</optional>
</interleave>
</element>
</zeroOrMore>
</interleave>
</element>

View File

@ -0,0 +1,21 @@
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
##
# NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
# and use a converter tool like trang to generate the Relax NG XML (.rng) file
##
element Terrains {
element Terrain {
attribute groups { text } & # comma-separated list of groups
attribute mmap {
list {
xsd:integer { minInclusive = "0" maxInclusive = "255" }, # R
xsd:integer { minInclusive = "0" maxInclusive = "255" }, # G
xsd:integer { minInclusive = "0" maxInclusive = "255" } # B
}
}? &
attribute angle { xsd:float }? & # degrees
attribute size { xsd:float }? &
attribute movementclass { text }?
}
}

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<element name="Terrains" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<a:documentation/>
<!--
NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
and use a converter tool like trang to generate the Relax NG XML (.rng) file
-->
<a:documentation/>
<element name="Terrain">
<interleave>
<attribute name="groups"/>
<optional>
<!-- comma-separated list of groups -->
<attribute name="mmap">
<list>
<group>
<data type="integer">
<param name="minInclusive">0</param>
<param name="maxInclusive">255</param>
</data>
<!-- R -->
<data type="integer">
<param name="minInclusive">0</param>
<param name="maxInclusive">255</param>
</data>
<!-- G -->
<data type="integer">
<param name="minInclusive">0</param>
<param name="maxInclusive">255</param>
</data>
</group>
<!-- B -->
</list>
</attribute>
</optional>
<optional>
<attribute name="angle">
<data type="float"/>
</attribute>
</optional>
<optional>
<!-- degrees -->
<attribute name="size">
<data type="float"/>
</attribute>
</optional>
<optional>
<attribute name="movementclass"/>
</optional>
</interleave>
</element>
</element>

View File

@ -0,0 +1,33 @@
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
##
# NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
# and use a converter tool like trang to generate the Relax NG XML (.rng) file
##
element terrain {
element textures {
element texture {
attribute name { text } &
attribute file { text }
}*
} &
element material {
text
}? &
element alphamap {
text
}? &
element props {
attribute groups { text }? & # comma-separated list of groups
attribute mmap {
list {
xsd:integer { minInclusive = "0" }, # R
xsd:integer { minInclusive = "0" }, # G
xsd:integer { minInclusive = "0" } # B
}
}? &
attribute angle { xsd:float }? & # degrees
attribute size { xsd:float }? &
attribute movementclass { text }?
}*
}

View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<element name="terrain" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<a:documentation/>
<!--
NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
and use a converter tool like trang to generate the Relax NG XML (.rng) file
-->
<a:documentation/>
<interleave>
<element name="textures">
<zeroOrMore>
<element name="texture">
<interleave>
<attribute name="name"/>
<attribute name="file"/>
</interleave>
</element>
</zeroOrMore>
</element>
<optional>
<element name="material">
<text/>
</element>
</optional>
<optional>
<element name="alphamap">
<text/>
</element>
</optional>
<zeroOrMore>
<element name="props">
<interleave>
<optional>
<attribute name="groups"/>
</optional>
<optional>
<!-- comma-separated list of groups -->
<attribute name="mmap">
<list>
<group>
<data type="integer">
<param name="minInclusive">0</param>
</data>
<!-- R -->
<data type="integer">
<param name="minInclusive">0</param>
</data>
<!-- G -->
<data type="integer">
<param name="minInclusive">0</param>
</data>
</group>
<!-- B -->
</list>
</attribute>
</optional>
<optional>
<attribute name="angle">
<data type="float"/>
</attribute>
</optional>
<optional>
<!-- degrees -->
<attribute name="size">
<data type="float"/>
</attribute>
</optional>
<optional>
<attribute name="movementclass"/>
</optional>
</interleave>
</element>
</zeroOrMore>
</interleave>
</element>

View File

@ -0,0 +1,19 @@
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
##
# NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
# and use a converter tool like trang to generate the Relax NG XML (.rng) file
##
element Textures {
element File {
attribute pattern { text }? &
attribute format { "dxt1" | "dxt3" | "dxt5" | "rgba" | "alpha" }? &
attribute mipmap { "true" | "false" }? &
attribute normal { "true" | "false" }? &
attribute alpha { "none" | "player" | "transparency" }? &
attribute filter { "box" | "triangle" | "kaiser" }? &
attribute kaiserwidth { xsd:float }? &
attribute kaiseralpha { xsd:float }? &
attribute kaiserstretch { xsd:float }?
}*
}

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<element name="Textures" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<a:documentation/>
<!--
NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
and use a converter tool like trang to generate the Relax NG XML (.rng) file
-->
<a:documentation/>
<zeroOrMore>
<element name="File">
<interleave>
<optional>
<attribute name="pattern"/>
</optional>
<optional>
<attribute name="format">
<choice>
<value>dxt1</value>
<value>dxt3</value>
<value>dxt5</value>
<value>rgba</value>
<value>alpha</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="mipmap">
<choice>
<value>true</value>
<value>false</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="normal">
<choice>
<value>true</value>
<value>false</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="alpha">
<choice>
<value>none</value>
<value>player</value>
<value>transparency</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="filter">
<choice>
<value>box</value>
<value>triangle</value>
<value>kaiser</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="kaiserwidth">
<data type="float"/>
</attribute>
</optional>
<optional>
<attribute name="kaiseralpha">
<data type="float"/>
</attribute>
</optional>
<optional>
<attribute name="kaiserstretch">
<data type="float"/>
</attribute>
</optional>
</interleave>
</element>
</zeroOrMore>
</element>

View File

@ -0,0 +1,37 @@
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
##
# NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
# and use a converter tool like trang to generate the Relax NG XML (.rng) file
##
##
# Types #
##
flag = "0" | "1"
start = SoundGroup
SoundGroup = element SoundGroup {
element Gain { xsd:float }? &
element Looping { flag }? &
element Omnipresent { flag }? &
element HeardBy { "owner" }? &
element Distanceless { flag }? &
element Pitch { xsd:float }? &
element Priority { xsd:float }? &
element RandOrder { flag }? &
element RandGain { flag }? &
element GainUpper { xsd:float }? &
element GainLower { xsd:float }? &
element RandPitch { flag }? &
element PitchUpper { xsd:float }? &
element PitchLower { xsd:float }? &
element ConeGain { xsd:float }? &
element ConeInner { xsd:float }? &
element ConeOuter { xsd:float }? &
element Replacement { text }? &
element Threshold { xsd:float }? &
element Decay { xsd:float }? &
element Sound { text }+ &
element Path { text }
}

View File

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<define name="flag">
<a:documentation/>
<!--
NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
and use a converter tool like trang to generate the Relax NG XML (.rng) file
-->
<a:documentation/>
<a:documentation/>
<!-- Types # -->
<a:documentation/>
<choice>
<value>0</value>
<value>1</value>
</choice>
</define>
<start>
<ref name="SoundGroup"/>
</start>
<define name="SoundGroup">
<element name="SoundGroup">
<interleave>
<optional>
<element name="Gain">
<data type="float"/>
</element>
</optional>
<optional>
<element name="Looping">
<ref name="flag"/>
</element>
</optional>
<optional>
<element name="Omnipresent">
<ref name="flag"/>
</element>
</optional>
<optional>
<element name="HeardBy">
<value>owner</value>
</element>
</optional>
<optional>
<element name="Distanceless">
<ref name="flag"/>
</element>
</optional>
<optional>
<element name="Pitch">
<data type="float"/>
</element>
</optional>
<optional>
<element name="Priority">
<data type="float"/>
</element>
</optional>
<optional>
<element name="RandOrder">
<ref name="flag"/>
</element>
</optional>
<optional>
<element name="RandGain">
<ref name="flag"/>
</element>
</optional>
<optional>
<element name="GainUpper">
<data type="float"/>
</element>
</optional>
<optional>
<element name="GainLower">
<data type="float"/>
</element>
</optional>
<optional>
<element name="RandPitch">
<ref name="flag"/>
</element>
</optional>
<optional>
<element name="PitchUpper">
<data type="float"/>
</element>
</optional>
<optional>
<element name="PitchLower">
<data type="float"/>
</element>
</optional>
<optional>
<element name="ConeGain">
<data type="float"/>
</element>
</optional>
<optional>
<element name="ConeInner">
<data type="float"/>
</element>
</optional>
<optional>
<element name="ConeOuter">
<data type="float"/>
</element>
</optional>
<optional>
<element name="Replacement">
<text/>
</element>
</optional>
<optional>
<element name="Threshold">
<data type="float"/>
</element>
</optional>
<optional>
<element name="Decay">
<data type="float"/>
</element>
</optional>
<oneOrMore>
<element name="Sound">
<text/>
</element>
</oneOrMore>
<element name="Path">
<text/>
</element>
</interleave>
</element>
</define>
</grammar>

View File

@ -1,205 +0,0 @@
<!--
Types
-->
<!ENTITY % bool "(true|false)">
<!ENTITY % align "(left|center|right)">
<!ENTITY % valign "(top|center|bottom)">
<!--
Defines
-->
<!ENTITY % unique_settings
"name CDATA #IMPLIED
type CDATA 'empty'
style CDATA #IMPLIED"
>
<!ENTITY % base_settings
"absolute %bool; #IMPLIED
enabled %bool; #IMPLIED
ghost %bool; #IMPLIED
hidden %bool; #IMPLIED
size CDATA #IMPLIED
z CDATA #IMPLIED"
>
<!-- Defaults are not put in here, because it ruins the concept of styles -->
<!ENTITY % ex_settings
"buffer_zone CDATA #IMPLIED
button_width CDATA #IMPLIED
checked %bool; #IMPLIED
dropdown_size CDATA #IMPLIED
dropdown_buffer CDATA #IMPLIED
font CDATA #IMPLIED
fov_wedge_color CDATA #IMPLIED
hotkey CDATA #IMPLIED
cell_id CDATA #IMPLIED
input_initvalue_destroyed_at_focus %bool; #IMPLIED
max_length CDATA #IMPLIED
multiline %bool; #IMPLIED
rectcolor_selected CDATA #IMPLIED
scrollbar %bool; #IMPLIED
scrollbar_style CDATA #IMPLIED
sprite CDATA #IMPLIED
sprite2 CDATA #IMPLIED
sprite_bar CDATA #IMPLIED
sprite_background CDATA #IMPLIED
sprite_disabled CDATA #IMPLIED
sprite_list CDATA #IMPLIED
sprite2_disabled CDATA #IMPLIED
sprite_over CDATA #IMPLIED
sprite2_over CDATA #IMPLIED
sprite_pressed CDATA #IMPLIED
sprite2_pressed CDATA #IMPLIED
sprite_selectarea CDATA #IMPLIED
sprite_heading CDATA #IMPLIED
square_side CDATA #IMPLIED
textcolor CDATA #IMPLIED
textcolor_disabled CDATA #IMPLIED
textcolor_over CDATA #IMPLIED
textcolor_pressed CDATA #IMPLIED
textcolor_selected CDATA #IMPLIED
text_align %align; #IMPLIED
text_valign %valign; #IMPLIED
tooltip CDATA #IMPLIED
tooltip_style CDATA #IMPLIED"
>
<!--
<objects>
-->
<!ELEMENT objects (script|object)*>
<!ELEMENT script (#PCDATA)>
<!ATTLIST script
file CDATA #IMPLIED
>
<!ELEMENT object (#PCDATA|object|action|item)*> <!-- 'item' is used by "list" and "dropdown" -->
<!ATTLIST object
%unique_settings;
%base_settings;
%ex_settings;
>
<!ELEMENT action (#PCDATA)>
<!ATTLIST action
on CDATA #REQUIRED
file CDATA #IMPLIED
>
<!ELEMENT item (#PCDATA)>
<!ATTLIST item
enabled %bool; #IMPLIED
>
<!--
<styles>
-->
<!ELEMENT styles (style*)>
<!ELEMENT style EMPTY>
<!ATTLIST style
name CDATA #REQUIRED
%base_settings;
%ex_settings;
>
<!--
<setup>
-->
<!ELEMENT setup (icon|scrollbar|tooltip|color)*>
<!ELEMENT scrollbar EMPTY>
<!ELEMENT icon EMPTY>
<!ELEMENT tooltip EMPTY>
<!ELEMENT color (#PCDATA)>
<!--
<scrollbar>
-->
<!ATTLIST scrollbar
name CDATA #REQUIRED
width CDATA #IMPLIED
scroll_wheel %bool; #IMPLIED
show_edge_buttons %bool; #REQUIRED
scroll_speed CDATA #IMPLIED
sprite_button_top CDATA #IMPLIED
sprite_button_top_pressed CDATA #IMPLIED
sprite_button_top_disabled CDATA #IMPLIED
sprite_button_top_over CDATA #IMPLIED
sprite_button_bottom CDATA #IMPLIED
sprite_button_bottom_pressed CDATA #IMPLIED
sprite_button_bottom_disabled CDATA #IMPLIED
sprite_button_bottom_over CDATA #IMPLIED
sprite_bar_vertical CDATA #IMPLIED
sprite_bar_vertical_over CDATA #IMPLIED
sprite_bar_vertical_pressed CDATA #IMPLIED
sprite_back_vertical CDATA #IMPLIED
minimum_bar_size CDATA #IMPLIED
maximum_bar_size CDATA #IMPLIED
>
<!--
<icon>
-->
<!ATTLIST icon
name CDATA #REQUIRED
size CDATA #REQUIRED
sprite CDATA #REQUIRED
cell_id CDATA #IMPLIED
>
<!--
<tooltip>
-->
<!ATTLIST tooltip
name CDATA #REQUIRED
sprite CDATA #IMPLIED
anchor CDATA #IMPLIED
buffer_zone CDATA #IMPLIED
font CDATA #IMPLIED
maxwidth CDATA #IMPLIED
offset CDATA #IMPLIED
textcolor CDATA #IMPLIED
delay CDATA #IMPLIED
use_object CDATA #IMPLIED
hide_object CDATA #IMPLIED
>
<!--
<color>
-->
<!ATTLIST color
name CDATA #REQUIRED
>
<!--
<sprites>
-->
<!ELEMENT sprites (sprite*)>
<!ELEMENT sprite (effect?,image+)>
<!ELEMENT image (effect?)>
<!ELEMENT effect EMPTY>
<!ATTLIST sprite
name CDATA #REQUIRED
>
<!ATTLIST image
texture CDATA #IMPLIED
size CDATA #IMPLIED
texture_size CDATA #IMPLIED
real_texture_placement CDATA #IMPLIED
cell_size CDATA #IMPLIED
backcolor CDATA #IMPLIED
bordercolor CDATA #IMPLIED
border %bool; #IMPLIED
z_level CDATA #IMPLIED
>
<!ATTLIST effect
add_color CDATA #IMPLIED
multiply_color CDATA #IMPLIED
grayscale CDATA #IMPLIED
>

View File

@ -0,0 +1,272 @@
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
##
# NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
# and use a converter tool like trang to generate the Relax NG XML (.rng) file
##
start = objects | setup | sprites | styles
##
# Types #
##
# xsd:boolean could be used instead of this definition,
# though it considers "1" & "0" as valid values.
bool = "true" | "false"
align = "left" | "center" | "right"
valign = "top" | "center" | "bottom"
wrapmode = "repeat" | "mirrored_repeat" | "clamp_to_edge"
coord = xsd:string { pattern = "-?\d*\.?\d+(%([\+\-]\d*\.?\d+)?)?" }
clientarea = list { coord, coord, coord, coord }
# color can be a name or "R G B A" format string
rgba = list { xsd:integer { minInclusive = "0" maxInclusive = "255" },
xsd:integer { minInclusive = "0" maxInclusive = "255" },
xsd:integer { minInclusive = "0" maxInclusive = "255" },
xsd:integer { minInclusive = "0" maxInclusive = "255" }?}
ccolor = rgba | xsd:string { pattern = "[A-Za-z]+" }
size = list { xsd:decimal, xsd:decimal }
pos = list { xsd:decimal, xsd:decimal }
rect = list { xsd:decimal, xsd:decimal, xsd:decimal, xsd:decimal }
##
# Defines #
##
unique_settings =
attribute name { text }?,
[ a:defaultValue = "empty" ] attribute type { text }?,
attribute style { text }?
# This could probably be made more specific/strict
# with more information regarding the use/meaning
# of these attributes.
base_settings =
attribute absolute { bool }?&
attribute enable { bool }?&
attribute ghost { bool }?&
attribute hidden { bool }?&
attribute size { clientarea }?&
attribute z { xsd:decimal }?
# Defaults are not put in here, because it ruins the concept of styles.
ex_settings =
attribute anchor { valign }?&
attribute buffer_zone { xsd:decimal }?&
attribute buffer_width { xsd:decimal }?&
attribute button_width { xsd:decimal }?&
attribute checked { bool }?&
attribute clip { bool }?&
attribute dropdown_size { xsd:decimal }?&
attribute dropdown_buffer { xsd:decimal }?&
attribute enabled { bool }?&
attribute font { text }?&
attribute fov_wedge_color { ccolor }?&
attribute hotkey { text }?&
attribute cell_id { xsd:integer }?&
attribute independent { bool }?&
attribute input_initvalue_destroyed_at_focus { bool }?&
attribute mask { bool }?&
attribute mask_char { xsd:string { minLength = "1" maxLength = "1" } }?&
attribute max_length { xsd:nonNegativeInteger }?&
attribute maxwidth { xsd:decimal }? &
attribute multiline { bool }?&
attribute offset { pos }?&
attribute scrollbar { bool }?&
attribute scrollbar_style { text }?&
attribute scroll_bottom { bool }?&
attribute sound_closed { text }?&
attribute sound_disabled { text }?&
attribute sound_enter { text }?&
attribute sound_leave { text }?&
attribute sound_opened { text }?&
attribute sound_pressed { text }?&
attribute sound_selected { text }?&
attribute sprite { text }?&
attribute sprite2 { text }?&
attribute sprite_heading { text }?&
attribute sprite_bar { text }?&
attribute sprite_background { text }?&
attribute sprite_disabled { text }?&
attribute sprite_list { text }?&
attribute sprite2_disabled { text }?&
attribute sprite_over { text }?&
attribute sprite2_over { text }?&
attribute sprite_pressed { text }?&
attribute sprite2_pressed { text }?&
attribute sprite_selectarea { text }?&
attribute square_side { xsd:decimal }?&
attribute textcolor { ccolor }?&
attribute textcolor_disabled { ccolor }?&
attribute textcolor_over { ccolor }?&
attribute textcolor_pressed { ccolor }?&
attribute textcolor_selected { ccolor }?&
attribute text_align { align }?&
attribute text_valign { valign }?&
attribute tooltip { text }?&
attribute tooltip_style { text }?
##
# Objects #
##
objects = element objects { (script | object)* }
script =
element script {
text &
attribute file { text }? &
attribute directory { text }?
}
object =
element object {
((object
| action
| \attribute
| def
| \include
| item
| repeat
| translatableAttribute)*
| text),
unique_settings,
base_settings,
ex_settings
}
action =
element action {
text,
attribute on { text },
attribute file { text }?
}
\attribute =
element attribute {
(keep | translate)*,
attribute id { text }
}
def =
element def {
translatableAttribute?,
(
attribute id { text }&
attribute color { ccolor }?&
attribute heading { text }?&
attribute width { text }?
)
}
\include =
element include {
attribute file { text }
}
item =
element item {
text,
attribute enabled { bool }?
}
keep = element keep { text }
repeat =
element repeat {
object+,
attribute count { text }
}
translate = element translate { text }
translatableAttribute =
element translatableAttribute {
text,
(
attribute id { text }&
attribute comment { text }?&
attribute context { text }?
)
}
##
# Styles #
##
styles = element styles { style* }
style =
element style {
attribute name { text },
base_settings,
ex_settings
}
##
# Setup #
##
setup = element setup { (icon | scrollbar | tooltip | color)* }
scrollbar =
element scrollbar {
attribute name { text }&
attribute width { xsd:decimal }&
attribute alwaysshown { bool }?&
attribute maximum_bar_size { xsd:decimal }?&
attribute minimum_bar_size { xsd:decimal }?&
attribute scroll_wheel { bool }?&
attribute show_edge_buttons { bool }?&
attribute sprite_button_top { text }?&
attribute sprite_button_top_pressed { text }?&
attribute sprite_button_top_disabled { text }?&
attribute sprite_button_top_over { text }?&
attribute sprite_button_bottom { text }?&
attribute sprite_button_bottom_pressed { text }?&
attribute sprite_button_bottom_disabled { text }?&
attribute sprite_button_bottom_over { text }?&
attribute sprite_bar_vertical { text }?&
attribute sprite_bar_vertical_over { text }?&
attribute sprite_bar_vertical_pressed { text }?&
attribute sprite_back_vertical { text }?
}
icon =
element icon {
attribute name { text }&
attribute size { size }&
attribute sprite { text }&
attribute cell_id { text }?
}
tooltip =
element tooltip {
attribute name { text }&
attribute sprite { text }?&
attribute anchor { valign }?&
attribute buffer_zone { xsd:decimal }?&
attribute font { text }?&
attribute maxwidth { xsd:decimal }?&
attribute offset { pos }?&
attribute textcolor { ccolor }?&
attribute delay { xsd:integer }?&
attribute use_object { text }?&
attribute hide_object { bool }?
}
color =
element color {
rgba,
attribute name { text }
}
##
# Sprites #
##
sprites = element sprites { sprite* }
sprite =
element sprite {
(effect?, image+),
attribute name { text }
}
image =
element image {
effect?,
(
attribute texture { text }?&
attribute size { clientarea }?&
attribute texture_size { clientarea }?&
attribute real_texture_placement { rect }?&
attribute cell_size { size }?&
attribute backcolor { ccolor }?&
attribute bordercolor { ccolor }?&
attribute border { bool }?&
attribute z_level { xsd:float }?&
attribute fixed_h_aspect_ratio { xsd:decimal }?&
attribute round_coordinates { bool }?&
attribute wrap_mode { wrapmode }?
)
}
effect =
element effect {
attribute add_color { ccolor }?,
attribute multiply_color { ccolor }?,
attribute grayscale { empty }?
}

View File

@ -0,0 +1,815 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<start>
<a:documentation/>
<!--
NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
and use a converter tool like trang to generate the Relax NG XML (.rng) file
-->
<a:documentation/>
<choice>
<ref name="objects"/>
<ref name="setup"/>
<ref name="sprites"/>
<ref name="styles"/>
</choice>
</start>
<!--
xsd:boolean could be used instead of this definition,
though it considers "1" & "0" as valid values.
-->
<define name="bool">
<a:documentation/>
<!-- Types # -->
<a:documentation/>
<choice>
<value>true</value>
<value>false</value>
</choice>
</define>
<define name="align">
<choice>
<value>left</value>
<value>center</value>
<value>right</value>
</choice>
</define>
<define name="valign">
<choice>
<value>top</value>
<value>center</value>
<value>bottom</value>
</choice>
</define>
<define name="wrapmode">
<choice>
<value>repeat</value>
<value>mirrored_repeat</value>
<value>clamp_to_edge</value>
</choice>
</define>
<define name="coord">
<data type="string">
<param name="pattern">-?\d*\.?\d+(%([\+\-]\d*\.?\d+)?)?</param>
</data>
</define>
<define name="clientarea">
<list>
<ref name="coord"/>
<ref name="coord"/>
<ref name="coord"/>
<ref name="coord"/>
</list>
</define>
<!-- color can be a name or "R G B A" format string -->
<define name="rgba">
<list>
<data type="integer">
<param name="minInclusive">0</param>
<param name="maxInclusive">255</param>
</data>
<data type="integer">
<param name="minInclusive">0</param>
<param name="maxInclusive">255</param>
</data>
<data type="integer">
<param name="minInclusive">0</param>
<param name="maxInclusive">255</param>
</data>
<optional>
<data type="integer">
<param name="minInclusive">0</param>
<param name="maxInclusive">255</param>
</data>
</optional>
</list>
</define>
<define name="ccolor">
<choice>
<ref name="rgba"/>
<data type="string">
<param name="pattern">[A-Za-z]+</param>
</data>
</choice>
</define>
<define name="size">
<list>
<data type="decimal"/>
<data type="decimal"/>
</list>
</define>
<define name="pos">
<list>
<data type="decimal"/>
<data type="decimal"/>
</list>
</define>
<define name="rect">
<list>
<data type="decimal"/>
<data type="decimal"/>
<data type="decimal"/>
<data type="decimal"/>
</list>
</define>
<define name="unique_settings">
<a:documentation/>
<!-- Defines # -->
<a:documentation/>
<optional>
<attribute name="name"/>
</optional>
<optional>
<attribute name="type" a:defaultValue="empty"/>
</optional>
<optional>
<attribute name="style"/>
</optional>
</define>
<!--
This could probably be made more specific/strict
with more information regarding the use/meaning
of these attributes.
-->
<define name="base_settings">
<interleave>
<optional>
<attribute name="absolute">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="enable">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="ghost">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="hidden">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="size">
<ref name="clientarea"/>
</attribute>
</optional>
<optional>
<attribute name="z">
<data type="decimal"/>
</attribute>
</optional>
</interleave>
</define>
<!-- Defaults are not put in here, because it ruins the concept of styles. -->
<define name="ex_settings">
<interleave>
<optional>
<attribute name="anchor">
<ref name="valign"/>
</attribute>
</optional>
<optional>
<attribute name="buffer_zone">
<data type="decimal"/>
</attribute>
</optional>
<optional>
<attribute name="buffer_width">
<data type="decimal"/>
</attribute>
</optional>
<optional>
<attribute name="button_width">
<data type="decimal"/>
</attribute>
</optional>
<optional>
<attribute name="checked">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="clip">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="dropdown_size">
<data type="decimal"/>
</attribute>
</optional>
<optional>
<attribute name="dropdown_buffer">
<data type="decimal"/>
</attribute>
</optional>
<optional>
<attribute name="enabled">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="font"/>
</optional>
<optional>
<attribute name="fov_wedge_color">
<ref name="ccolor"/>
</attribute>
</optional>
<optional>
<attribute name="hotkey"/>
</optional>
<optional>
<attribute name="cell_id">
<data type="integer"/>
</attribute>
</optional>
<optional>
<attribute name="independent">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="input_initvalue_destroyed_at_focus">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="mask">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="mask_char">
<data type="string">
<param name="minLength">1</param>
<param name="maxLength">1</param>
</data>
</attribute>
</optional>
<optional>
<attribute name="max_length">
<data type="nonNegativeInteger"/>
</attribute>
</optional>
<optional>
<attribute name="maxwidth">
<data type="decimal"/>
</attribute>
</optional>
<optional>
<attribute name="multiline">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="offset">
<ref name="pos"/>
</attribute>
</optional>
<optional>
<attribute name="scrollbar">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="scrollbar_style"/>
</optional>
<optional>
<attribute name="scroll_bottom">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="sound_closed"/>
</optional>
<optional>
<attribute name="sound_disabled"/>
</optional>
<optional>
<attribute name="sound_enter"/>
</optional>
<optional>
<attribute name="sound_leave"/>
</optional>
<optional>
<attribute name="sound_opened"/>
</optional>
<optional>
<attribute name="sound_pressed"/>
</optional>
<optional>
<attribute name="sound_selected"/>
</optional>
<optional>
<attribute name="sprite"/>
</optional>
<optional>
<attribute name="sprite2"/>
</optional>
<optional>
<attribute name="sprite_heading"/>
</optional>
<optional>
<attribute name="sprite_bar"/>
</optional>
<optional>
<attribute name="sprite_background"/>
</optional>
<optional>
<attribute name="sprite_disabled"/>
</optional>
<optional>
<attribute name="sprite_list"/>
</optional>
<optional>
<attribute name="sprite2_disabled"/>
</optional>
<optional>
<attribute name="sprite_over"/>
</optional>
<optional>
<attribute name="sprite2_over"/>
</optional>
<optional>
<attribute name="sprite_pressed"/>
</optional>
<optional>
<attribute name="sprite2_pressed"/>
</optional>
<optional>
<attribute name="sprite_selectarea"/>
</optional>
<optional>
<attribute name="square_side">
<data type="decimal"/>
</attribute>
</optional>
<optional>
<attribute name="textcolor">
<ref name="ccolor"/>
</attribute>
</optional>
<optional>
<attribute name="textcolor_disabled">
<ref name="ccolor"/>
</attribute>
</optional>
<optional>
<attribute name="textcolor_over">
<ref name="ccolor"/>
</attribute>
</optional>
<optional>
<attribute name="textcolor_pressed">
<ref name="ccolor"/>
</attribute>
</optional>
<optional>
<attribute name="textcolor_selected">
<ref name="ccolor"/>
</attribute>
</optional>
<optional>
<attribute name="text_align">
<ref name="align"/>
</attribute>
</optional>
<optional>
<attribute name="text_valign">
<ref name="valign"/>
</attribute>
</optional>
<optional>
<attribute name="tooltip"/>
</optional>
<optional>
<attribute name="tooltip_style"/>
</optional>
</interleave>
</define>
<define name="objects">
<a:documentation/>
<!-- Objects # -->
<a:documentation/>
<element name="objects">
<zeroOrMore>
<choice>
<ref name="script"/>
<ref name="object"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="script">
<element name="script">
<interleave>
<text/>
<optional>
<attribute name="file"/>
</optional>
<optional>
<attribute name="directory"/>
</optional>
</interleave>
</element>
</define>
<define name="object">
<element name="object">
<choice>
<zeroOrMore>
<choice>
<ref name="object"/>
<ref name="action"/>
<ref name="attribute"/>
<ref name="def"/>
<ref name="include"/>
<ref name="item"/>
<ref name="repeat"/>
<ref name="translatableAttribute"/>
</choice>
</zeroOrMore>
<text/>
</choice>
<ref name="unique_settings"/>
<ref name="base_settings"/>
<ref name="ex_settings"/>
</element>
</define>
<define name="action">
<element name="action">
<text/>
<attribute name="on"/>
<optional>
<attribute name="file"/>
</optional>
</element>
</define>
<define name="attribute">
<element name="attribute">
<zeroOrMore>
<choice>
<ref name="keep"/>
<ref name="translate"/>
</choice>
</zeroOrMore>
<attribute name="id"/>
</element>
</define>
<define name="def">
<element name="def">
<optional>
<ref name="translatableAttribute"/>
</optional>
<interleave>
<attribute name="id"/>
<optional>
<attribute name="color">
<ref name="ccolor"/>
</attribute>
</optional>
<optional>
<attribute name="heading"/>
</optional>
<optional>
<attribute name="width"/>
</optional>
</interleave>
</element>
</define>
<define name="include">
<element name="include">
<attribute name="file"/>
</element>
</define>
<define name="item">
<element name="item">
<text/>
<optional>
<attribute name="enabled">
<ref name="bool"/>
</attribute>
</optional>
</element>
</define>
<define name="keep">
<element name="keep">
<text/>
</element>
</define>
<define name="repeat">
<element name="repeat">
<oneOrMore>
<ref name="object"/>
</oneOrMore>
<attribute name="count"/>
</element>
</define>
<define name="translate">
<element name="translate">
<text/>
</element>
</define>
<define name="translatableAttribute">
<element name="translatableAttribute">
<text/>
<interleave>
<attribute name="id"/>
<optional>
<attribute name="comment"/>
</optional>
<optional>
<attribute name="context"/>
</optional>
</interleave>
</element>
</define>
<define name="styles">
<a:documentation/>
<!-- Styles # -->
<a:documentation/>
<element name="styles">
<zeroOrMore>
<ref name="style"/>
</zeroOrMore>
</element>
</define>
<define name="style">
<element name="style">
<attribute name="name"/>
<ref name="base_settings"/>
<ref name="ex_settings"/>
</element>
</define>
<define name="setup">
<a:documentation/>
<!-- Setup # -->
<a:documentation/>
<element name="setup">
<zeroOrMore>
<choice>
<ref name="icon"/>
<ref name="scrollbar"/>
<ref name="tooltip"/>
<ref name="color"/>
</choice>
</zeroOrMore>
</element>
</define>
<define name="scrollbar">
<element name="scrollbar">
<interleave>
<attribute name="name"/>
<attribute name="width">
<data type="decimal"/>
</attribute>
<optional>
<attribute name="alwaysshown">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="maximum_bar_size">
<data type="decimal"/>
</attribute>
</optional>
<optional>
<attribute name="minimum_bar_size">
<data type="decimal"/>
</attribute>
</optional>
<optional>
<attribute name="scroll_wheel">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="show_edge_buttons">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="sprite_button_top"/>
</optional>
<optional>
<attribute name="sprite_button_top_pressed"/>
</optional>
<optional>
<attribute name="sprite_button_top_disabled"/>
</optional>
<optional>
<attribute name="sprite_button_top_over"/>
</optional>
<optional>
<attribute name="sprite_button_bottom"/>
</optional>
<optional>
<attribute name="sprite_button_bottom_pressed"/>
</optional>
<optional>
<attribute name="sprite_button_bottom_disabled"/>
</optional>
<optional>
<attribute name="sprite_button_bottom_over"/>
</optional>
<optional>
<attribute name="sprite_bar_vertical"/>
</optional>
<optional>
<attribute name="sprite_bar_vertical_over"/>
</optional>
<optional>
<attribute name="sprite_bar_vertical_pressed"/>
</optional>
<optional>
<attribute name="sprite_back_vertical"/>
</optional>
</interleave>
</element>
</define>
<define name="icon">
<element name="icon">
<interleave>
<attribute name="name"/>
<attribute name="size">
<ref name="size"/>
</attribute>
<attribute name="sprite"/>
<optional>
<attribute name="cell_id"/>
</optional>
</interleave>
</element>
</define>
<define name="tooltip">
<element name="tooltip">
<interleave>
<attribute name="name"/>
<optional>
<attribute name="sprite"/>
</optional>
<optional>
<attribute name="anchor">
<ref name="valign"/>
</attribute>
</optional>
<optional>
<attribute name="buffer_zone">
<data type="decimal"/>
</attribute>
</optional>
<optional>
<attribute name="font"/>
</optional>
<optional>
<attribute name="maxwidth">
<data type="decimal"/>
</attribute>
</optional>
<optional>
<attribute name="offset">
<ref name="pos"/>
</attribute>
</optional>
<optional>
<attribute name="textcolor">
<ref name="ccolor"/>
</attribute>
</optional>
<optional>
<attribute name="delay">
<data type="integer"/>
</attribute>
</optional>
<optional>
<attribute name="use_object"/>
</optional>
<optional>
<attribute name="hide_object">
<ref name="bool"/>
</attribute>
</optional>
</interleave>
</element>
</define>
<define name="color">
<element name="color">
<ref name="rgba"/>
<attribute name="name"/>
</element>
</define>
<define name="sprites">
<a:documentation/>
<!-- Sprites # -->
<a:documentation/>
<element name="sprites">
<zeroOrMore>
<ref name="sprite"/>
</zeroOrMore>
</element>
</define>
<define name="sprite">
<element name="sprite">
<group>
<optional>
<ref name="effect"/>
</optional>
<oneOrMore>
<ref name="image"/>
</oneOrMore>
</group>
<attribute name="name"/>
</element>
</define>
<define name="image">
<element name="image">
<optional>
<ref name="effect"/>
</optional>
<interleave>
<optional>
<attribute name="texture"/>
</optional>
<optional>
<attribute name="size">
<ref name="clientarea"/>
</attribute>
</optional>
<optional>
<attribute name="texture_size">
<ref name="clientarea"/>
</attribute>
</optional>
<optional>
<attribute name="real_texture_placement">
<ref name="rect"/>
</attribute>
</optional>
<optional>
<attribute name="cell_size">
<ref name="size"/>
</attribute>
</optional>
<optional>
<attribute name="backcolor">
<ref name="ccolor"/>
</attribute>
</optional>
<optional>
<attribute name="bordercolor">
<ref name="ccolor"/>
</attribute>
</optional>
<optional>
<attribute name="border">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="z_level">
<data type="float"/>
</attribute>
</optional>
<optional>
<attribute name="fixed_h_aspect_ratio">
<data type="decimal"/>
</attribute>
</optional>
<optional>
<attribute name="round_coordinates">
<ref name="bool"/>
</attribute>
</optional>
<optional>
<attribute name="wrap_mode">
<ref name="wrapmode"/>
</attribute>
</optional>
</interleave>
</element>
</define>
<define name="effect">
<element name="effect">
<optional>
<attribute name="add_color">
<ref name="ccolor"/>
</attribute>
</optional>
<optional>
<attribute name="multiply_color">
<ref name="ccolor"/>
</attribute>
</optional>
<optional>
<attribute name="grayscale">
<empty/>
</attribute>
</optional>
</element>
</define>
</grammar>

View File

@ -0,0 +1,11 @@
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
##
# NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
# and use a converter tool like trang to generate the Relax NG XML (.rng) file
##
element page {
element include {
text
}*
}

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<element name="page" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
<a:documentation/>
<!--
NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
and use a converter tool like trang to generate the Relax NG XML (.rng) file
-->
<a:documentation/>
<zeroOrMore>
<element name="include">
<text/>
</element>
</zeroOrMore>
</element>

View File

@ -0,0 +1,120 @@
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
##
# NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
# and use a converter tool like trang to generate the Relax NG XML (.rng) file
##
start = Scenario
##
# Defines #
##
colour_rgb =
attribute r { xsd:decimal { minInclusive = "0" maxInclusive = "1" } },
attribute g { xsd:decimal { minInclusive = "0" maxInclusive = "1" } },
attribute b { xsd:decimal { minInclusive = "0" maxInclusive = "1" } }
suncolour_rgb = # RGB can be > 1 due to overbrightness
attribute r { xsd:decimal { minInclusive = "0" } },
attribute g { xsd:decimal { minInclusive = "0" } },
attribute b { xsd:decimal { minInclusive = "0" } }
pos_xyz =
attribute x { xsd:float },
attribute y { xsd:float },
attribute z { xsd:float }
pos_xz =
attribute x { xsd:decimal },
attribute z { xsd:decimal }
angle = attribute angle { xsd:float }
##
# Scenario #
##
# TODO: bounds are not documented for many of these
Scenario = element Scenario {
attribute version { xsd:positiveInteger } &
element Environment {
element LightingModel { text }? & # Deprecated
element SkySet { text } &
element SunColour { suncolour_rgb } &
element SunElevation { angle } &
element SunRotation { angle } &
element TerrainAmbientColour { colour_rgb } &
element UnitsAmbientColour { colour_rgb } &
element Fog {
element FogFactor {
xsd:decimal { minInclusive = "0" } # TODO: what is the max?
} &
element FogThickness {
xsd:decimal { minInclusive = "0" } # TODO: what is the max?
} &
element FogColour { colour_rgb }
}? &
element Water {
element WaterBody {
element Type { text } & # Not implemented
element Colour { colour_rgb } &
element Height { xsd:decimal } &
element Shininess { xsd:decimal }? & # Deprecated
element Waviness { xsd:decimal } &
element Murkiness { xsd:decimal } &
element Tint { colour_rgb } &
element ReflectionTint { colour_rgb } &
element ReflectionTintStrength { xsd:decimal }
}
} &
element Postproc {
element Brightness { xsd:decimal },
element Contrast { xsd:decimal },
element Saturation { xsd:decimal },
element Bloom { xsd:decimal },
element PostEffect { text }
}?
} &
element Terrain {
attribute patches { xsd:positiveInteger }?,
attribute texture { text }?,
attribute priority { xsd:nonNegativeInteger }?,
attribute height { xsd:positiveInteger }?
}? &
element Script {
text
}? &
element Camera { # Camera can have weird float values
element Position { pos_xyz },
element Rotation { angle },
element Declination { angle }
} &
element ScriptSettings {
text
} &
element Entities {
element Entity {
attribute uid { xsd:positiveInteger } &
element Template { text } &
element Player { xsd:nonNegativeInteger }? &
element Position {
pos_xz
} &
element Orientation {
attribute y { xsd:decimal }
} &
element Obstruction {
attribute group { xsd:positiveInteger },
attribute group2 { xsd:positiveInteger }?
}? &
element Actor {
attribute seed { xsd:integer }
}?
}*
}? &
element Paths { # Unused
empty
}? &
element Triggers { # Unused
empty
}?
}

View File

@ -0,0 +1,297 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<start>
<a:documentation/>
<!--
NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
and use a converter tool like trang to generate the Relax NG XML (.rng) file
-->
<a:documentation/>
<ref name="Scenario"/>
</start>
<define name="colour_rgb">
<a:documentation/>
<!-- Defines # -->
<a:documentation/>
<attribute name="r">
<data type="decimal">
<param name="minInclusive">0</param>
<param name="maxInclusive">1</param>
</data>
</attribute>
<attribute name="g">
<data type="decimal">
<param name="minInclusive">0</param>
<param name="maxInclusive">1</param>
</data>
</attribute>
<attribute name="b">
<data type="decimal">
<param name="minInclusive">0</param>
<param name="maxInclusive">1</param>
</data>
</attribute>
</define>
<define name="suncolour_rgb">
<!-- RGB can be > 1 due to overbrightness -->
<attribute name="r">
<data type="decimal">
<param name="minInclusive">0</param>
</data>
</attribute>
<attribute name="g">
<data type="decimal">
<param name="minInclusive">0</param>
</data>
</attribute>
<attribute name="b">
<data type="decimal">
<param name="minInclusive">0</param>
</data>
</attribute>
</define>
<define name="pos_xyz">
<attribute name="x">
<data type="float"/>
</attribute>
<attribute name="y">
<data type="float"/>
</attribute>
<attribute name="z">
<data type="float"/>
</attribute>
</define>
<define name="pos_xz">
<attribute name="x">
<data type="decimal"/>
</attribute>
<attribute name="z">
<data type="decimal"/>
</attribute>
</define>
<define name="angle">
<attribute name="angle">
<data type="float"/>
</attribute>
</define>
<!-- TODO: bounds are not documented for many of these -->
<define name="Scenario">
<a:documentation/>
<!-- Scenario # -->
<a:documentation/>
<element name="Scenario">
<interleave>
<attribute name="version">
<data type="positiveInteger"/>
</attribute>
<element name="Environment">
<interleave>
<optional>
<element name="LightingModel">
<text/>
</element>
</optional>
<!-- Deprecated -->
<element name="SkySet">
<text/>
</element>
<element name="SunColour">
<ref name="suncolour_rgb"/>
</element>
<element name="SunElevation">
<ref name="angle"/>
</element>
<element name="SunRotation">
<ref name="angle"/>
</element>
<element name="TerrainAmbientColour">
<ref name="colour_rgb"/>
</element>
<element name="UnitsAmbientColour">
<ref name="colour_rgb"/>
</element>
<optional>
<element name="Fog">
<interleave>
<element name="FogFactor">
<data type="decimal">
<param name="minInclusive">0</param>
</data>
<!-- TODO: what is the max? -->
</element>
<element name="FogThickness">
<data type="decimal">
<param name="minInclusive">0</param>
</data>
<!-- TODO: what is the max? -->
</element>
<element name="FogColour">
<ref name="colour_rgb"/>
</element>
</interleave>
</element>
</optional>
<element name="Water">
<element name="WaterBody">
<interleave>
<element name="Type">
<text/>
</element>
<!-- Not implemented -->
<element name="Colour">
<ref name="colour_rgb"/>
</element>
<element name="Height">
<data type="decimal"/>
</element>
<optional>
<element name="Shininess">
<data type="decimal"/>
</element>
</optional>
<!-- Deprecated -->
<element name="Waviness">
<data type="decimal"/>
</element>
<element name="Murkiness">
<data type="decimal"/>
</element>
<element name="Tint">
<ref name="colour_rgb"/>
</element>
<element name="ReflectionTint">
<ref name="colour_rgb"/>
</element>
<element name="ReflectionTintStrength">
<data type="decimal"/>
</element>
</interleave>
</element>
</element>
<optional>
<element name="Postproc">
<element name="Brightness">
<data type="decimal"/>
</element>
<element name="Contrast">
<data type="decimal"/>
</element>
<element name="Saturation">
<data type="decimal"/>
</element>
<element name="Bloom">
<data type="decimal"/>
</element>
<element name="PostEffect">
<text/>
</element>
</element>
</optional>
</interleave>
</element>
<optional>
<element name="Terrain">
<optional>
<attribute name="patches">
<data type="positiveInteger"/>
</attribute>
</optional>
<optional>
<attribute name="texture"/>
</optional>
<optional>
<attribute name="priority">
<data type="nonNegativeInteger"/>
</attribute>
</optional>
<optional>
<attribute name="height">
<data type="positiveInteger"/>
</attribute>
</optional>
</element>
</optional>
<optional>
<element name="Script">
<text/>
</element>
</optional>
<element name="Camera">
<!-- Camera can have weird float values -->
<element name="Position">
<ref name="pos_xyz"/>
</element>
<element name="Rotation">
<ref name="angle"/>
</element>
<element name="Declination">
<ref name="angle"/>
</element>
</element>
<element name="ScriptSettings">
<text/>
</element>
<optional>
<element name="Entities">
<zeroOrMore>
<element name="Entity">
<interleave>
<attribute name="uid">
<data type="positiveInteger"/>
</attribute>
<element name="Template">
<text/>
</element>
<optional>
<element name="Player">
<data type="nonNegativeInteger"/>
</element>
</optional>
<element name="Position">
<ref name="pos_xz"/>
</element>
<element name="Orientation">
<attribute name="y">
<data type="decimal"/>
</attribute>
</element>
<optional>
<element name="Obstruction">
<attribute name="group">
<data type="positiveInteger"/>
</attribute>
<optional>
<attribute name="group2">
<data type="positiveInteger"/>
</attribute>
</optional>
</element>
</optional>
<optional>
<element name="Actor">
<attribute name="seed">
<data type="integer"/>
</attribute>
</element>
</optional>
</interleave>
</element>
</zeroOrMore>
</element>
</optional>
<optional>
<element name="Paths">
<!-- Unused -->
<empty/>
</element>
</optional>
<optional>
<element name="Triggers">
<!-- Unused -->
<empty/>
</element>
</optional>
</interleave>
</element>
</define>
</grammar>

View File

@ -0,0 +1,30 @@
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
##
# NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
# and use a converter tool like trang to generate the Relax NG XML (.rng) file
##
element Pathfinder {
element MaxSameTurnMoves { xsd:nonNegativeInteger } &
element PassabilityClasses {
element * {
element MinWaterDepth { xsd:decimal }? & # TODO: fixed type
element MaxWaterDepth { xsd:decimal }? &
element MaxTerrainSlope { xsd:decimal }? &
element MinShoreDistance { xsd:decimal }? &
element MaxShoreDistance { xsd:decimal }?
}+
} &
element MovementClasses {
element * {
attribute Speed { xsd:decimal } &
attribute Cost { xsd:decimal } &
element UnitClasses {
element * {
attribute Speed { xsd:decimal } &
attribute Cost { xsd:decimal }
}*
}?
}+
}
}

View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<element name="Pathfinder" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<a:documentation/>
<!--
NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
and use a converter tool like trang to generate the Relax NG XML (.rng) file
-->
<a:documentation/>
<interleave>
<element name="MaxSameTurnMoves">
<data type="nonNegativeInteger"/>
</element>
<element name="PassabilityClasses">
<oneOrMore>
<element>
<anyName/>
<interleave>
<optional>
<element name="MinWaterDepth">
<data type="decimal"/>
</element>
</optional>
<optional>
<!-- TODO: fixed type -->
<element name="MaxWaterDepth">
<data type="decimal"/>
</element>
</optional>
<optional>
<element name="MaxTerrainSlope">
<data type="decimal"/>
</element>
</optional>
<optional>
<element name="MinShoreDistance">
<data type="decimal"/>
</element>
</optional>
<optional>
<element name="MaxShoreDistance">
<data type="decimal"/>
</element>
</optional>
</interleave>
</element>
</oneOrMore>
</element>
<element name="MovementClasses">
<oneOrMore>
<element>
<anyName/>
<interleave>
<attribute name="Speed">
<data type="decimal"/>
</attribute>
<attribute name="Cost">
<data type="decimal"/>
</attribute>
<optional>
<element name="UnitClasses">
<zeroOrMore>
<element>
<anyName/>
<interleave>
<attribute name="Speed">
<data type="decimal"/>
</attribute>
<attribute name="Cost">
<data type="decimal"/>
</attribute>
</interleave>
</element>
</zeroOrMore>
</element>
</optional>
</interleave>
</element>
</oneOrMore>
</element>
</interleave>
</element>

View File

@ -0,0 +1,17 @@
namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
##
# NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
# and use a converter tool like trang to generate the Relax NG XML (.rng) file
##
element TerritoryManager {
element ImpassableCost {
xsd:integer { minInclusive = "0" maxInclusive = "255" }
} &
element BorderThickness {
xsd:decimal
} &
element BorderSeparation {
xsd:decimal
}
}

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<element name="TerritoryManager" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<a:documentation/>
<!--
NOTE: To modify this Relax NG grammar, edit the Relax NG Compact (.rnc) file
and use a converter tool like trang to generate the Relax NG XML (.rng) file
-->
<a:documentation/>
<interleave>
<element name="ImpassableCost">
<data type="integer">
<param name="minInclusive">0</param>
<param name="maxInclusive">255</param>
</data>
</element>
<element name="BorderThickness">
<data type="decimal"/>
</element>
<element name="BorderSeparation">
<data type="decimal"/>
</element>
</interleave>
</element>

View File

@ -0,0 +1,177 @@
use strict;
use warnings;
use File::Find;
use XML::LibXML;
use constant VERBOSE_OUTPUT => 1;
my $vfsroot = '../../../binaries/data/mods';
sub vfs_to_physical
{
my ($vfspath) = @_;
my $fn = "$vfsroot/public/$vfspath";
return $fn;
}
sub vfs_to_relative_to_mods
{
my ($vfspath) = @_;
my $fn = "public/$vfspath";
return $fn;
}
sub find_files
{
my ($vfspath, $extn) = @_;
my @files;
my $find_process = sub {
return $File::Find::prune = 1 if $_ eq '.svn';
my $n = $File::Find::name;
return if /~$/;
return unless -f $_;
return unless /\.($extn)$/;
$n =~ s~\Q$vfsroot\E/public/~~;
push @files, $n;
};
find({ wanted => $find_process }, "$vfsroot/public/$vfspath");
return @files;
}
sub validate
{
my ($name, $arr, $schemapath) = @_;
my @files = @{$arr};
print "\nValidating ".$name."s...\n";
my $rngschema = XML::LibXML::RelaxNG->new( location => vfs_to_physical($schemapath) );
my $errorcount = 0;
for my $f (sort @files)
{
my $doc = XML::LibXML->new->parse_file(vfs_to_physical($f));
eval { $rngschema->validate( $doc ); };
if ($@)
{
if (VERBOSE_OUTPUT)
{
# strip $vfsroot from messages
$@ =~ s/$vfsroot//g;
warn $@;
}
else
{
warn "$f validation failed\n";
}
$errorcount++;
}
}
print "\n$errorcount $name validation errors\n";
}
sub validate_actors
{
my @files = find_files('art/actors', 'xml');
validate('actor', \@files, 'art/actors/actor.rng');
}
sub validate_guis
{
# there are two different gui XML schemas depending on path
my @files = find_files('gui', 'xml');
my (@guipages, @guixmls);
for my $f (@files)
{
if ($f =~ /^gui\/page_/)
{
push @guipages, $f;
}
else
{
push @guixmls, $f;
}
}
validate('gui page', \@guipages, 'gui/gui_page.rng');
validate('gui xml', \@guixmls, 'gui/gui.rng');
}
sub validate_maps
{
my @files = find_files('maps/scenarios', 'xml');
push @files, find_files('maps/skirmishes', 'xml');
validate('map', \@files, 'maps/scenario.rng');
}
sub validate_materials
{
my @files = find_files('art/materials', 'xml');
validate('material', \@files, 'art/materials/material.rng');
}
sub validate_particles
{
my @files = find_files('art/particles', 'xml');
validate('particle', \@files, 'art/particles/particle.rng');
}
sub validate_simulation
{
my @file = ('simulation/data/pathfinder.xml');
validate('pathfinder', \@file, 'simulation/data/pathfinder.rng');
@file = ('simulation/data/territorymanager.xml');
validate('territory manager', \@file, 'simulation/data/territorymanager.rng');
}
sub validate_soundgroups
{
my @files = find_files('audio', 'xml');
validate('sound group', \@files, 'audio/sound_group.rng');
}
sub validate_terrains
{
# there are two different terrain XML schemas depending on path
my @files = find_files('art/terrains', 'xml');
my (@terrains, @terraintextures);
for my $f (@files)
{
if ($f =~ /terrains.xml/)
{
push @terrains, $f;
}
else
{
push @terraintextures, $f;
}
}
validate('terrain', \@terrains, 'art/terrains/terrain.rng');
validate('terrain texture', \@terraintextures, 'art/terrains/terrain_texture.rng');
}
sub validate_textures
{
my @files;
my @texturefiles = find_files('art/textures', 'xml');
for my $f (@texturefiles)
{
push @files, $f if $f =~ /textures.xml/;
}
validate('texture', \@files, 'art/textures/texture.rng');
}
validate_actors();
validate_guis();
validate_maps();
validate_materials();
validate_particles();
validate_simulation();
validate_soundgroups();
validate_terrains();
validate_textures();