<?xml version="1.0" encoding="UTF-8"?>

<?context-directive job ctxfile x-setups.ctx ?>

<cd:interface xmlns:cd="http://www.pragma-ade.com/commands">

    <cd:command name="definecounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-name-optional"/>
            <cd:assignments list="yes" optional="yes">
                <cd:inherit name="setupcounter"/>
            </cd:assignments>
        </cd:arguments>
    </cd:command>

    <cd:command name="setupcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name-list-optional"/>
            <cd:assignments list="yes">
                <!--
                    <cd:parameter name="name">
                        <cd:constant type="cd:name"/>
                    </cd:parameter>
                -->
                <cd:parameter name="start">
                    <cd:constant type="cd:number"/>
                </cd:parameter>
                <cd:parameter name="counter">
                    <cd:constant type="cd:name"/>
                </cd:parameter>
                <cd:parameter name="method">
                    <cd:constant type="page"/>
                </cd:parameter>
                <cd:parameter name="state">
                    <cd:constant type="start" default="yes"/>
                    <cd:constant type="stop"/>
                </cd:parameter>
                <cd:parameter name="way">
                    <cd:constant type="page" prefix="by" method="none"/>
                    <cd:constant type="block" prefix="by" method="none"/>
                    <cd:constant type="text" prefix="by" method="none"/>
                    <cd:constant type="head" prefix="by" method="none"/>
                    <cd:constant type="cd:section" prefix="by" method="none"/>
                </cd:parameter>
                <cd:parameter name="prefix">
                    <cd:constant type="yes" default="yes"/>
                    <cd:constant type="no"/>
                </cd:parameter>
                <cd:parameter name="prefixseparatorset">
                    <cd:constant type="cd:name"/>
                </cd:parameter>
                <cd:parameter name="prefixconversion">
                    <cd:constant type="cd:name"/>
                </cd:parameter>
                <cd:parameter name="prefixconversionset">
                    <cd:constant type="cd:name"/>
                </cd:parameter>
                <cd:parameter name="prefixstarter">
                    <cd:resolve name="value-starter"/>
                </cd:parameter>
                <cd:parameter name="prefixstopper">
                    <cd:resolve name="value-stopper"/>
                </cd:parameter>
                <cd:parameter name="prefixset">
                    <cd:constant type="cd:name"/>
                </cd:parameter>
                <cd:parameter name="prefixsegments">
                    <cd:resolve name="value-prefixsegments"/>
                </cd:parameter>
                <cd:parameter name="numberorder">
                    <cd:constant type="reverse"/>
                </cd:parameter>
                <cd:parameter name="numberseparatorset">
                    <cd:constant type="cd:name"/>
                </cd:parameter>
                <cd:parameter name="numberconversion">
                    <cd:constant type="cd:name"/>
                </cd:parameter>
                <cd:parameter name="numberconversionset">
                    <cd:constant type="cd:name"/>
                </cd:parameter>
                <cd:parameter name="numberstarter">
                    <cd:resolve name="value-starter"/>
                </cd:parameter>
                <cd:parameter name="numberstopper">
                    <cd:resolve name="value-stopper"/>
                </cd:parameter>
                <cd:parameter name="numbersegments">
                    <cd:resolve name="value-numbersegments"/>
                </cd:parameter>
                <cd:parameter name="type">
                    <cd:constant type="first"/>
                    <cd:constant type="previous"/>
                    <!--
                        <cd:constant type="prev"/>
                    -->
                    <cd:constant type="next"/>
                    <cd:constant type="last"/>
                    <cd:constant type="number" default="yes"/>
                </cd:parameter>
                <cd:parameter name="criterium">
                    <cd:constant type="strict"/>
                    <cd:constant type="positive"/>
                    <cd:constant type="all"/>
                </cd:parameter>
                <cd:parameter name="prefixconnector">
                    <cd:resolve name="value-connector"/>
                </cd:parameter>
            </cd:assignments>
        </cd:arguments>
    </cd:command>

    <cd:command name="doifelsecounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="argument-name"/>
            <cd:resolve name="argument-true"/>
            <cd:resolve name="argument-false"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="doifcounterelse" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="argument-name"/>
            <cd:resolve name="argument-true"/>
            <cd:resolve name="argument-false"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="doifcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="argument-name"/>
            <cd:resolve name="argument-true"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="doifnotcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="argument-name"/>
            <cd:resolve name="argument-true"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="setcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-number-optional"/>
            <cd:resolve name="keyword-number"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="setcounterown" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-number-optional"/>
            <cd:resolve name="keyword-text"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="restartcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-number-optional"/>
            <cd:resolve name="keyword-number"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="resetcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-number-optional"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="incrementcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-number-optional"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="decrementcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-number-optional"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="rawcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-number-optional"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="lastcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-number-optional"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="firstcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-number-optional"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="nextcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-number-optional"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="prevcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-number-optional"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="countersubs" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-number-optional"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="savecounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="restorecounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="showcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="incrementedcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="decrementedcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="rawcountervalue" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="lastcountervalue" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="firstcountervalue" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="nextcountervalue" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="prevcountervalue" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="rawsubcountervalue" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-number"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="lastsubcountervalue" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-number"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="firstsubcountervalue" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-number"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="nextsubcountervalue" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-number"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="prevsubcountervalue" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:resolve name="keyword-number"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="convertedcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:assignments list="yes" optional="yes">
                <cd:inherit name="setupcounter"/>
            </cd:assignments>
        </cd:arguments>
    </cd:command>

    <cd:command name="convertedsubcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="keyword-name"/>
            <cd:keywords optional="yes">
                <cd:resolve name="value-numbersegments"/>
            </cd:keywords>
            <cd:assignments list="yes" optional="yes">
                <cd:inherit name="setupcounter"/>
            </cd:assignments>
        </cd:arguments>
    </cd:command>

    <cd:command name="directconvertedcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="argument-name"/>
            <cd:keywords delimiters="braces">
                <cd:constant type="first"/>
                <cd:constant type="previous"/>
                <!--
                    <cd:constant type="prev"/>
                -->
                <cd:constant type="next"/>
                <cd:constant type="last"/>
                <cd:constant type="number"/>
            </cd:keywords>
        </cd:arguments>
    </cd:command>
    
    <cd:command name="doifelsedefinedcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="argument-name"/>
            <cd:resolve name="argument-true"/>
            <cd:resolve name="argument-false"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="doifdefinedcounterelse" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="argument-name"/>
            <cd:resolve name="argument-true"/>
            <cd:resolve name="argument-false"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="doifdefinedcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="argument-name"/>
            <cd:resolve name="argument-true"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="doifundefinedcounter" file="strc-num.mkiv">
        <cd:arguments>
            <cd:resolve name="argument-name"/>
            <cd:resolve name="argument-true"/>
        </cd:arguments>
    </cd:command>

    <cd:command name="defineresetset" file="strc-ini.mkvi">
        <cd:arguments>
            <cd:keywords>
                <cd:constant type="cd:name"/>
                <cd:constant type="cd:name" prefix="cd:sectionblock" method="range"/>
            </cd:keywords>
            <cd:resolve name="keyword-number-list"/>
            <cd:resolve name="keyword-number-optional"/>
        </cd:arguments>
    </cd:command>

    <!--

        <cd:command name="definestructureresetset" file="strc-ini.mkvi">
            <cd:arguments>
                <cd:keywords>
                    <cd:constant type="cd:name"/>
                    <cd:constant type="cd:name" prefix="cd:sectionblock" method="range"/>
                </cd:keywords>
                <cd:resolve name="keyword-number-list"/>
                <cd:resolve name="keyword-number-optional"/>
            </cd:arguments>
        </cd:command>

    -->

    <cd:command name="defineseparatorset" file="strc-ini.mkvi">
        <cd:arguments>
            <cd:keywords>
                <cd:constant type="cd:name"/>
                <cd:constant type="cd:name" prefix="cd:sectionblock" method="range"/>
            </cd:keywords>
            <cd:keywords list="yes">
                <cd:resolve name="value-connector"/>
            </cd:keywords>
            <cd:keywords optional="yes">
                <cd:resolve name="value-connector"/>
            </cd:keywords>
        </cd:arguments>
    </cd:command>

    <!--

        <cd:command name="definestructureseparatorset" file="strc-ini.mkvi">
            <cd:arguments>
                <cd:keywords>
                    <cd:constant type="cd:name"/>
                    <cd:constant type="cd:name" prefix="cd:sectionblock" method="range"/>
                </cd:keywords>
                <cd:keywords list="yes">
                    <cd:resolve name="value-connector"/>
                </cd:keywords>
                <cd:keywords optional="yes">
                    <cd:resolve name="value-connector"/>
                </cd:keywords>
            </cd:arguments>
        </cd:command>

    -->

    <cd:command name="defineconversionset" file="strc-ini.mkvi">
        <cd:arguments>
            <cd:keywords>
                <cd:constant type="cd:name"/>
                <cd:constant type="cd:name" prefix="cd:sectionblock" method="range"/>
            </cd:keywords>
            <cd:keywords list="yes">
                <cd:constant type="cd:name"/>
                <cd:constant type="cd:name" prefix="cd:processor" method="apply"/>
            </cd:keywords>
            <cd:keywords optional="yes">
                <cd:constant type="cd:name"/>
                <cd:constant type="cd:name" prefix="cd:processor" method="apply"/>
            </cd:keywords>
        </cd:arguments>
    </cd:command>

    <!--

        <cd:command name="definestructureconversionset" file="strc-ini.mkvi">
            <cd:arguments>
                <cd:keywords>
                    <cd:constant type="cd:name"/>
                    <cd:constant type="cd:name" prefix="cd:sectionblock" method="range"/>
                </cd:keywords>
                <cd:keywords list="yes">
                    <cd:constant type="cd:name"/>
                    <cd:constant type="cd:name" prefix="cd:processor" method="apply"/>
                </cd:keywords>
                <cd:keywords optional="yes">
                    <cd:constant type="cd:name"/>
                    <cd:constant type="cd:name" prefix="cd:processor" method="apply"/>
                </cd:keywords>
            </cd:arguments>
        </cd:command>

    -->

    <cd:command name="defineprefixset" file="strc-ini.mkvi">
        <cd:arguments>
            <cd:keywords>
                <cd:constant type="cd:name"/>
                <cd:constant type="cd:name" prefix="cd:sectionblock" method="range"/>
            </cd:keywords>
            <cd:resolve name="keyword-section-list"/>
            <cd:resolve name="keyword-section-optional"/>
        </cd:arguments>
    </cd:command>

    <!--

        <cd:command name="definestructureprefixset" file="strc-ini.mkvi">
            <cd:arguments>
                <cd:keywords>
                    <cd:constant type="cd:name"/>
                    <cd:constant type="cd:name" prefix="cd:sectionblock" method="range"/>
                </cd:keywords>
                <cd:resolve name="keyword-section-list"/>
                <cd:resolve name="keyword-section-optional"/>
            </cd:arguments>
        </cd:command>

    -->

</cd:interface>
