\documentclass{report}
\usepackage{hyperref}
% WARNING: THIS SHOULD BE MODIFIED DEPENDING ON THE LETTER/A4 SIZE
\oddsidemargin 0cm
\evensidemargin 0cm
\marginparsep 0cm
\marginparwidth 0cm
\parindent 0cm
\setlength{\textwidth}{\paperwidth}
\addtolength{\textwidth}{-2in}


% Conditional define to determine if pdf output is used
\newif\ifpdf
\ifx\pdfoutput\undefined
\pdffalse
\else
\pdfoutput=1
\pdftrue
\fi

\ifpdf
  \usepackage[pdftex]{graphicx}
\else
  \usepackage[dvips]{graphicx}
\fi

% Write Document information for pdflatex/pdftex
\ifpdf
\pdfinfo{
 /Author     (Pasdoc)
 /Title      ()
}
\fi


% definitons for warning and note tag
\usepackage[most]{tcolorbox}
\newtcolorbox{tcbwarning}{
 breakable,
 enhanced jigsaw,
 top=0pt,
 bottom=0pt,
 titlerule=0pt,
 bottomtitle=0pt,
 rightrule=0pt,
 toprule=0pt,
 bottomrule=0pt,
 colback=white,
 arc=0pt,
 outer arc=0pt,
 title style={white},
 fonttitle=\color{black}\bfseries,
 left=8pt,
 colframe=red,
 title={Warning:},
}
\newtcolorbox{tcbnote}{
 breakable,
 enhanced jigsaw,
 top=0pt,
 bottom=0pt,
 titlerule=0pt,
 bottomtitle=0pt,
 rightrule=0pt,
 toprule=0pt,
 bottomrule=0pt,
 colback=white,
 arc=0pt,
 outer arc=0pt,
 title style={white},
 fonttitle=\color{black}\bfseries,
 left=8pt,
 colframe=yellow,
 title={Note:},
}

\begin{document}
\label{toc}\tableofcontents
\newpage
% special variable used for calculating some widths.
\newlength{\tmplength}
\chapter{Unit ok{\_}macros}
\label{ok_macros}
\index{ok{\_}macros}
\section{Description}
Test of FPC macros handling.\hfill\vspace*{1ex}



