
INCWSLEVEL()

DEFINESYMBOL(xml)()

COMMENT(
                                 Yodl
                             PREDEFINDED
                               COUNTERS
END COMMENT)

COMMENT(
    XXonlyblanks is defined by Yodl to indicate that only blanks were 
    inserted since PARAGRAPH() was called. It can be used to prevent the 
    output of multiple blank lines.

    To prevent the calling of PARAGRAPH in a certain context, use
    PUSHMACRO(PARAGRAPH)(0)() at the begin of the context, and
    POPMACRO(PARAGRAPH) at the end of the context.

    Just before PARAGRAPH is called, the symbol XXparagraph is set to the
whitespace text that would have been inserted if PARAGRAPH wasn't
defined. This does not happen if XXparagraph is not defined. It is NOT defined
by default. 

    The ifonlyblanks()() macro can be used to distinguish between series of
PARAGRAPH() activations and the first time PARAGRAPH is called following other
output. 

    If PARAGRAPH() would be called from within PARAGRAPH() itself its literal
whitespace text is output at that point. No nested calls of PARAGRAPH will
occur from an automated call of PARAGRAPH. It is possible, however, to call
PARAGRAPH recursively yourself (at your own risk)

END COMMENT)


DEFINECOUNTER(XXchaptercounter)(0)      COMMENT(for chapters)
DEFINECOUNTER(XXenumcounter)(0)         COMMENT(for ordered enums)
DEFINECOUNTER(XXpartcounter)(0)         COMMENT(for parts)
DEFINECOUNTER(XXsectcounter)(0)         COMMENT(for sections)
DEFINECOUNTER(XXsubsectcounter)(0)      COMMENT(for subsections)
DEFINECOUNTER(XXsubsubsectcounter)(0)   COMMENT(for subsubsections)

DEFINECOUNTER(XXtablewidth)(0)          COMMENT(the width of a table)
DEFINECOUNTER(XXcol)(0)                 COMMENT(col nr or idx in table/tbl)
DEFINECOUNTER(XXcenter)(0)              COMMENT(incremented in center(...))
DEFINECOUNTER(XXtr)(0)          \// 1 inside tr.
DEFINECOUNTER(XXtwrap)(0)       \// if != 0 then man-table cell contents are 
                                \//   wrapped in a T{ ... T} block (set by 
                                \//   twrap(value)
DEFINECOUNTER(XXx)(0)           \// scratch counter: no assumptions, and not
                                \//   necessarily unaltered after macro calls

DEFINECOUNTER(XXblock)(0)              COMMENT(See XXml*block)
DEFINECOUNTER(XXp)(0)                  COMMENT(after <p> 1 and after </p> 0
                                            also, writes <p>, </p> when 
                                            required
                                       END COMMENT)
DEFINECOUNTER(XXused)(0)               COMMENT(flags if a list uses elements)

DEFINECOUNTER(XXfootnotecounter)(0)    COMMENT(for footnotes)
DEFINECOUNTER(XXfigurecounter)(1)      COMMENT(for figures)

COMMENT(
                                 Yodl
                             PREDEFINDED
                               SYMBOLS
END COMMENT)

COMMENT( 
        XXincludePath set by Yodl holds the current includepath XXincludePath
is Interrogated at file openings

        XXparagraph may be defined by the user. If defined, then it will
contain the white space that triggered the call of PARAGRAPH just before 
PARAGRAPH is called. 

        XXyodlVersion is set to Yodl's current version

END COMMENT)


DEFINESYMBOL(XXabstracttext)        ()
DEFINESYMBOL(XXaffilstring)         ()
DEFINESYMBOL(XXauthorstring)        ()
DEFINESYMBOL(XXchapterstring)       (Chapter)
DEFINESYMBOL(XXdatestring)          ()
        COMMENT(Documentclass should be set to:
                    book
                    report
                    article
                )
DEFINESYMBOL(XXdocumentclass)       (unknown)
DEFINESYMBOL(XXfigurestring)        (Figure)
DEFINESYMBOL(XXgeneratetoc)         (true)
DEFINESYMBOL(XXlastnumber)          ()

DEFINESYMBOL(XXpartstring)          (Part)
DEFINESYMBOL(XXtitlestring)         ()
DEFINESYMBOL(XXtitleclearpage)      ()
DEFINESYMBOL(XXtocstring)           (Table of Contents)

DEFINESYMBOL(XXtablealign)          ()
DEFINESYMBOL(XXalign)()         \// in txt mode: the default text indentation
DEFINESYMBOL(XXtao)()           \// tbl align override
DEFINESYMBOL(XXsym)()           \// scratch symbol value: no assumptions,
                                \//   and not kept at macro calls

DEFINESYMBOL(XXcontext)             (unknown)
COMMENT(
        Other contexts:  (0)outer:      no markups, no paragraphs
                         (1)markup:     standard html tags are accepted
                         (2)nomarkup:   inside headers, quotes, etc:   
                                        no markups

    The following symbols refer to special and standard parts of .xml files:

        XXxhtmlBegin        - Defines the path to the filename containing 
                                a htmlblock-division
        XXxhtmlEnd          - Defines the path to the filename containing 
                                the termination of a htmlblock-division
        XXarticleBegin      - Defines the path to the filename containing 
                                the begin of an .xml article 
        XXarticleSummary    - Defines the path to the filename containing 
                                the xml article summary section
        XXmenuBegin         - Defines the path to the filename containing 
                                the begin of an .xml menu
        XXmenuEndTitle      - Defines the path to the filename containing 
                                the end of an .xml menu-title
        XXmenuEnd           - Defines the path to the filename containing 
                                the end of an .xml menu

    These pathnames are also written to the idx file, using their labelnames
as first argument. E.g.,

    set XXxhtmlBegin /path/to/XXxhtmlBegin-file.xml

    The menu entries are not written to the index file.

    XXdocumentbase defines the location where the document is stored. It is
used with figure and xmlmenu, and can be set with xmlsetdocumentbase

END COMMENT)        

DEFINESYMBOL(XXdocumentbase)        ()
DEFINESYMBOL(XXxhtmlBegin)          (/usr/share/yodl/xml/rug-xhtmlbegin.xml)
DEFINESYMBOL(XXxhtmlEnd)            (/usr/share/yodl/xml/rug-xhtmlend.xml)
DEFINESYMBOL(XXarticleBegin)        (/usr/share/yodl/xml/rug-articlebegin.xml)
DEFINESYMBOL(XXarticleEndTitle)     (/usr/share/yodl/xml/rug-articleendtitle.xml)
DEFINESYMBOL(XXarticleSummary)      (/usr/share/yodl/xml/rug-articlesummary.xml)
DEFINESYMBOL(XXmenuBegin)           (/usr/share/yodl/xml/rug-menubegin.xml)
DEFINESYMBOL(XXmenuEndTitle)        (/usr/share/yodl/xml/rug-menuendtitle.xml)
DEFINESYMBOL(XXmenuEnd)             (/usr/share/yodl/xml/rug-menuend.xml)
DEFINESYMBOL(XXmenuPath)            ()

