Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <gerwitzm@lovullo.com>2013-02-13 09:27:33 -0500
committerMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-09-11 09:30:48 -0400
commit4ddda94a4c61b7fa0b30eb7be89b49c0fae115e0 (patch)
tree1f0f5482b456528d276523a0de234aed6299156a /core/base.xml
parentf169c919272a153a50312446a86d45f3a0b4749e (diff)
downloadtame-4ddda94a4c61b7fa0b30eb7be89b49c0fae115e0.tar.gz
tame-4ddda94a4c61b7fa0b30eb7be89b49c0fae115e0.tar.bz2
tame-4ddda94a4c61b7fa0b30eb7be89b49c0fae115e0.zip
TAME core library extracted from Calc DSL repository
Some notes on this: The "Calc DSL" is the name of the DSL before it became "TAME". This takes the entire core library and squashes its 91 commits into a single one; the reason for this is because those commits often contain LoVullo-specific details that are either irrelevant or should not be included. This library has limited value to the public at the time of this commit, since TAME has not yet been released (it requires some additional cleanup and filtering before then). It is also in need of heavy refactoring and reorganization, since it has accumulated a lot of cruft, especially since the project in which the Calc DSL was introduced was rushed (to put it lightly). Forgive the mess. [LoVullo employees: the commit was extracted from dsl.git 4a3aea9; full history can be found there. This commit contains some additional minor tweaks in addition to squashing. It filters on the :/core/ directory.]
Diffstat (limited to 'core/base.xml')
-rw-r--r--core/base.xml123
1 files changed, 123 insertions, 0 deletions
diff --git a/core/base.xml b/core/base.xml
new file mode 100644
index 0000000..dcbc034
--- /dev/null
+++ b/core/base.xml
@@ -0,0 +1,123 @@
+<?xml-stylesheet type="text/xsl" href="summary.xsl"?>
+<lv:package
+ xmlns:lv="http://www.lovullo.com/rater"
+ xmlns:c="http://www.lovullo.com/calc"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.lovullo.com/rater ../rater.xsd"
+
+ core="true"
+
+ name="core/base"
+ 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) -->
+ <lv:const name="_CMATCH_" type="boolean" desc="Set indicating indexes of classification matches" sym="\Xi">
+ <lv:item value="0" desc="Dummy value; this set is populated upon entering each rate block" />
+ </lv:const>
+
+ <lv:const name="NEGATE" value="-1" type="float" desc="Negate a value" sym="-" />
+
+ <!-- useful where constants are required -->
+ <lv:const name="ZERO" value="0.00" type="float" desc="Zero value" />
+
+ <!-- the runtime is responsible for automatically populating these fields with meaningful values -->
+ <lv:const name="__DATE_YEAR__" value="0" type="integer" desc="Current year" sym="\widehat{D^\gamma}" magic="true" />
+
+
+ <lv:typedef name="integer" desc="Any value in the set of integers" sym="\mathbb{I}">
+ <lv:base-type />
+ </lv:typedef>
+
+ <!-- real number -->
+ <lv:typedef name="float" desc="Any real number (represented as a float)" sym="\mathbb{R}">
+ <lv:base-type />
+ </lv:typedef>
+
+ <lv:typedef name="boolean" desc="Boolean values">
+ <lv:enum type="integer">
+ <lv:item name="TRUE" value="1" desc="True" />
+ <lv:item name="FALSE" value="0" desc="False" />
+ </lv:enum>
+ </lv:typedef>
+
+ <!-- does not have much practical use outside of the core -->
+ <lv:typedef name="empty" desc="Empty set" sym="\emptyset">
+ <lv:base-type />
+ </lv:typedef>
+
+
+ <!--
+ Useful in certain circumstances. Don't judge.
+ -->
+ <lv:classify as="always" keep="true" yields="alwaysTrue" desc="Always true" />
+
+
+ <lv:template name="_todo_" desc="A simple TODO :)">
+ <lv:param name="@desc@" desc="TODO desc">
+ <lv:text>TODO</lv:text>
+ </lv:param>
+
+ <lv:param name="@hide@" desc="Whether to hide content by stripping
+ it entriely from the output" />
+
+ <lv:unless name="@hide@">
+ <c:const value="0" type="integer" desc="@desc@" />
+ </lv:unless>
+ </lv:template>
+
+
+ <lv:template name="_ignore_" desc="Simply removes all child nodes (as if it was commented out)">
+ <lv:param name="@values@" desc="Nodes to comment out" />
+ <lv:param name="@desc@" desc="Description" />
+
+ <!-- nothing -->
+ </lv:template>
+
+
+ <lv:template name="_fail-on-empty_" desc="Fail on rate lookup failure">
+ <lv:param name="@values@" desc="Optional conditions to include in match" />
+ <lv:param name="@name@" desc="Data to check (scalar, vector or otherwise)" />
+ <lv:param name="@when@" desc="Conditional check (optional)" />
+ <lv:param name="@class@" desc="Conditional class check" />
+
+ <lv:param name="@as@" desc="Classifier name">
+ <lv:text>-err-empty-</lv:text>
+ <lv:param-value name="@name@" lower="true" />
+ </lv:param>
+
+ <lv:param name="@desc@" desc="Description">
+ <lv:param-value name="@name@" />
+ <lv:text> is empty</lv:text>
+ </lv:param>
+
+ <lv:param name="@classyields@" desc="Classification yield to match on">
+ <lv:param-class-to-yields name="@class@" />
+ </lv:param>
+
+ <!-- default to external to ensure that calculations do not wind up in the
+ classifier -->
+ <lv:param name="@external@" desc="External classification">
+ <lv:text>true</lv:text>
+ </lv:param>
+
+
+ <lv:classify as="@as@" desc="@desc@" external="@external@" terminate="true">
+ <!-- include any option conditions -->
+ <lv:param-copy name="@values@" />
+
+ <lv:if name="@when@">
+ <lv:match on="@when@" value="TRUE" />
+ </lv:if>
+
+ <lv:if name="@class@">
+ <lv:match on="@classyields@" value="TRUE" />
+ </lv:if>
+
+ <lv:match on="@name@" value="ZERO" />
+ </lv:classify>
+ </lv:template>
+</lv:package>
+