
INCWSLEVEL()

DEFINESYMBOL(man)()

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(XXinlist)(0)              COMMENT(flags if we're inside a list)
DEFINECOUNTER(XXsawalign)(0)            COMMENT(Saw a setmanalign() call)
DEFINECOUNTER(XXsawncells)(0)           COMMENT(Saw a cells() macro call)

DEFINECOUNTER(XXtt)(0)          \// if != 0 quote tt-arguments


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(XXroffalign)           ()
DEFINESYMBOL(XXroffcontents)        ()
DEFINESYMBOL(XXrofftab)             (~)
DEFINESYMBOL(XXrofftableoptions)    ()
COMMENT(Created by macros:
    XXmanpageName
    XXmanpageAuthor
END COMMENT)
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)\
    XXsetdocumentheader(ARG1)(ARG2)(ARG3)\
)

DEFINEMACRO(attrib)(1)(\
)

DEFINEMACRO(attribclear)(0)(\
)

DEFINEMACRO(attribinsert)(0)(\
)

DEFINEMACRO(bf)(1)(\
    NOTRANS(\fB)\
    ARG1\
    +NOTRANS(\fP)\
)

DEFINEMACRO(bind)(1)(\
    ARG1\
    +NOTRANS(\ )\
)

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

DEFINEMACRO(cell)(1)(\
    ADDTOCOUNTER(XXcol)(1)\
    ADDTOSYMBOL(XXroffcontents)(ARG1+nop())\
    XXifneq(XXcol)(XXtablewidth)
    (\
        ADDTOSYMBOL(XXroffcontents)(SYMBOLVALUE(XXrofftab))\
    )\
)

DEFINEMACRO(cells)(2)(\
    ADDTOCOUNTER(XXcol)(ARG1)\
    ADDTOCOUNTER(XXcol)(-1)\
    cell(ARG2)\
)

DEFINEMACRO(cellsline)(2)(\
    SETCOUNTER(XXx)(ARG1-1)\
    EVAL(NOTRANS(ADDTOCOUNTER(XXx))(NOTRANS(-)COUNTERVALUE(XXcol)))\
    IFGREATER(XXx)(-1)(\
        ADDTOCOUNTER(XXcol)(XXx+ARG2)\
        SETCOUNTER(XXsawcellsline)(1)\
        SETCOUNTER(XXsawalign)(1)\
        XXifnzero(XXx)(\
            EVAL(\
                NOTRANS(addntosymbol(XXtablealign))(COUNTERVALUE(XXx))(\
                NOTRANS(c))\
            )\
        )\
        addntosymbol(XXtablealign)(ARG2)(+NOTRANS(-))\
    )()\
)

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))\
    XXroffcmd(.SH)(NOTRANS(")getchapterstring() \
        SYMBOLVALUE(XXlastnumber): ARG1+NOTRANS("))()()\
    XXtocentry(getchapterstring() SYMBOLVALUE(XXlastnumber): ARG1)\
    XXtocentry(NOTRANS(@TOCCOMMAND@ .br))\
)

DEFINEMACRO(cindex)(1)(\
)

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

DEFINEMACRO(clearpage)(0)(\
    XXroffcmd(.bp)()()()\
)

DEFINEMACRO(code)(1)(\
    XXnl()\
    NOTRANS(\f)\
    CHAR(40)CW\
    +NOEXPAND(ARG1)
    NOTRANS(\fP)\
    XXnl()\
)

DEFINEMACRO(columnline)(2)(\
    SETCOUNTER(XXx)(ARG1)\
    XXifneq(XXx)(1)(\
        ADDTOSYMBOL(XXtablealign)(c)\
        ADDTOCOUNTER(XXx)(-2)\
        addntosymbol(XXtablealign)(XXx)(s)\
    )
    SETCOUNTER(XXx)(ARG2-ARG1)\
    ADDTOSYMBOL(XXtablealign)(+NOTRANS(-))\
    addntosymbol(XXtablealign)(XXx)(s)\
    ADDTOSYMBOL(XXtablealign)(+XXnl())\
    ADDTOSYMBOL(XXroffcontents)(XXroffcmd()()()())\
)

