
INCWSLEVEL()

DEFINESYMBOL(html)()

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(XXattribstacksize)(0)
DEFINECOUNTER(XXhtmlimgstyle)(1)
DEFINECOUNTER(XXhtmlfive)(1)


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(XXbodyopt)             ()
DEFINESYMBOL(XXheadopt)             ()
DEFINESYMBOL(XXfigureext)           (.jpg)
DEFINESYMBOL(XXmailto)              ()
DEFINESYMBOL(XXhtmlstyleopt)        ()
DEFINESYMBOL(XXhtmlmetacharset)     (UTF-8)
DEFINESYMBOL(XXattrib)              ()
DEFINESYMBOL(XXheadfile)            ()

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)\
    ATEXIT(INTERNALINDEX(htmldone))\
    XXsetdocumentheader(ARG1)(ARG2)(ARG3)\
)

DEFINEMACRO(attrib)(1)(\
    ADDTOCOUNTER(XXattribstacksize)(1)\
    PUSHSYMBOL(XXattrib)(NOTRANS(ARG1))\
)

DEFINEMACRO(attribclear)(0)(\
    IFGREATER(XXattribstacksize)(0)\
    (\
        POPSYMBOL(XXattrib)\
        ADDTOCOUNTER(XXattribstacksize)(-1)\
        attribclear()\
    )()\
)

DEFINEMACRO(attribinsert)(0)(\
    IFGREATER(XXattribstacksize)(0)
    (\
        SYMBOLVALUE(XXattrib)\
        POPSYMBOL(XXattrib)\
        ADDTOCOUNTER(XXattribstacksize)(-1)\
    )()\
)

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

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

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

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

DEFINEMACRO(cells)(2)(\
    ADDTOCOUNTER(XXcol)(ARG1)\
    XXtag(td colspan=ARG1 style="text-align: center")\
    ARG2\
    +NOTRANS(</td>)\
    +IFEQUAL(XXcol)(XXtablewidth)(
        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)\
    NOTRANS(<div style="text-align: center">)\
    ARG1\
    +NOTRANS(</div>)\
    ADDTOCOUNTER(XXcenter)(-1)\
)

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

DEFINEMACRO(cindex)(1)(\
)

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

DEFINEMACRO(clearpage)(0)(\
    NOTRANS(<p><hr/><p>)\
)

DEFINEMACRO(code)(1)(\
    XXnl()\
    XXtag(code)\
    NOEXPAND(ARG1)\
    +NOTRANS(</code>)\
    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)\
    XXtag(code)\
    NOTRANS(--</code>)\
POPSUBST()\
)

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

DEFINEMACRO(description)(1)(\
    NOTRANS(<dl>)\
    ARG1\
    +NOTRANS(</dl>)\
)

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

DEFINEMACRO(eit)(0)(\
    NOTRANS(<li>)\
)

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

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

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

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

DEFINEMACRO(enumeration)(1)(\
    PUSHCOUNTER(XXenumcounter)(0)\
    NOTRANS(<ol>)\
    ARG1\
    +NOTRANS(</ol>)\
    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))\
    NOTRANS(<p>)\
    label(ARG3)XXtag(figure)XXnl()\
        NOTRANS(<img src="ARG1)SYMBOLVALUE(XXfigureext)NOTRANS(") \
            attribinsert()NOTRANS(>)XXnl()\
        XXtag(figcaption)getfigurestring() \
            SYMBOLVALUE(XXlastnumber): ARG2+NOTRANS(</figcaption>)XXnl()\
    NOTRANS(</figure></p>)XXnl()\
    ADDTOCOUNTER(XXfigurecounter)(1)\
)

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

DEFINEMACRO(findex)(1)(\
)