DEFINESYMBOL(XXfigureext)           (.gif)

DEFINEMACRO(abstract)(1)(\
    SETSYMBOL(XXabstracttext)(ARG1)\
)

DEFINEMACRO(addntosymbol)(3)(\
    SETCOUNTER(XXx)(ARG2)\
    XXaddntosymbol(ARG1)(ARG3)\
)

DEFINEMACRO(affiliation)(1)(\
    setaffilstring(ARG1)\
)

DEFINEMACRO(AfourEnlarged)(0)(\
)

DEFINEMACRO(appendix)(0)(\
    SETCOUNTER(XXchaptercounter)(0)\
    SETCOUNTER(XXsectcounter)(0)\
    SETCOUNTER(XXsubsectcounter)(0)\
    SETCOUNTER(XXsubsubsectcounter)(0)\
    setchapterstring(Appendix)\
)

DEFINEMACRO(article)(3)(\
    redef(chapter)(1)(ERROR(chapters only available in reports or books!))\
    redef(part)(1)(ERROR(parts only available in books!))\
    redef(nchapter)(1)(chapter())\
    redef(npart)(1)(part())\
    XXstartdocument(article)\
    notransinclude(XXarticleBegin)\
    ATEXIT(\
        XXmlendp()\
        INTERNALINDEX(xmldone 0)\
    )\
    XXsetdocumentheader(ARG1)(ARG2)(ARG3)\
)

DEFINEMACRO(attrib)(1)(\
)

DEFINEMACRO(attribclear)(0)(\
)

DEFINEMACRO(attribinsert)(0)(\
)

DEFINEMACRO(bf)(1)(\
    XXmlAtContext(markup)
    (\
        NOTRANS(<strong>)\
        ARG1\
        +NOTRANS(</strong>)\
    )
    (\
        ARG1+nop()\
    )\
)

DEFINEMACRO(bind)(1)(\
    NOTRANS(&nbsp;)\
)

DEFINEMACRO(book)(3)(\
    XXstartdocument(book)\
    XXsetdocumentheader(ARG1)(ARG2)(ARG3)\
)

DEFINEMACRO(cell)(1)(\
    ADDTOCOUNTER(XXcol)(1)\
    NOTRANS(<td>) \
    ARG1\
    +NOTRANS( </td>)\
    XXnl()\
)

DEFINEMACRO(cells)(2)(\
    ADDTOCOUNTER(XXcol)(ARG1)\
    NOTRANS(<td colspan=)\
    ARG1\
    +NOTRANS( align=center>)\
    ARG2\
    NOTRANS(</td>)\
    XXnl()\
)

DEFINEMACRO(cellsline)(2)(\
    SETCOUNTER(XXx)(ARG1-1)\
    EVAL(NOTRANS(ADDTOCOUNTER(XXx))(NOTRANS(-)COUNTERVALUE(XXcol)))\
    IFGREATER(XXx)(-1)(\
        ADDTOCOUNTER(XXcol)(XXx+ARG2)\
        XXifnzero(XXx)(\
            NOTRANS(<td cellspan=)COUNTERVALUE(XXx)NOTRANS(></td>))\
        NOTRANS(<td cellspan=ARG2><hr/></td>)\
    )()\
)

DEFINEMACRO(center)(1)(\
    ADDTOCOUNTER(XXcenter)(1)\
    XXnl()\
    ARG1\
    +XXnl()\
    ADDTOCOUNTER(XXcenter)(-1)\
)

DEFINEMACRO(chapter)(1)(\
    SETCOUNTER(XXsectcounter)(0)\
    SETCOUNTER(XXsubsectcounter)(0)\
    SETCOUNTER(XXsubsubsectcounter)(0)\
    ADDTOCOUNTER(XXchaptercounter)(1)\
    XXsetlastnumber(COUNTERVALUE(XXchaptercounter))\
    xmlnewfile()\
    NOTRANS(<h1>)\
    getchapterstring() \
    SYMBOLVALUE(XXlastnumber): \
    ARG1\
    +NOTRANS(</h1>)\
    XXtocentry(chap getchapterstring() SYMBOLVALUE(XXlastnumber): ARG1)\
)

DEFINEMACRO(cindex)(1)(\
)

DEFINEMACRO(cite)(1)(\
    [ARG1]\
)

DEFINEMACRO(clearpage)(0)(\
    XXmlbeginp()\
)

DEFINEMACRO(code)(1)(\
    XXnl()\
    XXmlAtContext(markup)\    
    (\
        NOTRANS(<pre>)\
        NOEXPAND(ARG1)\
        NOTRANS(</pre>)\
        XXnl()\
    )
    ()\
)

DEFINEMACRO(columnline)(2)(\
    SETCOUNTER(XXx)(ARG1)\
    ADDTOCOUNTER(XXx)(-1)\
    NOTRANS(<tr>)\
    XXifnzero(XXx)
    (\
        NOTRANS(<td colspan=)\
        COUNTERVALUE(XXx)\
        NOTRANS(</td>)\
    )\
    SETCOUNTER(XXx)(ARG2-ARG1+1)\
    NOTRANS(<td colspan=)\
    COUNTERVALUE(XXx)\
    NOTRANS(><hr/></td></tr>)
    XXnl()\
)

DEFINEMACRO(dashes)(1)(\
PUSHSUBST(0)\
    NOTRANS(<tt>--</tt>)\
POPSUBST()\
)

DEFINEMACRO(def)(3)(\
    DEFINEMACRO(ARG1)(ARG2)(ARG3)\
)

DEFINEMACRO(description)(1)(\
    XXmlendp()\
    NOTRANS(<ul>)\
    PUSHCOUNTER(XXused)(0)\
    ARG1\
    +XXmlEndList()\
    NOTRANS(</ul>)\
    POPCOUNTER(XXused)\
)

DEFINEMACRO(dit)(1)(\
    it() ARG1\
)

DEFINEMACRO(eit)(0)(\
    XXmlBeginList()\
    USECOUNTER(XXenumcounter).\
)

DEFINEMACRO(ellipsis)(0)(\
    NOTRANS(...)\
)

DEFINEMACRO(em)(1)(\
    XXmlAtContext(markup)
    (\
        NOTRANS(<em>)\
        ARG1\
        +NOTRANS(</em>)\
    )
    (\
        ARG1\
    )\
)

DEFINEMACRO(email)(1)(\
    nemail(ARG1)(ARG1)\
)

DEFINEMACRO(enumerate)(1)(\
    enumeration(ARG1)\
)