DEFINEMACRO(dashes)(1)(\
PUSHSUBST(0)\
    NOTRANS(\f)\
    CHAR(40)CW\
    NOTRANS(--\fP)\
POPSUBST()\
)

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

DEFINEMACRO(description)(1)(\
    ADDTOCOUNTER(XXinlist)(1)\
    ARG1\
    +ADDTOCOUNTER(XXinlist)(-1)\
)

DEFINEMACRO(dit)(1)(\
    XXroffcmd(.IP)(NOTRANS(")ARG1+NOTRANS("))()()\
)

DEFINEMACRO(eit)(0)(\
    XXroffcmd(.IP)(USECOUNTER(XXenumcounter).)()()\
)

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

DEFINEMACRO(em)(1)(\
    NOTRANS(\fI)\
    ARG1\
    +NOTRANS(\fP)\
)

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

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

DEFINEMACRO(enumeration)(1)(\
    PUSHCOUNTER(XXenumcounter)(0)\
    ADDTOCOUNTER(XXinlist)(1)\
    ARG1\
    +ADDTOCOUNTER(XXinlist)(-1)\
    POPCOUNTER(XXenumcounter)\
)

DEFINEMACRO(euro)(0)(\
    EUR\
)

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

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

DEFINEMACRO(figure)(3)(\
    XXsetlastnumber(COUNTERVALUE(XXfigurecounter))\
    label(ARG3)

    ------------------------------------------------------------------
    Insert Figure SYMBOLVALUE(XXlastnumber)
    (ARG2)
    about here (file: ARG1)
    ------------------------------------------------------------------\
    ADDTOCOUNTER(XXfigurecounter)(1)\
)

DEFINEMACRO(file)(1)(\
    NOTRANS(\fB)\
    ARG1\
    +NOTRANS(\fP)\
)

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)(\
    XXroffcmd(.IP)(o )()()\
)

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

DEFINEMACRO(itemization)(1)(\
    ADDTOCOUNTER(XXinlist)(1)\
    ARG1\
    +ADDTOCOUNTER(XXinlist)(-1)\
)

DEFINEMACRO(kindex)(1)(\
)

DEFINEMACRO(label)(1)(\
    COMMENT(INTERNALINDEX(label 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))\
    XXroffcmd(.SH)(NOTRANS(")getchapterstring() \
        SYMBOLVALUE(XXlastnumber): ARG1+NOTRANS("))()()\
    XXtocentry(getchapterstring() SYMBOLVALUE(XXlastnumber): ARG2)\
    XXtocentry(NOTRANS(@TOCCOMMAND@ .br))\
)

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

DEFINEMACRO(lref)(2)(\
    ARG1 \
    INTERNALINDEX(ref ARG2)\
)

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

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

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

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

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

DEFINEMACRO(mailto)(1)(\
)

DEFINEMACRO(makeindex)(0)(\
)

DEFINEMACRO(mancommand)(1)(\
    NOTRANS(ARG1)\
)

DEFINEMACRO(manpage)(5)(\
    notableofcontents()\
    XXstartdocument(article)\
    ATEXIT(XXcheckmanpage())\
    ATEXIT(INTERNALINDEX(copy))\
    XXroffcmd(.TH)(NOTRANS(")ARG1+NOTRANS(") NOTRANS(")ARG2+NOTRANS(") \
        NOTRANS(")ARG3+NOTRANS(") NOTRANS(")ARG4+NOTRANS(") \
        NOTRANS(")ARG5+NOTRANS("))()()\
)

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 \
    NOTRANS(\-) \
    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)(\
    SETCOUNTER(XXtt)(ARG1)\
)

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