DEFINEMACRO(footnote)(1)(\
    NOTRANS(&nbsp;)\
    (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)(\
    ADDTOSYMBOL(XXbodyopt)( ARG1=CHAR(")ARG2+CHAR("))\
)

DEFINEMACRO(htmlcommand)(1)(\
    NOTRANS(ARG1)\
)

DEFINEMACRO(htmlheadfile)(1)(\
    SETSYMBOL(XXheadfile)(NOTRANS(ARG1))\
)

DEFINEMACRO(htmlheadopt)(1)(\
    ADDTOSYMBOL(XXheadopt)(\
        NOTRANS(ARG1)\
        XXnl()\
    )\
)

DEFINEMACRO(htmlnewfile)(0)(\
    INTERNALINDEX(htmlnewfile)\
)

DEFINEMACRO(htmlstyle)(2)(\
    ADDTOSYMBOL(XXhtmlstyleopt)(\
        NOTRANS(    ARG1 {ARG2;}CHAR(10))\
        INTERNALINDEX(preset styleopt NOTRANS(ARG1 {ARG2;}))\
    )\
)

DEFINEMACRO(htmlstylesheet)(1)(\
    ADDTOSYMBOL(XXheadopt)(\
        NOTRANS(<link rel="stylesheet" type="text/css" href="ARG1">)\
        XXnl()\
    )\
)

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)(\
    NOTRANS(<li>)\
)

DEFINEMACRO(itdesc)(2)(\
    XXtag(dt)ARG1+NOTRANS(</dt>)XXnl()\
        NOTRANS(<dd>)ARG2+NOTRANS(</dd>)\
)

DEFINEMACRO(itemization)(1)(\
    NOTRANS(<ul>)\
    ARG1\
    +NOTRANS(</ul>)\
)

DEFINEMACRO(kindex)(1)(\
)

DEFINEMACRO(label)(1)(\
    INTERNALINDEX(htmllabel 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))\
    htmlnewfile()\
    label(ARG1)\
    XXtocentry(chap getchapterstring() SYMBOLVALUE(XXlastnumber): ARG2)\
    XXtag(h1)getchapterstring() SYMBOLVALUE(XXlastnumber): \
    ARG2\
    +NOTRANS(</h1>)\
)

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(solvelink ARG2)NOTRANS(")\
        attribinsert()\
    NOTRANS(>)ARG1+NOTRANS(</a>)\
)

DEFINEMACRO(lref)(2)(\
    NOTRANS(<a href=")\
    INTERNALINDEX(solvelink ARG2)NOTRANS(")\
        attribinsert()\
    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)(\
    SETSYMBOL(XXmailto)(ARG1)\
)

DEFINEMACRO(makeindex)(0)(\
)

DEFINEMACRO(mancommand)(1)(\
)

DEFINEMACRO(manpage)(5)(\
    notableofcontents()\
    XXstartdocument(article)\
    ATEXIT(XXcheckmanpage())\
    ATEXIT(INTERNALINDEX(copy))\
    ATEXIT(INTERNALINDEX(htmldone))\
    XXsetdocumentheader(ARG1(ARG2))(ARG5+nl()(ARG4))(ARG3)\
)

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)\
    htmlnewfile()\
    XXtocentry(chap getchapterstring() ARG1)\
    XXtag(h1)getchapterstring() \
    ARG1\
    +NOTRANS(</h1>)\
)

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

DEFINEMACRO(nl)(0)(\
    NOTRANS(<br/>)\
)

DEFINEMACRO(nodenmame)(1)(
)

DEFINEMACRO(nodeprefix)(1)(
)

DEFINEMACRO(nodetext)(1)(\
)

DEFINEMACRO(nohtmlfive)(0)(\
    SETCOUNTER(XXhtmlfive)(0)\
    INTERNALINDEX(preset nohtmlfive)\
)