DEFINEMACRO(enumeration)(1)(\
    PUSHCOUNTER(XXenumcounter)(0)\
    XXmlendp()\
    NOTRANS(<ol>)\
    PUSHCOUNTER(XXused)(0)\
    ARG1\
    +XXmlEndList()\
    NOTRANS(</ol>)\
    POPCOUNTER(XXused)\
    POPCOUNTER(XXenumcounter)\
)

DEFINEMACRO(euro)(0)(\
    htmlcommand(&euro;)\
)

DEFINEMACRO(evalsymbol)(2)(\
    EVAL(SETSYMBOL+nop()(ARG1)(ARG2))\
)

DEFINEMACRO(fig)(1)(\
    getfigurestring() \
    ref(ARG1)\
)

DEFINEMACRO(figure)(3)(\
    XXsetlastnumber(COUNTERVALUE(XXfigurecounter))\
    label(ARG3)\
    XXmlEndBlock()\
    XXmlPushContext(outer)\
    NOTRANS(\
        <s:picture>\
        <s:img src="\
    )\
    ARG1\
    +SYMBOLVALUE(XXfigureext)\
    NOTRANS(\
        "/>\
        <s:caption>
        <s:text>\
    )\
    getfigurestring() SYMBOLVALUE(XXlastnumber): ARG2\
    +NOTRANS(\
        </s:text>\
        </s:caption>\
        </s:picture>\
    )\
    XXmlPopContext()\
    XXmlBeginBlock()\
    ADDTOCOUNTER(XXfigurecounter)(1)\
)

DEFINEMACRO(file)(1)(\
    NOTRANS(<strong>)\
    ARG1\
    +NOTRANS(</strong>)\
)

DEFINEMACRO(findex)(1)(\
)

DEFINEMACRO(footnote)(1)(\
    \ (ARG1)\
)

DEFINEMACRO(gagmacrowarning)(1)(\
    NOUSERMACRO(ARG1)\
)

DEFINEMACRO(getaffilstring)(0)(\
    SYMBOLVALUE(XXaffilstring)\
)

DEFINEMACRO(getauthorstring)(0)(\
    SYMBOLVALUE(XXauthorstring)\
)

DEFINEMACRO(getchapterstring)(0)(\
    SYMBOLVALUE(XXchapterstring)\
)

DEFINEMACRO(getdatestring)(0)(\
    SYMBOLVALUE(XXdatestring)\
)

DEFINEMACRO(getfigurestring)(0)(\
    SYMBOLVALUE(XXfigurestring)\
)

DEFINEMACRO(getpartstring)(0)(\
    SYMBOLVALUE(XXpartstring)\
)

DEFINEMACRO(gettitlestring)(0)(\
    SYMBOLVALUE(XXtitlestring)\
)

DEFINEMACRO(gettocstring)(0)(\
    SYMBOLVALUE(XXtocstring)\
)

DEFINEMACRO(htmlbodyopt)(2)(\
)

DEFINEMACRO(htmlcommand)(1)(\
)

DEFINEMACRO(htmlheadfile)(1)(\
)

DEFINEMACRO(htmlheadopt)(1)(\
)

DEFINEMACRO(htmlnewfile)(0)(\
)

DEFINEMACRO(htmlstyle)(2)(\
)

DEFINEMACRO(htmlstylesheet)(1)(\
)

DEFINEMACRO(htmltag)(2)(\
    IFZERO(ARG2)(\
        NOTRANS(</ARG1>)\
    )(\
        XXtag(ARG1))\
)

DEFINEMACRO(ifnewparagraph)(2)(\
    IFZERO(XXwrotetext)(\
        ARG2
    )(\
        ARG1)\
)

DEFINEMACRO(includefile)(1)(\
    TYPEOUT(Yodl: including file ARG1)\
    INCLUDEFILE(ARG1)\
)

DEFINEMACRO(includeverbatim)(1)(\
    PUSHCHARTABLE()\
    NOEXPANDINCLUDE(ARG1)\
    POPCHARTABLE()\
)

DEFINEMACRO(it)(0)(\
    XXmlBeginList()\
)

DEFINEMACRO(itdesc)(2)(\
    dit(ARG1)XXnl()\
    quote(ARG2)\
)

DEFINEMACRO(itemization)(1)(\
    XXmlendp()\
    NOTRANS(<ul>)\
    PUSHCOUNTER(XXused)(0)\
    ARG1\
    +XXmlEndList()\
    NOTRANS(</ul>)\
    POPCOUNTER(XXused)\
)

DEFINEMACRO(kindex)(1)(\
)

DEFINEMACRO(label)(1)(\
    INTERNALINDEX(xmllabel ARG1)\
)

DEFINEMACRO(langle)(0)(\
    CHAR(<)\
)

DEFINEMACRO(languagedutch)(0)(\
    setaffilstring(Organisatie)\
    setauthorstring(Auteur)\
    setchapterstring(Hoofdstuk)\
    setdatestring(Datum)\
    setfigurestring(Figuur)\
    setpartstring(Deel)\
    settitlestring(Titel)\
    settocstring(Inhoudsopgave)\
)

DEFINEMACRO(languageenglish)(0)(\
    settocstring(Table of Contents)\
    setaffilstring(Affiliation)\
    setauthorstring(Author)\
    setchapterstring(Chapter)\
    setdatestring(Date)\
    setfigurestring(Figure)\
    setpartstring(Part)\
    settitlestring(Title)\
)

DEFINEMACRO(languageportugese)(0)(\
    setaffilstring(AFILIAÇÃO)\
    setauthorstring(AUTOR)\
    setchapterstring(Capítulo)\
    setdatestring(DATA)\
    setfigurestring(figura)\
    setpartstring(Parte)\
    settitlestring(TÍTULO)\
    settocstring(Índice)\
)

DEFINEMACRO(LaTeX)(0)(\
    NOTRANS(LaTeX)\
)

DEFINEMACRO(latexaddlayout)(1)(\
)

DEFINEMACRO(latexcommand)(1)(\
)

DEFINEMACRO(latexdocumentclass)(1)(\
    SETSYMBOL(XXdocumentclass)(ARG1)\
)

DEFINEMACRO(latexlayoutcmds)(1)(\
)

DEFINEMACRO(latexoptions)(1)(\
)

DEFINEMACRO(latexpackage)(2)(\
)

DEFINEMACRO(lchapter)(2)(\
    SETCOUNTER(XXsectcounter)(0)\
    SETCOUNTER(XXsubsectcounter)(0)\
    SETCOUNTER(XXsubsubsectcounter)(0)\
    ADDTOCOUNTER(XXchaptercounter)(1)\
    XXsetlastnumber(COUNTERVALUE(XXchaptercounter))\
    xmlnewfile()\
    label(ARG1)\
    NOTRANS(<h1>)\
    getchapterstring() \
    SYMBOLVALUE(XXlastnumber): \
    ARG2\
    +NOTRANS(</h1>)\
    XXtocentry(chap getchapterstring() SYMBOLVALUE(XXlastnumber): ARG2)\
)