PUSHWSLEVEL()\
DEFINEMACRO(metaC)(1)(\
    IFSTRSUB(ARG1)(
)
    (\
        WARNING(NOEXPAND(metaC()) ignored: multiple lines in argument)\
    )
    (\
    )\
)\
POPWSLEVEL()

DEFINEMACRO(metaCOMMENT)(1)(\
)

DEFINEMACRO(mscommand)(1)(\
)

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

DEFINEMACRO(nchapter)(1)(\
    SETCOUNTER(XXsectcounter)(0)\
    SETCOUNTER(XXsubsectcounter)(0)\
    SETCOUNTER(XXsubsubsectcounter)(0)\
    XXroffcmd(.SH)(NOTRANS(")getchapterstring(): ARG1+NOTRANS("))()()\
)

DEFINEMACRO(nemail)(2)(\
    mbox(ARG1) \
    <ARG2>\
)

DEFINEMACRO(nl)(0)(\
    XXroffcmd(.br)()()()\
)

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)(\
    XXroffcmd(.SH)(NOTRANS(")getpartstring() ARG1+NOTRANS("))()()\
)

DEFINEMACRO(nsect)(1)(\
    SETCOUNTER(XXsubsectcounter)(0)\
    SETCOUNTER(XXsubsubsectcounter)(0)\
    XXroffcmd(.SH)(NOTRANS(")ARG1+NOTRANS("))()()\
)

DEFINEMACRO(nsubsect)(1)(\
    SETCOUNTER(XXsubsubsectcounter)(0)\
    XXroffcmd(.SH)(NOTRANS(")ARG1+NOTRANS("))()()\
)

DEFINEMACRO(nsubsubsect)(1)(\
    XXroffcmd(.SH)(NOTRANS(")ARG1+NOTRANS("))()()\
)

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

DEFINEMACRO(PageEnlarged)(4)(\
)

DEFINEMACRO(paragraph)(1)
(
    XXroffcmd(.SH)(NOTRANS(")ARG1+NOTRANS("))()()\
)

DEFINEMACRO(part)(1)(\
    ADDTOCOUNTER(XXpartcounter)(1)\
    XXsetlastnumber(COUNTERVALUE(XXpartcounter))\
    XXroffcmd(.SH)(NOTRANS(")getpartstring() SYMBOLVALUE(XXlastnumber): \
        ARG1+NOTRANS("))()()\
    XXtocentry(.SH NOTRANS(")getpartstring() SYMBOLVALUE(XXlastnumber): \
        ARG1+NOTRANS("))\
)

DEFINEMACRO(pindex)(1)(\
)

DEFINEMACRO(plainhtml)(1)(\
)

DEFINEMACRO(printindex)(0)(\
)

DEFINEMACRO(quote)(1)
(
    XXroffcmd(.RS)()(ARG1)(.RE)
)

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

DEFINEMACRO(roffcmd)(4)(\
    XXroffcmd(ARG1)(ARG2)(ARG3)(ARG4)\
)

DEFINEMACRO(row)(1)(\
    PUSHCOUNTER(XXcol)(0)\
    PUSHCOUNTER(XXsawalign)(0)\
    PUSHCOUNTER(XXsawcells)(0)\
    PUSHCOUNTER(XXsawcellsline)(0)\
    ARG1\
    +XXifnzero(XXsawcellsline)(\
        ADDTOSYMBOL(XXtablealign)(+XXnl())\
        ADDTOSYMBOL(XXroffcontents)(~)\
    )\
    POPCOUNTER(XXsawcellsline)\
    ADDTOSYMBOL(XXroffcontents)(XXnl())\
    +IFZERO(XXsawalign)(\
        ADDTOSYMBOL(XXtablealign)(+SYMBOLVALUE(XXroffalign)XXnl())\
        XXifnzero(XXsawcells)(\
            WARNING(ncells+nop()() used without setroffalign+nop()()))\
    )()\
    POPCOUNTER(XXsawcells)\
    POPCOUNTER(XXsawalign)\
    POPCOUNTER(XXcol)\
)

