intfpc.sty 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. %
  2. % $Id$
  3. % This file is part of the FPC documentation.
  4. % Copyright (C) 1997, by Michael Van Canneyt
  5. %
  6. % The FPC documentation is free text; you can redistribute it and/or
  7. % modify it under the terms of the GNU Library General Public License as
  8. % published by the Free Software Foundation; either version 2 of the
  9. % License, or (at your option) any later version.
  10. %
  11. % The FPC Documentation is distributed in the hope that it will be useful,
  12. % but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. % Library General Public License for more details.
  15. %
  16. % You should have received a copy of the GNU Library General Public
  17. % License along with the FPC documentation; see the file COPYING.LIB. If not,
  18. % write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. % Boston, MA 02111-1307, USA.
  20. %
  21. \ProvidesPackage{intfpc}[1996/12/09]
  22. \NeedsTeXFormat{LaTeX2e}
  23. \RequirePackage{multicol}
  24. \RequirePackage{epsfig}
  25. \RequirePackage{xspace}
  26. \RequirePackage{ifthen}
  27. \RequirePackage{listings}
  28. \RequirePackage{makeidx}
  29. \RequirePackage{a4}
  30. \RequirePackage{fancyhdr}
  31. \ExecuteOptions{titlepage}
  32. % Some style elements
  33. \parindent 0pt%
  34. \parskip 0.35\baselineskip%
  35. % First, all definitions for latex only.
  36. \newcommand{\docdescription}[1]{\def\@FPCDescription{#1}}
  37. \gdef\@FPCDescription{}%
  38. \newcommand{\docversion}[1]{\def\@FPCVersion{#1}}
  39. \gdef\@FPCVersion{}%
  40. % For backwards compatibility
  41. \newcommand{\unitdescription}[1]{\def\@FPCDescription{#1}}
  42. \newcommand{\unitversion}[1]{\def\@FPCVersion{#1}}
  43. \renewcommand\maketitle{\begin{titlepage}%
  44. \let\footnotesize\small
  45. \let\footnoterule\relax
  46. \null\vfil
  47. \vskip 4cm%
  48. {\noindent\raggedright\Large\@title\\}%
  49. \noindent \rule{\linewidth}{1.5mm}\\%
  50. {\raggedleft\large%
  51. \begin{tabular}[t]{r}%
  52. \@FPCDescription \\
  53. \@FPCVersion \\
  54. \@date
  55. \end{tabular}\par}%
  56. \vskip 5cm%
  57. {\noindent \large \textsf{\@author} \\%
  58. \rule{\linewidth}{0.5mm}}
  59. \@thanks
  60. \vfil\null
  61. \end{titlepage}%
  62. \setcounter{footnote}{0}%
  63. \let\thanks\relax\let\maketitle\relax
  64. \gdef\@thanks{}\gdef\@author{}\gdef\@title{}}
  65. % end of \maketitle
  66. % For the \procedure and \function commands, we don't want heading numbers.
  67. \setcounter{secnumdepth}{2}
  68. \setcounter{tocdepth}{4}
  69. % redefine the subsection command to leave less space,
  70. %and to use sans serif
  71. \renewcommand\subsection{\@startsection%
  72. {subsection}%
  73. {2}%
  74. {\z@}%
  75. {-4.25ex\@plus -1ex \@minus -.2ex}%
  76. {1pt}%
  77. {\normalfont\large\sffamily\bfseries}}
  78. % Now, Let's define the \procedure and \function commands.
  79. \newcommand{\FPClabel}[1]{%
  80. \raggedleft\makebox[0pt][r]{\textsf{#1:}}
  81. }
  82. %
  83. % FPC environments
  84. %
  85. % Lists
  86. \newenvironment{FPCList}
  87. {\begin{list}{}{%
  88. \renewcommand{\makelabel}[1]{\FPClabel{##1}\hfil\relax}
  89. \setlength{\labelwidth}{0pt}%
  90. \setlength{\leftmargin}{0pt}}%
  91. \setlength{\labelsep}{0pt}%
  92. }
  93. {\end{list}}
  94. %
  95. % remarks
  96. %
  97. \newenvironment{remark}{\par\makebox[0pt][r]{\bfseries{}Remark:\hspace{.25em}}}{\par}
  98. % For Tables.
  99. \newenvironment{FPCtable}[2]{\begin{table}[ht]\caption{#2}\begin{center}\begin{tabular}{#1}}{\end{tabular}\end{center}\end{table}}
  100. % The same, but with label in third argument (tab:#3)
  101. \newenvironment{FPCltable}[3]{\begin{table}[ht]\caption{#2}\label{tab:#3}\begin{center}\begin{tabular}{#1}}{\end{tabular}\end{center}\end{table}}
  102. %
  103. % Refs
  104. %
  105. \newcommand{\seefig}[1]{figure (\ref{fig:#1})\xspace}
  106. \newcommand{\seefl}[2]{\textsf{#1} (\pageref{fu:#2})}
  107. \newcommand{\seepl}[2]{\textsf{#1} (\pageref{pro:#2})}
  108. \newcommand{\seetypel}[2]{\textsf{#1} (\pageref{ty:#2})}
  109. \newcommand{\seeconstl}[2]{\textsf{#1} (\pageref{co:#2})}
  110. \newcommand{\seevarl}[2]{\textsf{#1} (\pageref{var:#2})}
  111. \newcommand{\seec}[1]{chapter \ref{ch:#1}, page \pageref{ch:#1}\xspace}
  112. \newcommand{\sees}[1]{section \ref{se:#1}, page \pageref{se:#1}\xspace}
  113. \newcommand{\seeo}[1]{\var{-#1}, (see page \ref{option:#1})\xspace}
  114. \newcommand{\seet}[1]{table (\ref{tab:#1})\xspace}
  115. %
  116. % Function/procedure environments
  117. %
  118. \newenvironment{functionl}[2]{\paragraph{#1}\index{#1}\label{fu:#2}\begin{FPCList}}{\end{FPCList}}
  119. \newenvironment{procedurel}[2]{\paragraph{#1}\index{#1}\label{pro:#2}\begin{FPCList}}{\end{FPCList}}
  120. \newenvironment{method}[2]{\paragraph{#1}\index{#1}\label{#2}\begin{FPCList}}{\end{FPCList}}
  121. \newenvironment{property}[2]{\paragraph{#1}\index{#1}\label{#2}\begin{FPCList}}{\end{FPCList}}
  122. \newenvironment{function}[1]{\begin{functionl}{#1}{#1}}{\end{functionl}}
  123. \newenvironment{procedure}[1]{\begin{procedurel}{#1}{#1}}{\end{procedurel}}
  124. \newenvironment{typel}[2]{\paragraph{#1}\index{#1}\label{ty:#2}\begin{FPCList}}{\end{FPCList}}
  125. \newenvironment{type}[1]{\begin{typel}{#1}{#1}}{\end{typel}}
  126. \newenvironment{constantl}[2]{\subsection{#1}\index{#1}\label{co:#2}\begin{FPCList}}{\end{FPCList}}
  127. \newenvironment{constant}[1]{\begin{constantl}{#1}{#1}}{\end{constantl}}
  128. \newenvironment{variablel}[2]{\paragraph{#1}\index{#1}\label{var:#2}\begin{FPCList}}{\end{FPCList}}
  129. \newenvironment{variable}[1]{\begin{variablel}{#1}{#1}}{\end{variablel}}
  130. \newenvironment{functionl3}[2]{\paragraph{#1}\index{#1}\label{fu:#2}\begin{FPCList}}{\end{FPCList}}
  131. \newenvironment{procedurel3}[2]{\paragraph{#1}\index{#1}\label{pro:#2}\begin{FPCList}}{\end{FPCList}}
  132. \newenvironment{method3}[2]{\paragraph{#1}\index{#1}\label{#2}\begin{FPCList}}{\end{FPCList}}
  133. \newenvironment{property3}[2]{\paragraph{#1}\index{#1}\label{#2}\begin{FPCList}}{\end{FPCList}}
  134. \newenvironment{function3}[1]{\begin{functionl3}{#1}{#1}}{\end{functionl}}
  135. \newenvironment{procedure3}[1]{\begin{procedurel3}{#1}{#1}}{\end{procedurel}}
  136. \newenvironment{typel3}[2]{\paragraph{#1}\index{#1}\label{ty:#2}\begin{FPCList}}{\end{FPCList}}
  137. \newenvironment{type3}[1]{\begin{typel3}{#1}{#1}}{\end{typel}}
  138. \newenvironment{constantl3}[2]{\subsection{#1}\index{#1}\label{co:#2}\begin{FPCList}}{\end{FPCList}}
  139. \newenvironment{constant3}[1]{\begin{constantl3}{#1}{#1}}{\end{constantl}}
  140. \newenvironment{variablel3}[2]{\paragraph{#1}\index{#1}\label{var:#2}\begin{FPCList}}{\end{FPCList}}
  141. \newenvironment{variable3}[1]{\begin{variablel3}{#1}{#1}}{\end{variablel}}
  142. \newcommand{\Declaration}{\item[Declaration]\ttfamily}
  143. \newcommand{\Description}{\item[Description]\rmfamily}
  144. \newcommand{\Parameters}{\item[Parameters]\rmfamily}
  145. \newcommand{\Errors}{\item[Errors]\rmfamily}
  146. \newcommand{\Visibility}{\item[Visibility]\ttfamily}
  147. \newcommand{\Notes}{\item[Notes]\rmfamily}
  148. \newcommand{\Algorithm}{\item[Algorithm]\rmfamily}
  149. \newcommand{\Synopsis}{\item[Synopsis]\rmfamily}
  150. \newcommand{\Arguments}{\item[Arguments]\rmfamily}
  151. \newcommand{\SeeAlso}{\item[See also]\rmfamily}
  152. %
  153. % Ref without labels
  154. %
  155. \newcommand{\seef}[1]{\seefl{#1}{#1}}
  156. \newcommand{\seep}[1]{\seepl{#1}{#1}}
  157. \newcommand{\seetype}[1]{\seetypel{#1}{#1}}
  158. \newcommand{\seevar}[1]{\seevarl{#1}{#1}}
  159. \newcommand{\seeconst}[1]{\seeconstl{#1}{#1}}
  160. %
  161. % man page references don't need labels.
  162. %
  163. \newcommand{\seem}[2]{\texttt{#1} (#2) }
  164. %
  165. % for easy typesetting of variables.
  166. %
  167. \newcommand{\var}[1]{\texttt {#1}}
  168. \newcommand{\file}[1]{\textsf {#1}}
  169. \newcommand{\key}[1]{\textsc{#1}}
  170. \newcommand{\menu}[1]{\textbf{"#1"}}
  171. %
  172. % Useful references.
  173. %
  174. \newcommand{\progref}{\htmladdnormallink{Programmers guide}{../prog/prog.html}\xspace}
  175. \newcommand{\refref}{\htmladdnormallink{Reference guide}{../ref/ref.html}\xspace}
  176. \newcommand{\userref}{\htmladdnormallink{Users guide}{../user/user.html}\xspace}
  177. \newcommand{\unitsref}{\htmladdnormallink{Unit reference}{../units/units.html}\xspace}
  178. \newcommand{\seecrt}{\htmladdnormallink{CRT}{../crt/crt.html}\xspace}
  179. \newcommand{\seelinux}{\htmladdnormallink{Linux}{../linux/linux.html}\xspace}
  180. \newcommand{\seestrings}{\htmladdnormallink{strings}{../strings/strings.html}\xspace}
  181. \newcommand{\seedos}{\htmladdnormallink{DOS}{../dos/dos.html}\xspace}
  182. \newcommand{\seegetopts}{\htmladdnormallink{getopts}{../getopts/getopts.html}\xspace}
  183. \newcommand{\seeobjects}{\htmladdnormallink{objects}{../objects/objects.html}\xspace}
  184. \newcommand{\seegraph}{\htmladdnormallink{graph}{../graph/graph.html}\xspace}
  185. \newcommand{\seeprinter}{\htmladdnormallink{printer}{../printer/printer.html}\xspace}
  186. \newcommand{\seego}{\htmladdnormallink{GO32}{../go32/go32.html}\xspace}
  187. %
  188. % Commands to reference these things.
  189. %
  190. \newcommand{\olabel}[1]{\label{option:#1}}
  191. %
  192. % some OSes
  193. %
  194. \newcommand{\linux}{\textsc{linux}\xspace}
  195. \newcommand{\unix}{\textsc{unix}\xspace}
  196. \newcommand{\dos} {\textsc{dos}\xspace}
  197. \newcommand{\msdos}{\textsc{ms-dos}\xspace}
  198. \newcommand{\ostwo}{\textsc{os/2}\xspace}
  199. \newcommand{\windows}{\textsc{Windows}\xspace}
  200. \newcommand{\windowsnt}{\textsc{Windows NT}\xspace}
  201. \newcommand{\fpc}{Free Pascal\xspace}
  202. \newcommand{\gnu}{\textsc{gnu}\xspace}
  203. \newcommand{\atari}{\textsc{Atari}\xspace}
  204. \newcommand{\amiga}{\textsc{Amiga}\xspace}
  205. \newcommand{\solaris}{\textsc{Solaris}\xspace}
  206. \newcommand{\qnx}{\textsc{QNX Realtime platform}\xspace}
  207. \newcommand{\beos}{\textsc{BeOS}\xspace}
  208. \newcommand{\palmos}{\textsc{PalmOS}\xspace}
  209. \newcommand{\netbsd}{\textsc{NetBSD}\xspace}
  210. \newcommand{\win}{\textsc{Win32}\xspace}
  211. \newcommand{\freebsd}{\textsc{FreeBSD}\xspace}
  212. \newcommand{\tp}{Turbo Pascal\xspace}
  213. \newcommand{\delphi}{Delphi}
  214. %
  215. % Some versions
  216. %
  217. \newcommand{\fpcversion}{1.0.2}
  218. %
  219. % PDF support
  220. %
  221. \newif\ifpdf
  222. \ifx\pdfoutput\undefined
  223. \pdffalse
  224. \else
  225. \pdfoutput=1
  226. \pdftrue
  227. \fi
  228. %
  229. % PDF stuff
  230. %
  231. \ifpdf
  232. \usepackage[pdftex,bookmarks=true,colorlinks=true,linkcolor=blue]{hyperref}
  233. \usepackage{times}
  234. \usepackage[T1]{fontenc}
  235. \setcounter{secnumdepth}{2}
  236. \setcounter{tocdepth}{4}
  237. \pdfcompresslevel=9
  238. \pdfpagewidth=210mm
  239. \pdfpageheight=297mm
  240. \else
  241. \usepackage[dvips,bookmarks=true,colorlinks=true,linkcolor=blue]{hyperref}
  242. \fi
  243. %
  244. % Fake Latex2Html support, so latex2html is not required
  245. %
  246. \RequirePackage{fakehtml}
  247. %
  248. %
  249. % For examples
  250. %
  251. \latex{%
  252. \newcommand{\FPCexample}[1]{%
  253. \par \file{\textbf{Listing:} \exampledir/#1.pp}%
  254. \lstinputlisting{\exampledir/#1.pp}%
  255. }
  256. \newcommand{\Cexample}[1]{%
  257. \par \file{\textbf{Listing:} \exampledir/#1.c}%
  258. \lstinputlisting[language=c]{\exampledir/#1.c}%
  259. }
  260. }
  261. \newcommand{\exampledir}{.}
  262. \newcommand{\FPCexampledir}[1]{\renewcommand{\exampledir}{#1}}
  263. %
  264. % Categorical Function/procedure overviews
  265. %
  266. \newenvironment{funclist}{%
  267. \par
  268. \raisebox{-1em}{\makebox[\textwidth]{Name\hfill Description \hfill Page}}\\
  269. \rule{\textwidth}{1pt}
  270. \html{Name\hfill Description \hfill Page}
  271. \begin{list}{}{%
  272. \setlength{\rightmargin}{0pt}\setlength{\topsep}{0cm}\setlength{\partopsep}{0pt}%
  273. \setlength{\itemsep}{0pt}\setlength{\labelwidth}{3.5cm}%
  274. \setlength{\leftmargin}{4cm}%
  275. \renewcommand{\makelabel}[1]{\textsf{##1\hfil}}%
  276. }}%
  277. {\end{list}}
  278. \newcommand{\funcrefl}[3]{\item[#1] #3 \hfill\pageref{fu:#2}}
  279. \newcommand{\funcref}[2]{\item[#1] #2 \hfill\pageref{fu:#1}}
  280. \newcommand{\procrefl}[3]{\item[#1] #3 \hfill\pageref{pro:#2}}
  281. \newcommand{\procref}[2]{\item[#1] #2 \hfill\pageref{pro:#1}}
  282. %
  283. % Set some listings options.
  284. %
  285. \latex{%
  286. \usepackage{listings}%
  287. \lstset{language=Delphi}%
  288. \lstset{basicstyle=\sffamily\small}%
  289. \lstset{commentstyle=\itshape}%
  290. \lstset{keywordstyle=\bfseries}%
  291. \lstset{frame=tb}%
  292. }
  293. %
  294. % Page settings
  295. \setlength{\oddsidemargin}{20pt}
  296. \addtolength{\textwidth}{39pt}
  297. %
  298. % FancyHeader settings.
  299. %
  300. \pagestyle{fancy}
  301. \fancyhead[LO,RE]{}
  302. \addtolength{\headwidth}{\marginparsep}
  303. \addtolength{\headwidth}{\marginparwidth}
  304. \addtolength{\headwidth}{-59pt}
  305. %
  306. % end of fpc.sty