DEFINEMACRO(nohtmlimgstyle)(0)(\
    SETCOUNTER(XXhtmlimgstyle)(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)(\
    XXtag(h1)\
    getpartstring() \
    ARG1\
   +NOTRANS(</h1>)
)

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

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

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

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

DEFINEMACRO(PageEnlarged)(4)(\
)

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

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

DEFINEMACRO(pindex)(1)(\
)

DEFINEMACRO(plainhtml)(1)(\
    notableofcontents()\
    XXstartdocument(article)\
    XXsetdocumentheader(ARG1)()()\
    ATEXIT(INTERNALINDEX(htmldone))\
)

DEFINEMACRO(printindex)(0)(\
)

DEFINEMACRO(quote)(1)
(
    XXtag(blockquote)\
    ARG1\
    +NOTRANS(</blockquote>)\
)

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

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

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

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

DEFINEMACRO(report)(3)(\
    redef(part)(1)(ERROR(parts only available in books!))\
    redef(npart)(1)(part())\
    XXstartdocument(report)\
    ATEXIT(INTERNALINDEX(htmldone))\
    XXsetdocumentheader(ARG1)(ARG2)(ARG3)\
)

DEFINEMACRO(roffcmd)(4)(\
)

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

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

DEFINEMACRO(sc)(1)(\
    NOTRANS(<div style="font-size: 90%"><code>)\
    UPPERCASE(ARG1)(0)\
    NOTRANS(</code></div>)\
)

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)(\
    SETSYMBOL(XXfigureext)(ARG1)\
)

DEFINEMACRO(htmlmetacharset)(1)(\
    SETSYMBOL(XXhtmlmetacharset)(NOTRANS(ARG1))\
)

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)\
    XXtag(table)\
    XXnl()\
)