DEFINEMACRO(rowline)(0)(\
    addntosymbol(XXtablealign)(XXtablewidth)(NOTRANS(-))\
    ADDTOSYMBOL(XXtablealign)(XXnl())\
)

DEFINEMACRO(sc)(1)(\
    ARG1\
)

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)(\
    ADDTOSYMBOL(XXtablealign)(ARG1+XXnl())\
    SETCOUNTER(XXsawalign)(1)\
)

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

DEFINEMACRO(setrofftab)(1)(\
    SETSYMBOL(XXrofftab)(ARG1)\
)

DEFINEMACRO(setrofftableoptions)(1)(\
    SETSYMBOL(XXrofftableoptions)(ARG1)\
)

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)\
    PUSHSYMBOL(XXroffcontents)()\
    PUSHSYMBOL(XXroffalign)(ARG2)\
    PUSHSYMBOL(XXtablealign)()\
    XXroffcmd(.TS)()()()\
    SYMBOLVALUE(XXrofftableoptions) tab+nop()(SYMBOLVALUE(XXrofftab));\
    INTERNALINDEX(copy)\
    XXnl()\
)

DEFINEMACRO(strong)(1)(\
    ARG1
)

DEFINEMACRO(subs)(1)(\
)

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

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

DEFINEMACRO(subsubsubsect)(1)
(
    XXroffcmd(.SH)(NOTRANS(")ARG1+NOTRANS("))()()\
)

DEFINEMACRO(sups)(1)(\
)

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

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

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

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

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

DEFINEMACRO(tc)(1)(\
    IFSTREQUAL(XXtao)()(\
        EVAL(SETSYMBOL+nop()(XXtao)(SUBSTR(XXroffalign)(XXcol)(1)))\
    )()\
    EVAL(ADDTOSYMBOL+nop()(XXalign)(SYMBOLVALUE(XXtao)))\
    XXtc(ARG1)(1)()\
)

DEFINEMACRO(tcell)(1)(\
    cell(\
        NOTRANS(T{)\
        XXnl()\
        ARG1\
        +XXnl()\
        NOTRANS(T})\
        XXnl()\
    )\
)

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)(\
    tac(ARG2)(ARG3)\//                      ARG2 is overruled by XXtao in tac.
    SETCOUNTER(XXx)(ARG1-1)\
    addntosymbol(XXalign)(XXx)(s)\//        merge with ARG-1 cells
)

DEFINEMACRO(tnc)(2)(\
    tac(c)(ARG3)\//                         c is overruled by XXtao in tac.
    SETCOUNTER(XXx)(ARG1-1)\
    addntosymbol(XXalign)(XXx)(s)\//        merge with ARG-1 cells
)

DEFINEMACRO(tocclearpage)(0)(\
)

DEFINEMACRO(tr)(1)(\
    PUSHCOUNTER(XXtr)(1)\
    PUSHCOUNTER(XXcol)(0)\
    SETSYMBOL(XXalign)()\
    ARG1\
    +EVAL(ADDTOSYMBOL+nop()(XXtablealign)(SYMBOLVALUE(XXalign)XXnl()))\
    ADDTOSYMBOL(XXroffcontents)(XXnl())\
    POPCOUNTER(XXcol)\
    POPCOUNTER(XXtr)\
)