DEFINEMACRO(letter)(6)(\
    ERROR(The letter document is available for LaTeX conversions only)
)

DEFINEMACRO(letteraddenda)(2)(\
)

DEFINEMACRO(letteradmin)(2)(\
)

DEFINEMACRO(letterfootitem)(2)(\
)

DEFINEMACRO(letterreplyto)(3)(\
)

DEFINEMACRO(letterto)(1)(\
)

DEFINEMACRO(link)(2)(\
    NOTRANS(<a href=")\
    INTERNALINDEX(xmlsolvelink ARG2)\
    NOTRANS(">)\
    ARG1\
    +NOTRANS(</a>)\
)

DEFINEMACRO(lref)(2)(\
    NOTRANS(<a href=")\
    INTERNALINDEX(xmlsolvelink ARG2)\
    NOTRANS(">)\
    ARG1 XXlabelvalue(ARG2)\
    NOTRANS(</a>)\
)

DEFINEMACRO(lsect)(2)(\
    XXsectCounter()\
    label(ARG1)\
    XXsect(ARG2)\
)

DEFINEMACRO(lsubsect)(2)(\
    XXsubsectCounter()\
    label(ARG1)\
    XXsubsect(ARG2)\
)

DEFINEMACRO(lsubsubsect)(2)(\
    XXsubsubsectCounter()\
    label(ARG1)\
    XXsubsubsect(ARG2)\
)

DEFINEMACRO(lsubsubsubsect)(2)(\
    label(ARG1)\
    subsubsubsect(ARG2)\
)

DEFINEMACRO(lurl)(1)(\
    url(ARG1)(ARG1)\
)

DEFINEMACRO(mailto)(1)(\
)

DEFINEMACRO(makeindex)(0)(\
)

DEFINEMACRO(mancommand)(1)(\
)

DEFINEMACRO(manpage)(5)(\
    notableofcontents()\
    XXstartdocument(article)\
    ATEXIT(XXcheckmanpage())\
    ATEXIT(INTERNALINDEX(copy))\
    ERROR(man-page conversions only for yodl2man and yodl2html)
)

DEFINEMACRO(manpageauthor)(0)(\
    manpagesection(AUTHOR)\
    DEFINESYMBOL(XXmanpageAuthor)()\
)

DEFINEMACRO(manpagebugs)(0)(\
    manpagesection(BUGS)\
)

DEFINEMACRO(manpagedescription)(0)(\
    manpagesection(DESCRIPTION)\
)

DEFINEMACRO(manpagediagnostics)(0)(\
    manpagesection(DIAGNOSTICS)\
)

DEFINEMACRO(manpagefiles)(0)(\
    manpagesection(FILES)\
)

DEFINEMACRO(manpagename)(2)(\
    manpagesection(NAME)\
    DEFINESYMBOL(XXmanpageName)()\
    ARG1 - ARG2\
)

DEFINEMACRO(manpageoptions)(0)(\
    manpagesection(OPTIONS)\
)

DEFINEMACRO(manpagesection)(1)(\
    IFDEF(XXmanpageAuthor)
    (\
        ERROR(manpageauthor() MUST be the last section of the manpage.)
    )()\
    nsect(ARG1)\
)

DEFINEMACRO(manpageseealso)(0)(\
    manpagesection(SEE ALSO)\
)

DEFINEMACRO(manpagesynopsis)(0)(\
    manpagesection(SYNOPSIS)\
)

DEFINEMACRO(manttquoted)(1)(\
)

DEFINEMACRO(mbox)(1)(\
    ARG1\
)

PUSHWSLEVEL()\
DEFINEMACRO(metaC)(1)(\
    IFSTRSUB(ARG1)(
)
    (\
        WARNING(NOEXPAND(metaC()) ignored: multiple lines in argument)\
    )
    (\
        NOTRANS(<!--)\
        ARG1\
        +NOTRANS(-->)\
    )\
)\
POPWSLEVEL()

DEFINEMACRO(metaCOMMENT)(1)(\
    NOTRANS(<!--)\
    ARG1\
    +NOTRANS(-->)\
)

DEFINEMACRO(mscommand)(1)(\
)

DEFINEMACRO(nbsp)(1)(\
    IFEMPTY(ARG1)(\
        XXnbsp(1)\
    )(\
        XXnbsp(ARG1))\
)

DEFINEMACRO(nchapter)(1)(\
    SETCOUNTER(XXsectcounter)(0)\
    SETCOUNTER(XXsubsectcounter)(0)\
    SETCOUNTER(XXsubsubsectcounter)(0)\
    xmlnewfile()\
    XXtocentry(chap getchapterstring() ARG1)\
    NOTRANS(<h1>)getchapterstring() \
    ARG1\
    +NOTRANS(</h1>)\
)

DEFINEMACRO(nemail)(2)(\
    url(em(ARG1))(mailto:ARG2)\
)

DEFINEMACRO(nl)(0)(\
    XXmlendp()\
    XXmlbeginp()\
)

DEFINEMACRO(nodenmame)(1)(
)

DEFINEMACRO(nodeprefix)(1)(
)

DEFINEMACRO(nodetext)(1)(\
)

DEFINEMACRO(nohtmlfive)(0)(\
)

DEFINEMACRO(nohtmlimgstyle)(0)(\
)

DEFINEMACRO(nop)(1)(\
    ARG1\
)

DEFINEMACRO(nosloppyhfuzz)(0)(\
)

DEFINEMACRO(notableofcontents)(0)(\
    SETSYMBOL(XXgeneratetoc)()\
)

DEFINEMACRO(notitleclearpage)(0)(\
    SETSYMBOL(XXtitleclearpage)()\
)

DEFINEMACRO(notocclearpage)(0)(\
)

DEFINEMACRO(notransinclude)(1)(\
    PUSHCHARTABLE()\
    NOEXPANDINCLUDE(ARG1)\
    POPCHARTABLE()\
)

DEFINEMACRO(noxlatin)(0)(\
)

DEFINEMACRO(nparagraph)(1)(\
    paragraph(ARG1)\
)

DEFINEMACRO(npart)(1)(\
    NOTRANS(<h1>)\
    getpartstring() \
    ARG1\
   +NOTRANS(</h1>)
)

DEFINEMACRO(nsect)(1)(\
    SETCOUNTER(XXsubsectcounter)(0)\
    SETCOUNTER(XXsubsubsectcounter)(0)\
    XXmlendp()\
    NOTRANS(<h2>)\
    ARG1\
    +NOTRANS(</h2>)\
)

