SUBST(C2a)(tt(C++26))

COMMENT( for 'file(s)' -> f+iles() )
NOUSERMACRO(iles namespace name option WHATEVER space)
DEFINEMACRO(files)(0)(CHAR(f)iles(s))

COMMENT(The following macros are used to define upcoming sections and
        files. Once they are available, simply remove the `c' to activate
        them)
DEFINEMACRO(cincludefile)(1)()
DEFINEMACRO(csect)(1)()
DEFINEMACRO(csubsect)(1)()
DEFINEMACRO(csubsubsect)(1)()
DEFINEMACRO(rowfive)(5)(\
        row(cell(ARG1)cell(ARG2)cell(ARG3)cell(ARG4)cell(ARG5)))
INCLUDEFILE(version)

SUBST(BSSP)(\ )
SUBST(MYEMAIL)(f.b.brokken@rug.nl)

SUBST(OPENPAR)(CHAR(40))
SUBST(CLOSEPAR)(CHAR(41))
SUBST(AFFILIATION)(\
        University of Groningen,nl()\
        PO Box 407,nl()\
        9700 AK Groningen nl()\
        The Netherlands nl())

    COMMENT(This table is used when writing the LateX index)
DEFINECHARTABLE(index)(
    '#' = "\\#"
    '&' = "\\&"
    '_'     = "\\_"
    '^'     = "\\^"
    '<'     = "\\textless{}"
    '>'     = "\\textgreater{}"
)

setlatexfigureext(.eps)
sethtmlfigureext(.gif)  COMMENT(While converting figures to .jpg)

IFDEF(html)(\
    IFDEF(kindle)
    (
        TYPEOUT(DEFINED KINDLE)
        htmlheadfile(cplusplus.kindle)
    )
    (
        TYPEOUT(KINDLE NOT DEFINED)
        htmlstylesheet(cplusplus.css)
    )
)()

IFDEF(latex)
(\
        redef(XXsetlatexdocumentheader)(3)(\
            IFEMPTY(ARG1)
            (\
                NOTRANS(% no \title{..} info)\
            )
            (\
                TYPEOUT(Document title: ARG1)\
                NOTRANS(\title{)ARG1+CHAR(})\
            )
            XXnl()\
            IFEMPTY(ARG2)
            (\
                NOTRANS(% no \author{..} info)\
            )
            (\
                NOTRANS(\author{)ARG2\
                +XXifnempty(XXaffilstring)
                (\
                    nl()\
                    XXnl()\
                    SYMBOLVALUE(XXaffilstring)\
                )\
                CHAR(})\
            )\
            XXnl()\
            IFEMPTY(ARG3)
            (\
                NOTRANS(% no \date{..} info)\
            )
            (\
                NOTRANS(\date{)ARG3+CHAR(})\
            )\
            XXnl()\
            NOTRANS(\begin{document})
            IFEMPTY(ARG1)\
            (\
                NOTRANS(% no \author{..}, no \maketitle required here)\
            )
            (\
                NOTRANS(\maketitle\cleardoublepage)\
            )\
            XXnl()\
            XXabstract()\
            XXnl()\
            IFEMPTY(ARG1)
            (\
                NOTRANS(% no title, so no \maketitle)
            )
            (\
                XXsettitleclearpage()\
            )\
            XXnl()\
            NOTRANS(\pagestyle{plain})\
            XXnl()\
            NOTRANS(\pagenumbering{roman})\
            XXnl()\
            XXtableofcontents()\
            ATEXIT(\
                NOTRANS(\end{document})\
                XXnl()\
            )\
        )\
    latexoptions(a4paper,twoside)\
    latexpackage(latin1)(inputenc)\
    latexpackage()(makeidx)\
    COMMENT(
        latexpackage()(bookman)\
    )\
    latexpackage()(newcent)\
    latexpackage()(epsf)\
    latexpackage()(upquote)\

    COMMENT(Only for the 2024 celebration latexpackage()(graphicx) END)

    IFDEF(us)(\
        latexpackage()(cplusplusus)\
    )(\
        latexpackage()(cplusplus)\
    )\
    makeindex()\
    latexpackage(nottoc)(tocbibind)\
    latexpackage()(etoolbox)\
    sloppyhfuzz(50)\
    noxlatin()\
    latexlayoutcmds(\setcounter{secnumdepth}{3})\
    latexlayoutcmds(\pagestyle{empty})\
    latexlayoutcmds(\renewcommand*{\ttdefault}{lmtt})\
    latexlayoutcmds(\appto\ttfamily{\fontsize{10pt}{10pt}\selectfont})\
)()

DEFINEMACRO(tablecenter)(3)(\
    center(\
    attrib(style="margin-left:auto;margin-right:auto;")\
    tableatt(ARG1)(ARG2)(ARG3))\
    )

COMMENT(tlc: top left content. ARG1: empty or field width for LaTeX, e.g.,
        3cm. ARG1: content, supporting nl())
DEFINEMACRO(tlc)(2)(\
    IFDEF(html)(\
        tac(t)(NOTRANS(<div class="XXtl">)ARG2+NOTRANS(</div>))\
    )(\
        tac(t+IFEMPTY(ARG1)(l)(\
            +NOTRANS({{p{ARG1}}}))\
        )(ARG2)\
    )\
)

DEFINEMACRO(trc)(1)(\
    IFDEF(html)(\
        tac(t)(NOTRANS(<div class="XXtr">)ARG1+NOTRANS(</div>)\
                )\
    )(\
        tac(tr)(ARG1)\
    )\
)

DEFINEMACRO(centertbl)(2)(center(tbl(ARG1)(ARG2)))

COMMENT(used by namespaces/filesystem/filestatus)
DEFINEMACRO(rowtwo)(2)(\
    tr(tlc()(tt(ARG1))tlc()(ARG2))\
)


COMMENT(used by namespaces/filesystem/freefunctions)
DEFINEMACRO(threecols)(3)(\
    tr(tlc()(tt(ARG1)) trc(tt(ARG2)) cell(nbsp(3)) tlc()(ARG3))\
)


COMMENT(used by iostreams/puttime)
DEFINEMACRO(rowthree)(3)(\
    tr(tlc()(%ARG1)tc(nbsp())tlc(7.5cm)(ARG2)tc(nbsp())tlc()(ARG3))\
)

COMMENT(used by filesystem/filestatus)
DEFINEMACRO(rowfour)(4)(\
    tr(tlc()(ARG1)trc(ARG2)tlc()(ARG3)tlc(7.5cm)(ARG4))\
)

COMMENT(used by iostreams/puttime,filesystem/filestatus)
DEFINEMACRO(xcell)(2)(\
IFDEF(html)(NOTRANS(<td colspan="ARG1", class="XXtc">)\
            bf(ARG2)NOTRANS(</td>))\
    (cells(ARG1)(bf(ARG2))))

DEFINEMACRO(linebreak)(0)(\
    IFDEF(latex)\
        (NOTRANS(\linebreak ))\
        ())

DEFINEMACRO(turl)(2)(\
    IFDEF(html)\
        (NOTRANS(<a target=_top href="ARG2">)ARG1+NOTRANS(</a>))\
        (url(ARG1)(ARG2)))

DEFINEMACRO(tlurl)(1)(\
    IFDEF(html)\
        (NOTRANS(<a target=_top href="ARG1">)ARG1+NOTRANS(</a>))\
        (lurl(ARG1)))

DEFINEMACRO(lshift)(0)(\
    IFDEF(latex)(\
        NOTRANS($<<$)\
    )(\
        <<\
    )\
)

redefinemacro(verbinclude)(1)(\
    COMMENT(IFDEF(latex)(SUBST(\"e)(\"CHAR(101)))())\
    PIPETHROUGH(yodlverbinsert -N ARG1)()\
    COMMENT(IFDEF(latex)(SUBST(\"e)(+latexcommand(\"{CHAR(101)})))())\
)

COMMENT( DO NOT USE TO ADD INDEX ENTRIES )
DEFINEMACRO(rshift)(0)(\
    IFDEF(latex)(\
        NOTRANS($>>$)\
    )(\
        >>\
    )\
)

COMMENT( DO NOT USE TO ADD INDEX ENTRIES )
DEFINEMACRO(oplshift)(0)(\
    tt(operator)\
    IFDEF(latex)(\
        NOTRANS($<<$)\
    )(\
        <<\
    )\
)

COMMENT( DO NOT USE TO ADD INDEX ENTRIES )
DEFINEMACRO(oprshift)(0)(\
    tt(operator)\
    IFDEF(latex)(\
        NOTRANS($>>$)\
    )(\
        >>\
    )\
)

DEFINEMACRO(ttNoCt)(1)(PUSHCHARTABLE()ttbegin()ARG1+ttend()POPCHARTABLE())
DEFINEMACRO(hiNoCt)(1)(hix(ARG1))

DEFINECOUNTER(htmlAnchor)(0)

DEFINEMACRO(annotations)(0)(\
    bf(C++) Annotations\
)


COMMENT(    Begin previously used by threading/time.yo

DEFINEMACRO(xcell)(1)(\
IFDEF(html)(NOTRANS(<td colspan="3", class="lcell">)\
            bf(ARG1)NOTRANS(</td>))\
    (cells(3)(ARG1)))

DEFINEMACRO(vlcell)(1)(\
IFDEF(html)(NOTRANS(<td class="vlcell">)\
        ARG1+NOTRANS(</td>))\
    (cell(ARG1)))

DEFINEMACRO(vrcell)(1)(\
IFDEF(html)(NOTRANS(<td class="vrcell">)\
        ARG1+NOTRANS(</td>))\
    (cell(ARG1)))

DEFINEMACRO(vcell)(1)(\
IFDEF(html)(NOTRANS(<td class="vcell">)\
            ARG1+NOTRANS(</td>))(cell(ARG1)))

DEFINEMACRO(rcell)(1)(\
IFDEF(html)(NOTRANS(<td class="rcell">)\
    ARG1+NOTRANS(</td>))(cell(ARG1)))

DEFINEMACRO(lcell)(1)(\
IFDEF(html)(NOTRANS(<td class="lcell">)
    ARG1+NOTRANS(</td>))(cell(ARG1)))

DEFINEMACRO(rowthree)(3)(\
    row(vrcell(%ARG1)cell(nbsp())vlcell(ARG2)cell(nbsp()nbsp())vlcell(ARG3))\
)

    End previously used by threading/time.yo)


def(x)(1)(IFDEF(html)(NOTRANS(<!--!)ARG1+NOTRANS(!-->))()ARG1)
def(linkit)(2)(it()link(Chapter )(ARG1)ref(ARG1)link(: ARG2.)(ARG1))
def(itt)(1)(it()tt(ARG1))

def(rangett)(1)(tt(CHAR(91)ARG1+CHAR(41)))
def(endOfFile)(1)(tt(CHAR(69)CHAR(79)CHAR(70)))

def(c)(1)(COMMENT(ARG1))

def(hix)(1)(\
    IFDEF(html)(\
        label(an+USECOUNTER(htmlAnchor))\
        NOTRANS(
<index) \
        COUNTERVALUE(htmlAnchor) \
        ARG1\
        +NOTRANS(>
)\
    )(\
        IFDEF(latex)(\
            PUSHCHARTABLE(index)\
            NOTRANS(\index{)\
            ARG1\
            +NOTRANS(})\
            POPCHARTABLE()\
        )()\
    )\
)

def(hi)(1)(hix(ARG1))
def(i)(1)(hix(ARG1)ARG1)
def(tthi)(1)(hix(ARG1: header file)tt(<ARG1>))
def(ti)(1)(hix(ARG1)tt(ARG1))
def(bi)(1)(hix(ARG1)bf(ARG1))
def(emi)(1)(hix(ARG1)em(ARG1))
def(ithi)(1)(it()hi(ARG1: header file)tt(<ARG1>))
def(iti)(1)(it()ti(ARG1))
def(rangeti)(1)(ti(CHAR(91)ARG1+CHAR(41)))
def(itht)(2)(it()hix(ARG1)tt(ARG2))
def(itfun)(3)(it()hix(ARG2)tt(ARG1 ARG2(ARG3)))  
    COMMENT(for using:     itfun(void)(fun)(params)  )

COMMENT(
    def(ittq)(2)(it()tt(ARG1):quote(ARG2))
    def(ithtq)(3)(it()hix(ARG1)tt(ARG2):quote(ARG3))
)
def(ittq)(2)(it()tt(ARG1):nl()ARG2)
def(ithtq)(3)(it()hix(ARG1)tt(ARG2):nl()ARG3)

def(cellq)(0)(cell(IFDEF(latex)()(quote())))

IFDEF(html)(\
    redef(XXsubsubsect)(1)(\
        XXtocentry(sssect SYMBOLVALUE(XXlastnumber): ARG1)\
        NOTRANS(<h4>)\
        SYMBOLVALUE(XXlastnumber): ARG1\
        +NOTRANS(</h4>)\
    )\
    redef(subsubsubsect)(1)
    (
        NOTRANS(<h5>)\
        ARG1\
        +NOTRANS(</h5><br>)\
    )
)()