DEFINEMACRO(strong)(1)(\
    XXtag(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(<p><strong>)\
    ARG1\
    +NOTRANS(</strong><br/>)\
)

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

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

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

DEFINEMACRO(tac)(2)(\
    IFSTREQUAL(XXtao)()(\
        NOTRANS(    <td class=")\
        XXhtmlclass(0)(ARG1)\
        XXhtmlclass(1)(ARG1)\
        NOTRANS("; )\
    )(\
        NOTRANS(    <td )\
        SYMBOLVALUE(XXtao)\
    )\
    +XXtc(ARG2)(1)()\
)

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

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

DEFINEMACRO(tc)(1)(\
    IFSTREQUAL(XXtao)()(\
        NOTRANS(    <td class=")\
        XXhtmlclass(XXcol)(XXtablealign)\
        NOTRANS("; )\
    )(\
        NOTRANS(    <td )\
        SYMBOLVALUE(XXtao)\
    )\
    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)(\
    NOTRANS(    <td colspan=ARG1 )\
    IFSTREQUAL(XXtao)()(\
        NOTRANS(class=")\
        XXhtmlclass(0)(ARG2)\
        XXhtmlclass(1)(ARG2)\
        NOTRANS("; )\
    )(\
        SYMBOLVALUE(XXtao))\
    XXtc(ARG3)(ARG1)()\
)

DEFINEMACRO(tnc)(2)(\
    NOTRANS(    <td colspan=ARG1 )\
    IFSTREQUAL(XXtao)()(\
        NOTRANS(class="XXtc";)\
    )(\
        SYMBOLVALUE(XXtao))\
    XXtc(ARG2)(ARG1)()\
)

DEFINEMACRO(tocclearpage)(0)(\
)

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

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

DEFINEMACRO(ttbegin)(0)(\
    XXtag(code)\
)

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

DEFINEMACRO(twrap)(1)(\
)

DEFINEMACRO(txtcommand)(1)(\
)

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

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

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

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

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

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

DEFINEMACRO(vindex)(1)(\
)

DEFINEMACRO(whenhtml)(1)(\
    ARG1\
)

DEFINEMACRO(whenlatex)(1)(\
)

DEFINEMACRO(whenman)(1)(\
)

DEFINEMACRO(whenms)(1)(\
)

DEFINEMACRO(whensgml)(1)(\
)

DEFINEMACRO(whentely)(1)(\
)

DEFINEMACRO(whentexinfo)(1)(\
)

DEFINEMACRO(whentxt)(1)(\
)

DEFINEMACRO(whenxml)(1)(\
)

DEFINEMACRO(xit)(1)(\
)

DEFINEMACRO(xmlcommand)(1)(\
)

DEFINEMACRO(xmlmenu)(3)(\
)

DEFINEMACRO(xmlnewfile)(0)(\
)

DEFINEMACRO(xmlsetdocumentbase)(1)(\
)

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

DEFINEMACRO(XXabstract)(0)(\
    IFSTREQUAL(XXabstracttext)()
    ()(\
        IFSTREQUAL(XXdocumentclass)(book)(
            ERROR(abstracts cannot appear in books!))()\
        XXnl()\
        quote(\
            em(\
                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(</table>)\
    POPCOUNTER(XXtablewidth)\
)


DEFINEMACRO(XXhtmlclass)(2)(\
    evalsymbol(XXsym)(SUBSTR(ARG2)(ARG1)(1))\
    IFSTREQUAL(c)(XXsym)(XXtc )(\
    IFSTREQUAL(l)(XXsym)(XXtl )(\
    IFSTREQUAL(r)(XXsym)(XXtr )(\
    IFSTREQUAL(t)(XXsym)(XXvt )(\
    IFSTREQUAL(b)(XXsym)(XXvb )(\
    )))))\
)

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(XXnbsp)(1)(\
    XXifnzero(ARG1)(\
        NOTRANS(&nbsp;)\
        SETCOUNTER(XXx)(ARG1-1)\
        EVAL(XXnbsp+nop()(COUNTERVALUE(XXx)))\
    )\
)

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


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

DEFINEMACRO(XXsect)(1)(\
    XXtocentry(sect SYMBOLVALUE(XXlastnumber): ARG1)\
    XXtag(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)(\
    XXsethtmldocumentheader(ARG1)(ARG2)(ARG3)\
)

DEFINEMACRO(XXsethtmldocumentheader)(3)(\
    XXifnzero(XXhtmlfive)(NOTRANS(<!DOCTYPE html>))\
    NOTRANS(<html><head>)XXnl()\
    XXifnempty(XXhtmlmetacharset)
    (
        NOTRANS(<meta charset=")\
            SYMBOLVALUE(XXhtmlmetacharset)NOTRANS(">)XXnl()\
        INTERNALINDEX(preset metacharset SYMBOLVALUE(XXhtmlmetacharset))\
    )\
    XXifnempty(ARG1)
    (
        TYPEOUT(Document title: ARG1)\
        NOTRANS(<title>)ARG1+NOTRANS(</title>)XXnl()\
        INTERNALINDEX(preset title ARG1)\
    )\
    XXifnempty(XXheadopt)(\
        SYMBOLVALUE(XXheadopt)\
        INTERNALINDEX(preset headopt SYMBOLVALUE(XXheadopt))\
    )\
    XXifnzero(XXhtmlimgstyle)(\
        htmlstyle(figure)(text-align: center)\
        htmlstyle(img)(vertical-align: center)\
        htmlstyle(.XXfc)(margin-left:auto;margin-right:auto)\
        htmlstyle(.XXtc)(text-align: center)\
        htmlstyle(.XXtl)(text-align: left)\
        htmlstyle(.XXtr)(text-align: right)\
        htmlstyle(.XXvt)(vertical-align: top)\
        htmlstyle(.XXvb)(vertical-align: bottom)\
    )
    XXifnempty(XXhtmlstyleopt)(\
        NOTRANS(<style type="text/css">)XXnl()\
            EVAL(SYMBOLVALUE(XXhtmlstyleopt))\
            NOTRANS(</style>)XXnl()\
    )\
    IFSTREQUAL(XXmailto)()(\
        WARNING(no NOTRANS(mailto(..)) set, document will be without!)\
    )(\
        NOTRANS(<link rev="made" href="mailto:)\
            SYMBOLVALUE(XXmailto)\
            NOTRANS(">)XXnl()\
    )\
    XXifnempty(XXheadfile)(\
        INTERNALINDEX(preset headfile SYMBOLVALUE(XXheadfile))\
        EVAL(NOTRANS(includeverbatim+CHAR(40))\
                SYMBOLVALUE(XXheadfile)CHAR(41))\
    )
    NOTRANS(</head>)\
    XXnl()\
    NOTRANS(<body)\
    XXifnempty(XXbodyopt)(\
        SYMBOLVALUE(XXbodyopt)\
        INTERNALINDEX(set bodytagopt SYMBOLVALUE(XXbodyopt))\
    )\
    NOTRANS(>)\
    XXnl()\
    NOTRANS(<hr/>)\
    XXnl()\
    NOTRANS(<h1 id="title">)ARG1+NOTRANS(</h1>)\
    XXnl()\
    XXifnempty(ARG2)
    (\
        NOTRANS(<h2 id="author">)ARG2+NOTRANS(</h2>)\
        XXnl()\
    )\
    XXifnempty(XXaffilstring)
    (\
        XXnl()\
        NOTRANS(<h2 id="affiliation">)SYMBOLVALUE(XXaffilstring)NOTRANS(</h2>)\
    )\
    XXifnempty(ARG3)
    (\
        NOTRANS(<h2 id="date">)ARG3+NOTRANS(</h2>)\
        XXnl()\
    )\
    XXabstract()\
    XXnl()\
    XXsettitleclearpage()\
    XXtableofcontents()\
)

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(XXstartdocument)(1)(\
    TYPEOUT(Yodl is processing a+nop()(n) ARG1)\
    SETSYMBOL(XXdocumentclass)(ARG1)\
    INTERNALINDEX(preset documenttype ARG1)\
    XXnl()\
)

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

DEFINEMACRO(XXsubsect)(1)(\
    XXtocentry(ssect SYMBOLVALUE(XXlastnumber): ARG1)\
    XXtag(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)\
    XXtag(h4)\
    SYMBOLVALUE(XXlastnumber): ARG1\
    +NOTRANS(</h4>)\
)

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


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

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

DEFINEMACRO(XXtblbegin)(1)(\
    EVAL(PUSHCOUNTER+nop()(XXtablewidth)(STRLEN(ARG1)))\
    PUSHSYMBOL(XXtablealign)(ARG1)\
    IFZERO(XXcenter)(\//                 html uses XXcenter to set the `center'
        XXtag(table)\//                   class.
    )(\
        XXtag(table class="XXfc" ))\// XXtag is used: attrib() is available
    XXnl()\
)

DEFINEMACRO(XXtblend)(1)(\
    ARG1\
    +NOTRANS(</table>)\
    POPSYMBOL(XXtablealign)\
    XXnl()\
    POPCOUNTER(XXtablewidth)\
)

DEFINEMACRO(XXtc)(3)(\
    attribinsert()\
    +NOTRANS(>)\
    ARG1\
    +NOTRANS(</td>)\
    ADDTOCOUNTER(XXcol)(ARG2)\
    XXnl()\
    SETSYMBOL(XXtao)()\
)

DEFINEMACRO(XXtlineClose)(1)(\
    ADDTOCOUNTER(XXcol)(-1)\
    IFGREATER(XXcol)(XXtablewidth)(\
        ERROR(Table width (COUNTERVALUE(XXtablewidth)) exceeded))()\
    POPCOUNTER(XXcol)\
    NOTRANS(</tr>)\
    XXnl()\
)

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

DEFINEMACRO(XXtlineFirst)(1)(\
    NOTRANS(<tr>)\
    XXnl()\
    PUSHCOUNTER(XXcol)(1)\//     colnr specified by XXcol; 
)

DEFINEMACRO(XXtlineNext)(2)(\
    EVAL(XXtlineSpan+nop()(COUNTERVALUE(XXcol))(ARG1)())\
                                    \// set partial line:
    XXtlineSpan(ARG1)(ARG2)(NOTRANS(<hr/>))\
    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)(\
    IFGREATER(ARG2)(ARG1)
    (\
        SETCOUNTER(XXx)(ARG2-ARG1)\//     compute width of the line
        IFEQUAL(XXx)(1)(\
            NOTRANS(    <td>)\
        )(\
            NOTRANS(    <td colspan=)COUNTERVALUE(XXx)NOTRANS(>))\
        ARG3\
        NOTRANS(</td>)\//                           update XXtableIdx:
        EVAL(ADDTOCOUNTER+nop()(XXcol)(COUNTERVALUE(XXx)))\
        XXnl()\
    )()\
)

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

DECWSLEVEL()