DEFINEMACRO(nsubsect)(1)(\
    SETCOUNTER(XXsubsubsectcounter)(0)\
    XXmlendp()\
    NOTRANS(<h3>)\
    ARG1\
    +NOTRANS(</h3>)\
)

DEFINEMACRO(nsubsubsect)(1)(\
    NOTRANS(<h4>)\
    ARG1\
    +NOTRANS(</h4>)\
)

DEFINEMACRO(nsubsubsubsect)(1)(\
    subsubsubsect(ARG1)\
)

DEFINEMACRO(PageEnlarged)(4)(\
)

DEFINEMACRO(paragraph)(1)
(
    XXmlendp()\
    XXmlbeginp()\
    bf(ARG1)\
    XXclosep()\
    XXopenp()\
)

DEFINEMACRO(part)(1)(\
    ADDTOCOUNTER(XXpartcounter)(1)\
    XXsetlastnumber(COUNTERVALUE(XXpartcounter))\
    NOTRANS(<h1>)\
    getpartstring()\
    SYMBOLVALUE(XXlastnumber): \
    ARG1\
    +NOTRANS(</h1>)\
    XXtocentry(\
        NOTRANS(<h2>)\
        getpartstring() \
        SYMBOLVALUE(XXlastnumber): \
        ARG1\
        +NOTRANS(</h2>)\
    )\
)

DEFINEMACRO(pindex)(1)(\
)

DEFINEMACRO(plainhtml)(1)(\
)

DEFINEMACRO(printindex)(0)(\
)

DEFINEMACRO(quote)(1)
(
    XXmlPushContext(nomarkup)\
    NOTRANS(<blockquote>)\
    ARG1\
    +XXmlendp()\
    NOTRANS(</blockquote>)\
    XXmlPopContext()\
)

DEFINEMACRO(rangle)(0)(\
    CHAR(>)\
)

DEFINEMACRO(redef)(3)(\
    DELETEMACRO(ARG1)\
    DEFINEMACRO(ARG1)(ARG2)(ARG3)\
)

DEFINEMACRO(redefinemacro)(3)(\
    redef(ARG1)(ARG2)(ARG3)\
)

DEFINEMACRO(ref)(1)(\
    INTERNALINDEX(xmlref ARG1)\
)

DEFINEMACRO(report)(3)(\
    redef(part)(1)(ERROR(parts only available in books!))\
    redef(npart)(1)(part())\
    XXstartdocument(report)\
    IFSTREQUAL(XXdocumentbase)()(\
        WARNING(XXdocumentbase empty. Maybe use \
                                        NOEXPAND(xmlsetdocumentbase())?)\
    )()\
    notransinclude(SYMBOLVALUE(XXarticleBegin))\
    ATEXIT(\
        XXmlendp()\
        INTERNALINDEX(xmldone 0)\
    )\
    XXsetdocumentheader(ARG1)(ARG2)(ARG3)\
)

DEFINEMACRO(roffcmd)(4)(\
)

DEFINEMACRO(row)(1)(\
    PUSHCOUNTER(XXcol)(0)\
    +XXnl()\
    NOTRANS(<tr>)
    XXnl()\
    ARG1 \
    XXnl()\
    NOTRANS(</tr>)\
    +XXnl()\
    POPCOUNTER(XXcol)\
)

DEFINEMACRO(rowline)(0)(\
    NOTRANS(<td colspan=)\
    COUNTERVALUE(XXtablewidth)\
    NOTRANS(></td>)\
    XXnl()\
)

DEFINEMACRO(sc)(1)(\
    NOTRANS(<font size=-1><pre>)\
    NOEXPAND(ARG1)\
    NOTRANS(</pre></font>)\
)

DEFINEMACRO(sect)(1)(\
    XXsectCounter()\
    XXsect(ARG1)\
)

DEFINEMACRO(setaffilstring)(1)(\
    SETSYMBOL(XXaffilstring)(ARG1)\
)

DEFINEMACRO(setauthorstring)(1)(\
    SETSYMBOL(XXauthorstring)(ARG1)\
)

DEFINEMACRO(setchapterstring)(1)(\
    SETSYMBOL(XXchapterstring)(ARG1)\
)

DEFINEMACRO(setdatestring)(1)(\
    SETSYMBOL(XXdatestring)(ARG1)\
)

DEFINEMACRO(setfigureext)(1)(\
    SETSYMBOL(XXfigureext)(ARG1)\
)

DEFINEMACRO(setfigurestring)(1)(\
    SETSYMBOL(XXfigurestring)(ARG1)\
)

DEFINEMACRO(sethtmlfigureext)(1)(\
)

DEFINEMACRO(htmlmetacharset)(1)(\
)