Parts based on [\href{http://sourceforge.net/tracker/index.php?func=detail&aid=861356&group_id=4213&atid=354213}{http://sourceforge.net/tracker/index.php?func=detail{\&}aid=861356{\&}group{\_}id=4213{\&}atid=354213}]
\section{Overview}
\begin{description}
\item[\texttt{\begin{ttfamily}TAncestor\end{ttfamily} Class}]
\item[\texttt{\begin{ttfamily}TMyClass\end{ttfamily} Class}]
\end{description}
\begin{description}
\item[\texttt{MyProc1}]Below is an example of a very bad and confusing (but valid) macro usage.
\item[\texttt{MyProc2}]This is very stupid way to declare a procedure
\item[\texttt{Foo}]
\item[\texttt{MyProc3}]
\item[\texttt{ThisShouldBeIncluded}]
\item[\texttt{ThisShouldBeIncluded2}]
\end{description}
\section{Classes, Interfaces, Objects and Records}
\ifpdf
\subsection*{\large{\textbf{TAncestor Class}}\normalsize\hspace{1ex}\hrulefill}
\else
\subsection*{TAncestor Class}
\fi
\label{ok_macros.TAncestor}
\index{TAncestor}
\subsubsection*{\large{\textbf{Hierarchy}}\normalsize\hspace{1ex}\hfill}
TAncestor {$>$} TObject
%%%%Description
\ifpdf
\subsection*{\large{\textbf{TMyClass Class}}\normalsize\hspace{1ex}\hrulefill}
\else
\subsection*{TMyClass Class}
\fi
\label{ok_macros.TMyClass}
\index{TMyClass}
\subsubsection*{\large{\textbf{Hierarchy}}\normalsize\hspace{1ex}\hfill}
TMyClass {$>$} \begin{ttfamily}TAncestor\end{ttfamily}(\ref{ok_macros.TAncestor}) {$>$} 
TObject
%%%%Description
\subsubsection*{\large{\textbf{Methods}}\normalsize\hspace{1ex}\hfill}
\paragraph*{Init}\hspace*{\fill}

\label{ok_macros.TMyClass-Init}
\index{Init}
\begin{list}{}{
\settowidth{\tmplength}{\textbf{Description}}
\setlength{\itemindent}{0cm}
\setlength{\listparindent}{0cm}
\setlength{\leftmargin}{\evensidemargin}
\addtolength{\leftmargin}{\tmplength}
\settowidth{\labelsep}{X}
\addtolength{\leftmargin}{\labelsep}
\setlength{\labelwidth}{\tmplength}
}
\item[\textbf{Declaration}\hfill]
\ifpdf
\begin{flushleft}
\fi
\begin{ttfamily}
public Constructor Init; Overload;\end{ttfamily}

\ifpdf
\end{flushleft}
\fi

\end{list}
\section{Functions and Procedures}
\ifpdf
\subsection*{\large{\textbf{MyProc1}}\normalsize\hspace{1ex}\hrulefill}
\else
\subsection*{MyProc1}
\fi
\label{ok_macros-MyProc1}
\index{MyProc1}
\begin{list}{}{
\settowidth{\tmplength}{\textbf{Description}}
\setlength{\itemindent}{0cm}
\setlength{\listparindent}{0cm}
\setlength{\leftmargin}{\evensidemargin}
\addtolength{\leftmargin}{\tmplength}
\settowidth{\labelsep}{X}
\addtolength{\leftmargin}{\labelsep}
\setlength{\labelwidth}{\tmplength}
}
\item[\textbf{Declaration}\hfill]
\ifpdf
\begin{flushleft}
\fi
\begin{ttfamily}
procedure MyProc1( a:Integer);\end{ttfamily}

\ifpdf
\end{flushleft}
\fi

\par
\item[\textbf{Description}]
Below is an example of a very bad and confusing (but valid) macro usage. Just to test pasdoc.

\end{list}
\ifpdf
\subsection*{\large{\textbf{MyProc2}}\normalsize\hspace{1ex}\hrulefill}
\else
\subsection*{MyProc2}
\fi
\label{ok_macros-MyProc2}
\index{MyProc2}
\begin{list}{}{
\settowidth{\tmplength}{\textbf{Description}}
\setlength{\itemindent}{0cm}
\setlength{\listparindent}{0cm}
\setlength{\leftmargin}{\evensidemargin}
\addtolength{\leftmargin}{\tmplength}
\settowidth{\labelsep}{X}
\addtolength{\leftmargin}{\labelsep}
\setlength{\labelwidth}{\tmplength}
}
\item[\textbf{Declaration}\hfill]
\ifpdf
\begin{flushleft}
\fi
\begin{ttfamily}
procedure MyProc2( b: Integer);\end{ttfamily}

\ifpdf
\end{flushleft}
\fi

\par
\item[\textbf{Description}]
This is very stupid way to declare a procedure

\end{list}
\ifpdf
\subsection*{\large{\textbf{Foo}}\normalsize\hspace{1ex}\hrulefill}
\else
\subsection*{Foo}
\fi
\label{ok_macros-Foo}
\index{Foo}
\begin{list}{}{
\settowidth{\tmplength}{\textbf{Description}}
\setlength{\itemindent}{0cm}
\setlength{\listparindent}{0cm}
\setlength{\leftmargin}{\evensidemargin}
\addtolength{\leftmargin}{\tmplength}
\settowidth{\labelsep}{X}
\addtolength{\leftmargin}{\labelsep}
\setlength{\labelwidth}{\tmplength}
}
\item[\textbf{Declaration}\hfill]
\ifpdf
\begin{flushleft}
\fi
\begin{ttfamily}
function Foo(c: string): Integer;\end{ttfamily}

\ifpdf
\end{flushleft}
\fi

\end{list}
\ifpdf
\subsection*{\large{\textbf{MyProc3}}\normalsize\hspace{1ex}\hrulefill}
\else
\subsection*{MyProc3}
\fi
\label{ok_macros-MyProc3}
\index{MyProc3}
\begin{list}{}{
\settowidth{\tmplength}{\textbf{Description}}
\setlength{\itemindent}{0cm}
\setlength{\listparindent}{0cm}
\setlength{\leftmargin}{\evensidemargin}
\addtolength{\leftmargin}{\tmplength}
\settowidth{\labelsep}{X}
\addtolength{\leftmargin}{\labelsep}
\setlength{\labelwidth}{\tmplength}
}
\item[\textbf{Declaration}\hfill]
\ifpdf
\begin{flushleft}
\fi
\begin{ttfamily}
procedure MyProc3( X: Integer = 1; Y: Integer = 2);\end{ttfamily}

\ifpdf
\end{flushleft}
\fi

\end{list}
\ifpdf
\subsection*{\large{\textbf{ThisShouldBeIncluded}}\normalsize\hspace{1ex}\hrulefill}
\else
\subsection*{ThisShouldBeIncluded}
\fi
\label{ok_macros-ThisShouldBeIncluded}
\index{ThisShouldBeIncluded}
\begin{list}{}{
\settowidth{\tmplength}{\textbf{Description}}
\setlength{\itemindent}{0cm}
\setlength{\listparindent}{0cm}
\setlength{\leftmargin}{\evensidemargin}
\addtolength{\leftmargin}{\tmplength}
\settowidth{\labelsep}{X}
\addtolength{\leftmargin}{\labelsep}
\setlength{\labelwidth}{\tmplength}
}
\item[\textbf{Declaration}\hfill]
\ifpdf
\begin{flushleft}
\fi
\begin{ttfamily}
procedure ThisShouldBeIncluded;\end{ttfamily}

\ifpdf
\end{flushleft}
\fi

\end{list}
\ifpdf
\subsection*{\large{\textbf{ThisShouldBeIncluded2}}\normalsize\hspace{1ex}\hrulefill}
\else
\subsection*{ThisShouldBeIncluded2}
\fi
\label{ok_macros-ThisShouldBeIncluded2}
\index{ThisShouldBeIncluded2}
\begin{list}{}{
\settowidth{\tmplength}{\textbf{Description}}
\setlength{\itemindent}{0cm}
\setlength{\listparindent}{0cm}
\setlength{\leftmargin}{\evensidemargin}
\addtolength{\leftmargin}{\tmplength}
\settowidth{\labelsep}{X}
\addtolength{\leftmargin}{\labelsep}
\setlength{\labelwidth}{\tmplength}
}
\item[\textbf{Declaration}\hfill]
\ifpdf
\begin{flushleft}
\fi
\begin{ttfamily}
procedure ThisShouldBeIncluded2;\end{ttfamily}

\ifpdf
\end{flushleft}
\fi

\end{list}
\section{Constants}
\ifpdf
\subsection*{\large{\textbf{ThisShouldBeTrue}}\normalsize\hspace{1ex}\hrulefill}
\else
\subsection*{ThisShouldBeTrue}
\fi
\label{ok_macros-ThisShouldBeTrue}
\index{ThisShouldBeTrue}
\begin{list}{}{
\settowidth{\tmplength}{\textbf{Description}}
\setlength{\itemindent}{0cm}
\setlength{\listparindent}{0cm}
\setlength{\leftmargin}{\evensidemargin}
\addtolength{\leftmargin}{\tmplength}
\settowidth{\labelsep}{X}
\addtolength{\leftmargin}{\labelsep}
\setlength{\labelwidth}{\tmplength}
}
\item[\textbf{Declaration}\hfill]
\ifpdf
\begin{flushleft}
\fi
\begin{ttfamily}
ThisShouldBeTrue = true;\end{ttfamily}

\ifpdf
\end{flushleft}
\fi

\end{list}
\ifpdf
\subsection*{\large{\textbf{FourConst}}\normalsize\hspace{1ex}\hrulefill}
\else
\subsection*{FourConst}
\fi
\label{ok_macros-FourConst}
\index{FourConst}
\begin{list}{}{
\settowidth{\tmplength}{\textbf{Description}}
\setlength{\itemindent}{0cm}
\setlength{\listparindent}{0cm}
\setlength{\leftmargin}{\evensidemargin}
\addtolength{\leftmargin}{\tmplength}
\settowidth{\labelsep}{X}
\addtolength{\leftmargin}{\labelsep}
\setlength{\labelwidth}{\tmplength}
}
\item[\textbf{Declaration}\hfill]
\ifpdf
\begin{flushleft}
\fi
\begin{ttfamily}
FourConst =  (1 + 1) * (1 + 1);\end{ttfamily}

\ifpdf
\end{flushleft}
\fi

\par
\item[\textbf{Description}]
Test of recursive macro expansion.

\end{list}
\ifpdf
\subsection*{\large{\textbf{OneAndNotNothing}}\normalsize\hspace{1ex}\hrulefill}
\else
\subsection*{OneAndNotNothing}
\fi
\label{ok_macros-OneAndNotNothing}
\index{OneAndNotNothing}
\begin{list}{}{
\settowidth{\tmplength}{\textbf{Description}}
\setlength{\itemindent}{0cm}
\setlength{\listparindent}{0cm}
\setlength{\leftmargin}{\evensidemargin}
\addtolength{\leftmargin}{\tmplength}
\settowidth{\labelsep}{X}
\addtolength{\leftmargin}{\labelsep}
\setlength{\labelwidth}{\tmplength}
}
\item[\textbf{Declaration}\hfill]
\ifpdf
\begin{flushleft}
\fi
\begin{ttfamily}
OneAndNotNothing = 1  + 1;\end{ttfamily}

\ifpdf
\end{flushleft}
\fi

\par
\item[\textbf{Description}]
Test that symbol that is not a macro is something different than a macro that expands to nothing.

\end{list}
\ifpdf
\subsection*{\large{\textbf{OnlyOne}}\normalsize\hspace{1ex}\hrulefill}
\else
\subsection*{OnlyOne}
\fi
\label{ok_macros-OnlyOne}
\index{OnlyOne}
\begin{list}{}{
\settowidth{\tmplength}{\textbf{Description}}
\setlength{\itemindent}{0cm}
\setlength{\listparindent}{0cm}
\setlength{\leftmargin}{\evensidemargin}
\addtolength{\leftmargin}{\tmplength}
\settowidth{\labelsep}{X}
\addtolength{\leftmargin}{\labelsep}
\setlength{\labelwidth}{\tmplength}
}
\item[\textbf{Declaration}\hfill]
\ifpdf
\begin{flushleft}
\fi
\begin{ttfamily}
OnlyOne = 1 ;\end{ttfamily}

\ifpdf
\end{flushleft}
\fi

\end{list}
\end{document}