DEFINEMACRO(tt)(1)(\
    IFZERO(XXtt)(\
        NOEXPAND(ARG1)\
    )(\
        NOEXPAND(`ARG1'))\
)

DEFINEMACRO(ttbegin)(0)(\
    NOTRANS(\f)\
    CHAR(40)CW\
)

DEFINEMACRO(ttend)(0)(\
    NOTRANS(\fP)\
)

DEFINEMACRO(twrap)(1)(\
    SETCOUNTER(XXtwrap)(ARG1)\
)

DEFINEMACRO(txtcommand)(1)(\
)

DEFINEMACRO(url)(2)(\
    ARG1\
)

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

DEFINEMACRO(verbinclude)(1)(\
    XXroffcmd(.nf)()()()\
    INTERNALINDEX(verb on)\
    NOEXPANDINCLUDE(ARG1)\
    XXroffcmd(.fi)()()()\
    INTERNALINDEX(verb off)\
)

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

DEFINEMACRO(verborg)(1)(\
    XXroffcmd(.nf)()()()\
    INTERNALINDEX(verb on)\
    NOEXPAND(ARG1)\
    INTERNALINDEX(verb off)\
    XXroffcmd(.fi)()()()\
)

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

DEFINEMACRO(vindex)(1)(\
)

DEFINEMACRO(whenhtml)(1)(\
)

DEFINEMACRO(whenlatex)(1)(\
)

DEFINEMACRO(whenman)(1)(\
    ARG1\
)

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()\
        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\
    +INTERNALINDEX(drainws)\
    SYMBOLVALUE(XXtablealign)\
    NOTRANS(c.)\
    XXnl()\
    INTERNALINDEX(copy)\
    SYMBOLVALUE(XXroffcontents)\
    XXroffcmd()()()()\
    XXroffcmd(.TE)()()()\
    POPSYMBOL(XXtablealign)\
    POPSYMBOL(XXroffalign)\
    POPSYMBOL(XXroffcontents)\
    POPCOUNTER(XXtablewidth)\
)


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)(\
    IFSTREQUAL(XXtao)()(\
        IFSTRSUB(ARG1)(c)(SETSYMBOL(XXtao)(c))(\
        IFSTRSUB(ARG1)(l)(SETSYMBOL(XXtao)(l))(\
        IFSTRSUB(ARG1)(r)(SETSYMBOL(XXtao)(r))(\
    ))))()\
    EVAL(ADDTOSYMBOL+nop()(XXalign)(SYMBOLVALUE(XXtao)))\
)













DEFINEMACRO(XXnbsp)(1)(\
    XXifnzero(ARG1)(\
        NOTRANS(\ )\
        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)(\
    XXroffcmd(.SH)(NOTRANS(")SYMBOLVALUE(XXlastnumber): ARG1+NOTRANS("))()()\
    XXtocentry(SYMBOLVALUE(XXlastnumber): ARG1)\
    XXtocentry(\
        NOTRANS(@TOCCOMMAND@ .br)\
    )\
)

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

DEFINEMACRO(XXsetdocumentheader)(3)(\
    XXsetmandocumentheader(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(XXstartdocument)(1)(\
    TYPEOUT(Yodl is processing a+nop()(n) ARG1)\
    SETSYMBOL(XXdocumentclass)(ARG1)\
    XXnl()\
)

DEFINEMACRO(XXstarttable)(2)(\
    PUSHCOUNTER(XXtablewidth)(ARG1)\
    PUSHSYMBOL(XXroffcontents)()\
    PUSHSYMBOL(XXroffalign)(ARG2)\
    PUSHSYMBOL(XXtablealign)()\
    XXroffcmd(.TS)()()()\
    SYMBOLVALUE(XXrofftableoptions) tab+nop()(SYMBOLVALUE(XXrofftab));\
    INTERNALINDEX(copy)\
    XXnl()\
)

DEFINEMACRO(XXsubsect)(1)(\
    XXroffcmd(.SH)(NOTRANS(")SYMBOLVALUE(XXlastnumber): ARG1+NOTRANS("))()()\
    XXtocentry(SYMBOLVALUE(XXlastnumber): ARG1)\
    XXtocentry(\
        NOTRANS(@TOCCOMMAND@ .br)\
    )\
)

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

DEFINEMACRO(XXsubsubsect)(1)(\
    XXroffcmd(.SH)(NOTRANS(")SYMBOLVALUE(XXlastnumber): ARG1+NOTRANS("))()()\
    XXtocentry(SYMBOLVALUE(XXlastnumber): ARG1)\
    XXtocentry(\
        NOTRANS(@TOCCOMMAND@ .br)\
    )\
)

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


DEFINEMACRO(XXtableofcontents)(0)(\
    IFSTREQUAL(XXgeneratetoc)()(\
    )(\
        XXroffcmd(.SH)(Contents)()()\
        INTERNALINDEX(mantoc)\
        XXsettocclearpage()\
    )\
)

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

DEFINEMACRO(XXtblbegin)(1)(\
    EVAL(PUSHCOUNTER+nop()(XXtablewidth)(STRLEN(ARG1)))\
    PUSHSYMBOL(XXtablealign)()\
    PUSHSYMBOL(XXroffcontents)()\
    PUSHSYMBOL(XXroffalign)(ARG1)\
    PUSHSYMBOL(XXrofftableoptions)()\
    XXroffcmd(.TS)()()()\
    XXifnzero(XXcenter)(\
        center )\
    SYMBOLVALUE(XXrofftableoptions) tab+nop()(SYMBOLVALUE(XXrofftab));\
    INTERNALINDEX(copy)\
    XXnl()\
)

DEFINEMACRO(XXtblend)(1)(\
    ARG1\
    +INTERNALINDEX(drainws)\
    SYMBOLVALUE(XXtablealign)\
    NOTRANS(c.)\
    XXnl()\
    INTERNALINDEX(copy)\
    SYMBOLVALUE(XXroffcontents)\
    XXroffcmd()()()()\
    XXroffcmd(.TE)()()()\
    POPSYMBOL(XXrofftableoptions)\
    POPSYMBOL(XXroffalign)\
    POPSYMBOL(XXroffcontents)\
    POPSYMBOL(XXtablealign)\
    XXnl()\
    POPCOUNTER(XXtablewidth)\
)

DEFINEMACRO(XXtc)(3)(\
    XXifnzero(XXtwrap)(\//              T{ .. T} block was requested: begin
        ADDTOSYMBOL(XXroffcontents)(NOTRANS(T{)XXnl()))\
    ADDTOSYMBOL(XXroffcontents)(ARG1+nop())\
    ADDTOCOUNTER(XXcol)(ARG2)\
    XXifnzero(XXtwrap)(\//              T{ .. T} block was requested: end
        ADDTOSYMBOL(XXroffcontents)(XXnl()NOTRANS(T})))\
    XXifneq(XXcol)(XXtablewidth)(\
        ADDTOSYMBOL(XXroffcontents)(SYMBOLVALUE(XXrofftab)))\
    SETSYMBOL(XXtao)()\
)

DEFINEMACRO(XXtlineClose)(1)(\
    ADDTOCOUNTER(XXcol)(-1)\
    IFGREATER(XXcol)(XXtablewidth)(\
        ERROR(Table width (COUNTERVALUE(XXtablewidth)) exceeded))()\
    POPCOUNTER(XXcol)\
    ADDTOSYMBOL(XXtablealign)(+XXnl())\
    ADDTOSYMBOL(XXroffcontents)(XXroffcmd()()()())\
)

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)(\
    EVAL(XXtlineSpan+nop()(COUNTERVALUE(XXcol))(ARG1)(c))\
    XXtlineSpan(ARG1)(ARG2)(+NOTRANS(-))\
    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)(\
    rowline()\
)

DEFINEMACRO(XXtlineSpan)(3)(\
    IFGREATER(ARG2)(ARG1)
    (\
        SETCOUNTER(XXx)(ARG2-ARG1)\
        ADDTOSYMBOL(XXtablealign)(ARG3)\
        EVAL(ADDTOCOUNTER+nop()(XXcol)(COUNTERVALUE(XXx)))\
        ADDTOCOUNTER(XXx)(-1)\
        addntosymbol(XXtablealign)(XXx)(s)\
    )()\
)

DEFINEMACRO(XXtocentry)(1)(\
)

DECWSLEVEL()