DEFINEMACRO(setincludepath)(1)(\
    IFSTRSUB(ARG1)(.:)
    ()(\
        WARNING("No .: specification in ARG1))\
    SETSYMBOL(XXincludePath)(ARG1)\
)

DEFINEMACRO(setlanguage)(1)(\
    IFMACRO(languageARG1)(\
        languageARG1()\
    )(\
        ERROR(language ARG1 not yet supported))\
)

DEFINEMACRO(setlatexalign)(1)(\
)

DEFINEMACRO(setlatexfigureext)(1)(\
)

DEFINEMACRO(setlatexverbchar)(1)(\
)

DEFINEMACRO(setmanalign)(1)(\
)

DEFINEMACRO(setpartstring)(1)(\
    SETSYMBOL(XXpartstring)(ARG1)\
)

DEFINEMACRO(setrofftab)(1)(\
)

DEFINEMACRO(setrofftableoptions)(1)(\
)

DEFINEMACRO(settitlestring)(1)(\
    SETSYMBOL(XXtitlestring)(ARG1)\
)

DEFINEMACRO(settocstring)(1)(\
    SETSYMBOL(XXtocstring)(ARG1)\
)

DEFINEMACRO(sgmlcommand)(1)(\
)

DEFINEMACRO(sgmltag)(2)(\
    htmltag(ARG1)(ARG2)\
)

DEFINEMACRO(sloppyhfuzz)(1)(\
)

DEFINEMACRO(standardlayout)(0)(\
)

DEFINEMACRO(XXstarttableatt)(2)(\
    PUSHCOUNTER(XXtablewidth)(ARG1)\
    XXmlIncBlock()\
    NOTRANS(<table><tbody>)\
    XXnl()\
)

DEFINEMACRO(strong)(1)(\
    NOTRANS(<strong>)ARG1+NOTRANS(</strong>)\
)

DEFINEMACRO(subs)(1)(\
    XXtag(sub)\
    ARG1\
    +NOTRANS(</sub>)\
)

DEFINEMACRO(subsect)(1)(\
    XXsubsectCounter()\
    XXsubsect(ARG1)\
)

DEFINEMACRO(subsubsect)(1)(\
    XXsubsubsectCounter()\
    XXsubsubsect(ARG1)\
)

DEFINEMACRO(subsubsubsect)(1)
(
    NOTRANS(<h3>)\
    ARG1\
    +NOTRANS(</h3>)\
)

DEFINEMACRO(sups)(1)(\
    NOTRANS(<sup>)\
    ARG1\
    +NOTRANS(</sup>)\
)

DEFINEMACRO(table)(3)(\
    XXstarttable(ARG1)(ARG2)\
    XXendtable(ARG3)\
)

DEFINEMACRO(tableatt)(3)(\
    XXstarttableatt(ARG1)(ARG2)\
    XXendtable(ARG3)\
)

DEFINEMACRO(tac)(2)(\
    +XXtc(ARG2)(1)()\
)

DEFINEMACRO(tao)(2)(\
    IFDEF(ARG1)(\
        SETSYMBOL(XXtao)(ARG2)\
    )()\
)

DEFINEMACRO(tbl)(2)(\
    XXtblbegin(ARG1)\
    XXtblend(ARG2)\
)

DEFINEMACRO(tc)(1)(\
    XXtc(ARG1)(1)()\
)

DEFINEMACRO(tcell)(1)(\
    cell(ARG1)\
)

DEFINEMACRO(telycommand)(1)(\
)

DEFINEMACRO(TeX)(0)(\
    NOTRANS(TeX)\
)

DEFINEMACRO(texinfocommand)(1)(\
)

DEFINEMACRO(tindex)(1)(\
)

DEFINEMACRO(titleclearpage)(0)(\
    SETSYMBOL(XXtitleclearpage)()\
)

DEFINEMACRO(tline)(2)(\
    IFEMPTY(ARG2)(\//                    no endline was specified: end the row
        XXtlineEnd(ARG1)\
    )(\
        XXtlinePart(ARG1)(ARG2))\
)

DEFINEMACRO(tnac)(3)(\
)

DEFINEMACRO(tnc)(2)(\
)

DEFINEMACRO(tocclearpage)(0)(\
)

DEFINEMACRO(tr)(1)(\
    PUSHCOUNTER(XXtr)(1)\
    PUSHCOUNTER(XXcol)(0)\
    POPCOUNTER(XXcol)\
    POPCOUNTER(XXtr)\
)

DEFINEMACRO(tt)(1)(\
    NOTRANS(<tt>)\
    NOEXPAND(ARG1)\
    NOTRANS(</tt>)\
)

DEFINEMACRO(ttbegin)(0)(\
    NOTRANS(<tt>)\
)

DEFINEMACRO(ttend)(0)(\
    NOTRANS(</tt>)\
)

DEFINEMACRO(twrap)(1)(\
)

DEFINEMACRO(txtcommand)(1)(\
)

DEFINEMACRO(url)(2)(\
    NOTRANS(<a href=")\
    ARG2\
    +NOTRANS(">)\
    ARG1\
    +NOTRANS(</a>)\
)

DEFINEMACRO(verb)(1)(\
    PUSHSUBST(0)\
    verborg(ARG1)\
    POPSUBST()\
)

DEFINEMACRO(verbinclude)(1)(\
    NOTRANS(<pre>)\
    XXnl()\
    NOEXPANDINCLUDE(ARG1)\
    NOTRANS(</pre>)\
    XXnl()\
)

DEFINEMACRO(verbinsert)(1)(\
    PIPETHROUGH(yodlverbinsert -N ARG1)()\
)

DEFINEMACRO(verborg)(1)(\
    XXmlendp()\
    NOTRANS(<pre>)\
    NOEXPAND(ARG1)\
    NOTRANS(</pre>)\
    XXnl()\
)

DEFINEMACRO(verbpipe)(2)(\
    PUSHCHARTABLE()\
    PIPETHROUGH(ARG1)(ARG2)()\
    POPCHARTABLE()\
)

DEFINEMACRO(vindex)(1)(\
)

DEFINEMACRO(whenhtml)(1)(\
)

DEFINEMACRO(whenlatex)(1)(\
)

DEFINEMACRO(whenman)(1)(\
)

DEFINEMACRO(whenms)(1)(\
)

DEFINEMACRO(whensgml)(1)(\
)

DEFINEMACRO(whentely)(1)(\
)

DEFINEMACRO(whentexinfo)(1)(\
)

DEFINEMACRO(whentxt)(1)(\
)

DEFINEMACRO(whenxml)(1)(\
    ARG1\
)

DEFINEMACRO(xit)(1)(\
    NOTRANS(<menuItem><s:ref type="path">)\
    SYMBOLVALUE(XXdocumentbase)ARG1\
    +NOTRANS(</s:ref></menuItem>)\
)

DEFINEMACRO(xmlcommand)(1)(\
    NOTRANS(ARG1)\
)

DEFINEMACRO(xmlmenu)(3)(\
    notransinclude(XXmenuBegin)\
    ATEXIT(\
        XXmlendp()\
        INTERNALINDEX(copy)\
    )\
    XXmlPushContext(nomarkup)\
    ARG2\
    +notransinclude(XXmenuEndTitle)\
    ARG3\
    +NOTRANS(</menu>)\
    XXnl()\
    XXifnempty(ARG1)
    (\
        NOTRANS(<order>)\
        ARG1\
        +NOTRANS(</order>)\
        XXnl()\
    )\
    notransinclude(XXmenuEnd)\
    XXmlPopContext(nomarkup)\
)

DEFINEMACRO(xmlnewfile)(0)(\
    XXmlendp()\
    INTERNALINDEX(xmlnewfile  0)\
)

DEFINEMACRO(xmlsetdocumentbase)(1)(\
    SETSYMBOL(XXdocumentbase)(ARG1)\
    XXsymbolindex(XXdocumentbase)\
)

DEFINEMACRO(xmltag)(2)(\
    htmltag(ARG1)(ARG2)\
)

DEFINEMACRO(XXabstract)(0)(\
    IFSTREQUAL(XXabstracttext)()
    ()(\
        IFSTREQUAL(XXdocumentclass)(book)(
            ERROR(abstracts cannot appear in books!))()\
        XXnl()\
        quote(SYMBOLVALUE(XXabstracttext))\
        XXnl()\
    )\
)

DEFINEMACRO(XXaddntosymbol)(2)(\
    XXifnzero(XXx)(\
        ADDTOSYMBOL(ARG1)(ARG2)\
        ADDTOCOUNTER(XXx)(-1)\
        XXaddntosymbol(ARG1)(ARG2)\// recursive call for the next symbol
    )\
)

DEFINEMACRO(XXchapternum)(0)(\
    IFSTREQUAL(XXdocumentclass)(article)
    ()(\
        COUNTERVALUE(XXchaptercounter).\
    )\
)

DEFINEMACRO(XXcheckmanpage)(0)(\
    IFSYMBOL(XXmanpageName)
    ()(\
        ERROR(manpage has missing manpagename()() entry)
    )\
    IFSYMBOL(XXmanpageAuthor)
    ()(\
        ERROR(manpage has missing manpageauthor() entry)
    )\
)

DEFINEMACRO(XXendtable)(1)(\
    ARG1\
    +XXnl()\
    NOTRANS(</tbody></table>)\
    XXmlDecBlock()\
    POPCOUNTER(XXtablewidth)\
)

DEFINEMACRO(XXendXmlArticle)(0)\
(\
    XXendXhtmlBlock()\
    XXnotransPathInclude(SYMBOLVALUE(XXendXmlArt))\
    XXmlbeginp()\
    SYMBOLVALUE(XXabstracttext)\
    XXmlendp()\
    NOTRANS(\
        </div>\
        </s:xhtml>\
        </summary>\
        </ga:generalArticle>\
    )\
    XXnl()\
)

DEFINEMACRO(XXhtmlclass)(2)(\
)

DEFINEMACRO(XXifnempty)(2)(\
    IFSTREQUAL(ARG1)()
    ()(\
        ARG2\
    )\
)

DEFINEMACRO(XXifneq)(3)(\
    IFEQUAL(ARG1)(ARG2)\
    ()
    (\
        ARG3\
    )\
)

DEFINEMACRO(XXifnzero)(2)(\
    IFZERO(ARG1)
    ()(\
        ARG2\
    )\
)

DEFINEMACRO(XXlabelvalue)(1)(\
    INTERNALINDEX(labvalue ARG1)\
)

DEFINEMACRO(XXmanclass)(1)(\
)

DEFINEMACRO(XXmlAtContext)(3)(\
    IFSTREQUAL(XXcontext)(ARG1)(\
        ARG2\
    )(\
        ARG3)\
)

DEFINEMACRO(XXmlBeginBlock)(0)(\
    IFZERO(XXblock)(\
        ADDTOCOUNTER(XXblock)(1)\
        XXifnempty(XXxhtmlBegin)
        (\
            notransinclude(XXxhtmlBegin)\
            XXmlPushContext(markup)\
        )\
    )(\
        ERROR(XXmlBeginBlock: The xhtmlBlock is already open)\
    )\
)

DEFINEMACRO(XXmlBeginList)(0)
(\
    XXmlEndList()\
    NOTRANS(<li>)\
    SETCOUNTER(XXused)(1)\
)

DEFINEMACRO(XXmlbeginp)(0)(\
    XXmlendp()\
    NOTRANS(<p>)\
    SETCOUNTER(XXp)(1)\
)

DEFINEMACRO(XXmlDecBlock)(0)(\
    IFZERO(XXblock)(\
        ERROR(The xhtmlBlock is not yet open)\
    )(\
        IFEQUAL(XXblock)(2)(\
            SETCOUNTER(XXblock)(1)\
            XXmlEndBlock()\
            XXmlBeginBlock()\
        )(\
            ADDTOCOUNTER(XXblock)(-1)\
        )\
    )\
)

DEFINEMACRO(XXmlEndBlock)(0)(\
    IFEQUAL(XXblock)(1)(\
        SETCOUNTER(XXblock)(0)\
        DELETESYMBOL(XXcontext)\
        DEFINESYMBOL(XXcontext)()\
        XXmlendp()
        XXifnempty(XXxhtmlEnd)(\
            notransinclude(XXxhtmlEnd))\
    )(\
        ERROR(XXmlEndBlock: The xhtmlBlock is not at level 1))\
)

DEFINEMACRO(XXmlEndList)(0)(\
    XXmlendp()\
    XXifnzero(XXused)(\
        NOTRANS(</li>)\
    )\
)

DEFINEMACRO(XXmlendp)(0)(\
    XXifnzero(XXp)\
    (
        SETCOUNTER(XXp)(0)\
        NOTRANS(</p>)\
    )\
)

DEFINEMACRO(XXmlHead)(2)\
(\
    XXmlPushContext(nomarkup)\
    NOTRANS(<h)\
    ARG1\
    +CHAR(>)\
    ARG2\
    +NOTRANS(</h)\
    ARG1\
    +CHAR(>)\
    XXmlPopContext()\
    XXnl()\
)

DEFINEMACRO(XXmlIncBlock)(0)(\
    IFZERO(XXblock)(\
        ERROR(The xhtmlBlock is not yet open)\
    )(\
        IFEQUAL(XXblock)(1)(\
            XXmlEndBlock()\
            XXmlBeginBlock()\
            SETCOUNTER(XXblock)(2)\
        )(\
            ADDTOCOUNTER(XXblock)(1))\
    )\
)

DEFINEMACRO(XXmlPopContext)(1)\
(\
    XXmlendp()\
    POPSYMBOL(XXcontext)\
)

DEFINEMACRO(XXmlPushContext)(1)\
(\
    XXmlendp()\
    PUSHSYMBOL(XXcontext)(ARG1)\
)

DEFINEMACRO(XXnbsp)(1)(\
    XXifnzero(ARG1)(\
        NOTRANS(&nbsp;)\
        SETCOUNTER(XXx)(ARG1-1)\
        EVAL(XXnbsp+nop()(COUNTERVALUE(XXx)))\
    )\
)

PUSHWSLEVEL(0)\
DEFINEMACRO(XXnl)(0)(\
    CHAR(
)\
)\
POPWSLEVEL()

DEFINEMACRO(XXnotransPathInclude)(1)\
(\
    PUSHCHARTABLE()\
    NOEXPANDPATHINCLUDE(ARG1)\
    POPCHARTABLE()\
)

DEFINEMACRO(XXroffcmd)(4)(\
    XXnl()\
    NOTRANS(ARG1) ARG2\
    +XXifnempty(ARG3)
    (\
        XXnl()\
        ARG3\
    )\
    XXifnempty(ARG4)
    (\
        XXnl()\
        NOTRANS(ARG4)\
    )\
    INTERNALINDEX(ignorews)
    XXnl()\
)

DEFINEMACRO(XXsect)(1)(\
    XXmlendp()\
    XXtocentry(sect SYMBOLVALUE(XXlastnumber): ARG1)\
    NOTRANS(<h2>)\
    SYMBOLVALUE(XXlastnumber): ARG1\
    +NOTRANS(</h2>)\
)

DEFINEMACRO(XXsectCounter)(0)(\
    SETCOUNTER(XXsubsectcounter)(0)\
    SETCOUNTER(XXsubsubsectcounter)(0)\
    ADDTOCOUNTER(XXsectcounter)(1)\
    XXsetlastnumber(XXchapternum()COUNTERVALUE(XXsectcounter))\
)

DEFINEMACRO(XXsetdocumentheader)(3)(\
    XXsetxmldocumentheader(ARG1)(ARG2)(ARG3)\
)


DEFINEMACRO(XXsetlastnumber)(1)(\
    SETSYMBOL(XXlastnumber)(ARG1)\
    INTERNALINDEX(lastnumber SYMBOLVALUE(XXlastnumber))\
)


DEFINEMACRO(XXsetmandocumentheader)(3)(\
    XXifnempty(ARG1)(\
        XXroffcmd(.TH)(NOTRANS(")ARG1+NOTRANS(") NOTRANS(")\
            ARG3+NOTRANS("))()(.PP)\
        XXroffcmd(.SH)(NOTRANS(")ARG1+NOTRANS("))()()
    )\
    XXifnempty(ARG2)(\
        XXroffcmd(.SH)(NOTRANS(")ARG2+NOTRANS("))()()\
    )\
    XXifnempty(XXaffilstring)(\
        XXroffcmd(.SH)(NOTRANS(")SYMBOLVALUE(XXaffilstring)NOTRANS("))()()\
    )\
    XXifnempty(ARG3)(\
        XXroffcmd(.SH)(NOTRANS(")ARG3+NOTRANS("))()()\
    )\
)    

DEFINEMACRO(XXsettitleclearpage)(0)(\
)

DEFINEMACRO(XXsettocclearpage)(0)(\
    XXifnempty(XXtocclearpage)
    (\
        clearpage()\
    )\
)


DEFINEMACRO(XXsetxmldocumentheader)(3)(\
    INTERNALINDEX(preset title ARG1)\
    XXmlPushContext(nomarkup)\
    ARG1\
    +notransinclude(XXarticleEndTitle)\
    XXmlBeginBlock()\
    +XXifnempty(ARG2)
    (\
        XXmlHead(2)(ARG2)\
    )\
    XXifnempty(XXaffilstring)
    (\
        XXmlHead(2)
        (\
            SYMBOLVALUE(XXaffilstring)\
        )\
    )\
    XXifnempty(ARG3)
    (\
        XXmlHead(2)(ARG3)\
    )\
    XXabstract()\
    XXnl()\
    XXtableofcontents()\
)

DEFINEMACRO(XXstartdocument)(1)(\
    TYPEOUT(Yodl is processing a+nop()(n) ARG1)\
    SETSYMBOL(XXdocumentclass)(ARG1)\
    INTERNALINDEX(preset documenttype ARG1)\
    XXsymbolindex(XXxhtmlBegin)\
    XXsymbolindex(XXxhtmlEnd)\
    XXsymbolindex(XXarticleBegin)\
    XXsymbolindex(XXarticleEndTitle)\
    XXsymbolindex(XXarticleSummary)\
    XXnl()\
)

DEFINEMACRO(XXstarttable)(2)(\
    PUSHCOUNTER(XXtablewidth)(ARG1)\
    XXmlIncBlock()\
    NOTRANS(<table><tbody>)\
    XXnl()\
)

DEFINEMACRO(XXsubsect)(1)(\
    XXmlendp()\
    XXtocentry(ssect SYMBOLVALUE(XXlastnumber): ARG1)\
    NOTRANS(<h3>)\
    SYMBOLVALUE(XXlastnumber): ARG1\
    +NOTRANS(</h3>)\
)

DEFINEMACRO(XXsubsectCounter)(0)(\
    SETCOUNTER(XXsubsubsectcounter)(0)\
    ADDTOCOUNTER(XXsubsectcounter)(1)\
    XXsetlastnumber(\
        XXchapternum()\
        COUNTERVALUE(XXsectcounter).\
        COUNTERVALUE(XXsubsectcounter)\
    )\
)

DEFINEMACRO(XXsubsubsect)(1)(\
    XXtocentry(sssect SYMBOLVALUE(XXlastnumber): ARG1)\
    NOTRANS(<h4>)\
    SYMBOLVALUE(XXlastnumber): ARG1\
    +NOTRANS(</h4>)\
)

DEFINEMACRO(XXsubsubsectCounter)(0)(\
    ADDTOCOUNTER(XXsubsubsectcounter)(1)\
    XXsetlastnumber(\
        XXchapternum()\
        COUNTERVALUE(XXsectcounter).\
        COUNTERVALUE(XXsubsectcounter).\
        COUNTERVALUE(XXsubsubsectcounter)\
    )\
)

DEFINEMACRO(XXsymbolindex)(1)(\
    INTERNALINDEX(preset ARG1 SYMBOLVALUE(ARG1))\
)

DEFINEMACRO(XXtableofcontents)(0)(\
    IFSTREQUAL(XXgeneratetoc)()(\
    )(\
        INTERNALINDEX(xmltoc gettocstring())\
        XXnl()\
        XXsettocclearpage()\
    )\
)

DEFINEMACRO(XXtag)(1)(\
    NOTRANS(<)ARG1 attribinsert()\
    NOTRANS(>)\
)\

DEFINEMACRO(XXtblbegin)(1)(\
    EVAL(PUSHCOUNTER+nop()(XXtablewidth)(STRLEN(ARG1)))\
    XXnl()\
)

DEFINEMACRO(XXtblend)(1)(\
    ARG1\
    XXnl()\
    POPCOUNTER(XXtablewidth)\
)

DEFINEMACRO(XXtc)(3)(\
    SETSYMBOL(XXtao)()\
)

DEFINEMACRO(XXtlineClose)(1)(\
    ADDTOCOUNTER(XXcol)(-1)\
    IFGREATER(XXcol)(XXtablewidth)(\
        ERROR(Table width (COUNTERVALUE(XXtablewidth)) exceeded))()\
    POPCOUNTER(XXcol)\
)

DEFINEMACRO(XXtlineEnd)(1)(\
    IFZERO(XXcol)(\//            first call: do a row line
        XXtlineRow(ARG1)\
    )(\
        XXtlineClose())\//           previously called: end partial line(s)
)

DEFINEMACRO(XXtlineFirst)(1)(\
    PUSHCOUNTER(XXcol)(1)\//     colnr specified by XXcol; 
)

DEFINEMACRO(XXtlineNext)(2)(\
    SETCOUNTER(XXcol)(ARG2)\
)

DEFINEMACRO(XXtlinePart)(2)(\
    IFZERO(XXcol)(\//             first tline(beginNr)(endNr) call
        XXtlineFirst(ARG1))
    ()\
    SETCOUNTER(XXx)(ARG2+1)\
    EVAL(XXtlineNext+nop()(ARG1)(COUNTERVALUE(XXx)))\
)

DEFINEMACRO(XXtlineRow)(1)(\
    NOTRANS(    )\
    rowline()\
)

DEFINEMACRO(XXtlineSpan)(3)(\
)

DEFINEMACRO(XXtocentry)(1)(\
    INTERNALINDEX(xmltocentry ARG1)\
)

DECWSLEVEL()
