Yodl has four macros to modify and/or to set the values of counters. The macros are:
  • COUNTERVALUE(somecounter): This macro expands to the value of somecounter. E.g., if the current value is 2, then the macro writes 2 on the output file.
  • SETCOUNTER(somecounter)(number): This macro sets the value of somecounter to the value of number. The second parameter list must be an integer number (i.e., consisting of the characters 0 to 9, optionally prefixed by a - sign). The macro does not expand to anything; i.e., it does not write to the output file.
  • ADDTOCOUNTER(somecounter)(number): This macro adds the value of number to somecounter. The number may be negative.
  • USECOUNTER(somecounter): This macro first increases the value of somecounter by 1, and then writes the value of the counter to the output file. This command is particularly useful in combination with NEWCOUNTER: since NEWCOUNTER initializes a counter to zero, USECOUNTER can be used to increase the value and to output it. The first time that USECOUNTER is used on a new counter, the number 1 appears on the output file. The next time, number 2 appears on the output file etc..
  • Given the numbering requirements of the hypothetical commands section and subsection (see the previous section), we can now complete the definitions:
    NEWCOUNTER(sectcounter)
    NEWCOUNTER(subsectcounter)
    
    DEFINEMACRO(section)(1)(\ 
    SETCOUNTER(subsectcounter)(0)\ 
    USECOUNTER(sectcounter) ARG1)
    
    DEFINEMACRO(subsection)(1)(\ 
    COUNTERVALUE(sectcounter).USECOUNTER(subsectcounter) ARG1)
    

    Return to Yodl's home page.

    Please send Yodl questions and comments to yodl@icce.rug.nl.

    Please send comments on these web pages to (address unknown), send other FSF & GNU inquiries and questions to gnu@gnu.org.

    Copyright (c) 1998 Karel Kubat and Jan Nieuwenhuizen

    Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.


    This page was built from Yodl-1.31.17 by

    <(address unknown)>, at Thu May 4 11:39:50 2000 CEST.