tame/core/base.xml

136 lines
4.4 KiB
XML

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright (C) 2015 LoVullo Associates, Inc.
This file is part of tame-core.
tame-core is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<package xmlns="http://www.lovullo.com/rater"
xmlns:c="http://www.lovullo.com/calc"
core="true"
desc="Base features">
<!-- magic variable that will contain the result of a classification (this
definition exists to simplify validations (its symbol is Xi because it
looks like a sideways array) -->
<const name="_CMATCH_" type="boolean" desc="Set indicating indexes of classification matches" sym="\Xi">
<item value="0" desc="Dummy value; this set is populated upon entering each rate block" />
</const>
<const name="NEGATE" value="-1" type="float" desc="Negate a value" sym="-" />
<!-- useful where constants are required -->
<const name="ZERO" value="0.00" type="float" desc="Zero value" />
<!-- the runtime is responsible for automatically populating these fields with meaningful values -->
<const name="__DATE_YEAR__" value="0" type="integer" desc="Current year" sym="\widehat{D^\gamma}" magic="true" />
<typedef name="integer" desc="Any value in the set of integers" sym="\mathbb{I}">
<base-type />
</typedef>
<!-- real number -->
<typedef name="float" desc="Any real number (represented as a float)" sym="\mathbb{R}">
<base-type />
</typedef>
<typedef name="boolean" desc="Boolean values">
<enum type="integer">
<item name="TRUE" value="1" desc="True" />
<item name="FALSE" value="0" desc="False" />
</enum>
</typedef>
<!-- does not have much practical use outside of the core -->
<typedef name="empty" desc="Empty set" sym="\emptyset">
<base-type />
</typedef>
<!--
Useful in certain circumstances. Don't judge.
-->
<classify as="always" keep="true" yields="alwaysTrue" desc="Always true" />
<template name="_todo_" desc="A simple TODO :)">
<param name="@desc@" desc="TODO desc">
<text>TODO</text>
</param>
<param name="@hide@" desc="Whether to hide content by stripping
it entriely from the output" />
<unless name="@hide@">
<c:const value="0" type="integer" desc="@desc@" />
</unless>
</template>
<template name="_ignore_" desc="Simply removes all child nodes (as if it was commented out)">
<param name="@values@" desc="Nodes to comment out" />
<param name="@desc@" desc="Description" />
<!-- nothing -->
</template>
<template name="_fail-on-empty_" desc="Fail on rate lookup failure">
<param name="@values@" desc="Optional conditions to include in match" />
<param name="@name@" desc="Data to check (scalar, vector or otherwise)" />
<param name="@when@" desc="Conditional check (optional)" />
<param name="@class@" desc="Conditional class check" />
<param name="@as@" desc="Classifier name">
<text>-err-empty-</text>
<param-value name="@name@" lower="true" />
</param>
<param name="@desc@" desc="Description">
<param-value name="@name@" />
<text> is empty</text>
</param>
<param name="@classyields@" desc="Classification yield to match on">
<param-class-to-yields name="@class@" />
</param>
<!-- default to external to ensure that calculations do not wind up in the
classifier -->
<param name="@external@" desc="External classification">
<text>true</text>
</param>
<classify as="@as@" desc="@desc@" external="@external@" terminate="true">
<!-- include any option conditions -->
<param-copy name="@values@" />
<if name="@when@">
<match on="@when@" value="TRUE" />
</if>
<if name="@class@">
<match on="@classyields@" value="TRUE" />
</if>
<match on="@name@" value="ZERO" />
</classify>
</template>
</package>