michael 26 лет назад
Родитель
Сommit
4d1a9c3bf8
13 измененных файлов с 816 добавлено и 244 удалено
  1. 3 0
      docs/README.DOCS
  2. 9 8
      docs/dos.tex
  3. 14 3
      docs/fpc.sty
  4. 12 1
      docs/fpcman.sty
  5. 12 0
      docs/go32.tex
  6. 2 1
      docs/onechap.tex
  7. 413 1
      docs/prog.tex
  8. 13 0
      docs/ref.tex
  9. 15 8
      docs/sockets.tex
  10. 6 10
      docs/strings.tex
  11. 281 208
      docs/sysutils.tex
  12. 16 1
      docs/units.tex
  13. 20 3
      docs/user.tex

+ 3 - 0
docs/README.DOCS

@@ -6,6 +6,8 @@ it uses special style files (fpc*.sty) which are also in the directory.
 do a 'make dvi' to produce the dvi format of the docs.
 a 'make html' will produce the html version (using latex2html).
 a 'make ps' will produce PostScript documents.
+a 'make pdf' will produce PDF (Portable Document Format) documents.
+a 'make txt' will produce plain text documents.
 
 If you want to produce dos docs, you can do a 'make htm' this will convert
 the .html files to .htm files (including all references), suitable for a 8:3
@@ -20,6 +22,7 @@ Why LaTeX ?
 - because I like a printed copy of the manuals, HTML just isn't good enough 
   for this.
 - I know LaTeX very well :) (mind you : html also !)
+- It converts to many other formats.
 - many other reasons.
 
 In order to translate the things to HTML, I use latex2html, since it is the

+ 9 - 8
docs/dos.tex

@@ -302,24 +302,24 @@ None.
 \SeeAlso
 
 \end{function}
+
 \latex{\inputlisting{dosex/ex1.pp}}
 \html{\input{dosex/ex1.tex}}
+
 \begin{function}{EnvCount}
 \Declaration
 Function EnvCount  : longint;
-
 \Description
-
 \var{EnvCount} returns the number of environment variables.
 \Errors
 None.
 \SeeAlso
-\seef{EnvStr}, \seef{GetEnv}
+\seef{EnvStr}, \seef{Dos:GetEnv}
 \end{function}
+
 \begin{function}{EnvStr}
 \Declaration
 Function EnvStr (Index: integer) : string;
-
 \Description
 
 \var{EnvStr} returns the \var{Index}-th \var{Name=Value} pair from the list
@@ -329,7 +329,7 @@ The index of the first pair is zero.
 The length is limited to 255 characters. This may cause problems under
 \linux. The \linux unit solves this problem.
 \SeeAlso
-\seef{EnvCount}, \seef{GetEnv}
+\seef{EnvCount}, \seef{Dos:GetEnv}
 \end{function}
 \latex{\inputlisting{dosex/ex13.pp}}
 \html{\input{dosex/ex13.tex}}
@@ -489,10 +489,10 @@ not implemented, i.e. the call does nothing.
 \SeeAlso
 \seep{SetCBreak}
 \end{procedure}
+
 \begin{procedurel}{GetDate}{Dos:GetDate}
 \Declaration
 Procedure GetDate (var year, month, mday, wday: word);
-
 \Description
 
 \var{GetDate} returns the system's date. \var{Year} is a number in the range
@@ -705,9 +705,10 @@ On a \linux  machine, this is not implemented (allthough a procedure
 exists, it just doesn't do anything. The setting of the date is a
 root-only privilege, and is hence not implemented.
 \SeeAlso
-\seep{GetDate},
+\seep{Dos:GetDate},
 \seep{SetTime}
 \end{procedure}
+
 \begin{procedure}{SetFAttr}
 \Declaration
 Procedure SetFAttr (var F; Attr: word);
@@ -775,7 +776,7 @@ on a 24-hour time scale.
 this call exists, but is not implemented on \linux, 
 as setting the time is a root-only privilege.
 \SeeAlso
-\seep{GetTime}, \seep{SetDate}
+\seep{Dos:GetTime}, \seep{SetDate}
 \end{procedure}
 \begin{procedure}{SetVerify}
 \Declaration

+ 14 - 3
docs/fpc.sty

@@ -138,8 +138,8 @@
 \newcommand{\seegraph}{\htmladdnormallink{graph}{../graph/graph.html}\xspace}
 \newcommand{\seeprinter}{\htmladdnormallink{printer}{../printer/printer.html}\xspace}
 \newcommand{\seego}{\htmladdnormallink{GO32}{../go32/go32.html}\xspace}
-\newcommand{\seec}[1]{chapter \ref{ch:#1}\xspace}
-\newcommand{\sees}[1]{section \ref{se:#1}\xspace}
+\newcommand{\seec}[1]{chapter \ref{ch:#1}, page \pageref{ch:#1}\xspace}
+\newcommand{\sees}[1]{section \ref{se:#1}, page \pageref{se:#1}\xspace}
 %
 % Nice environments
 %
@@ -171,5 +171,16 @@
 %
 % Some versions 
 %
-\newcommand{\fpcversion}{0.99.8}
+\newcommand{\fpcversion}{0.99.12}
+%
+% PDF support
+%
+\newif\ifpdf
+\ifx\pdfoutput\undefined
+   \pdffalse
+\else
+   \pdfoutput=1
+   \pdftrue
+\fi
+%
 % end of fpc.sty

+ 12 - 1
docs/fpcman.sty

@@ -161,5 +161,16 @@
 \newcommand{\win}{\textsc{Win32}\xspace}
 \newcommand{\freebsd}{\textsc{FreeBSD}\xspace}
 %
-\newcommand{\fpcversion}{0.99.8}
+\newcommand{\fpcversion}{0.99.12}
+%
+% PDF support
+%
+\newif\ifpdf
+\ifx\pdfoutput\undefined
+   \pdffalse
+\else
+   \pdfoutput=1
+   \pdftrue
+\fi
+%
 % end of fpcman.sty

+ 12 - 0
docs/go32.tex

@@ -1527,6 +1527,18 @@ None.
 \seefl{transfer\_buffer}{transferbuffer}, \seep{copyfromdos}
 \seep{copytodos}
 \end{functionl}
+
+\begin{functionl}{transfer\_buffer}{transferbuffer}
+\Declaration
+Function transfer\_buffer : Longint;
+\Description
+\var{transfer\_buffer} returns the offset of the transfer buffer.
+\Errors
+None.
+\SeeAlso
+\seefl{tb\_size}{tbsize}
+\end{functionl}
+
 \begin{functionl}{unlock\_code}{unlockcode}
 \Declaration
 Function unlock\_code (functionaddr : pointer; size : Longint) : boolean;

+ 2 - 1
docs/onechap.tex

@@ -47,5 +47,6 @@
 %\input{printer.tex}
 %\input{sockets.tex}
 %\input{strings.tex}
-\input{sysutils.tex}
+%\input{sysutils.tex}
+\input{makefile.tex}
 \end{document}

+ 413 - 1
docs/prog.tex

@@ -31,12 +31,26 @@
 \newcommand{\remark}[1]{\par$\rightarrow$\textbf{#1}\par}
 \newcommand{\olabel}[1]{\label{option:#1}}
 % We should change this to something better. See \seef etc.
-\begin{document}
 \title{Free Pascal \\ Programmers' manual}
 \docdescription{Programmers' manual for \fpc, version \fpcversion}
 \docversion{1.5}
 \input{date.inc}
 \author{Micha\"el Van Canneyt}
+\latex{%
+\ifpdf
+\usepackage[pdftex,bookmarks=true]{hyperref}
+\pdfcompresslevel=9
+\pdfpagewidth=210mm
+\pdfpageheight=297mm
+\pdfinfo{/Author(Michael Van Canneyt)
+/Title(Programmers' Guide)
+/Subject(Free Pascal Programmers' guide)
+/Keywords(Free Pascal)
+}
+\fi
+}
+\makeindex
+\begin{document}
 \maketitle
 \tableofcontents
 \newpage
@@ -3694,4 +3708,402 @@ consequences of this is that the type \var{Integer} is redefined as
 \item PChars are converted to strings automatically.
 \end{enumerate}
 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Appendix E
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\chapter{Using \file{makefile.fpc}}
+\label{ch:makefile}
+\newcommand{\mvar}[1]{\var{\$(#1)}}
+
+\section{Introduction}
+\fpc comes with a special makefile, \file{kefile.fpc}, which can be incuded
+in any makefile you use to compile with \fpc. There is a template
+\file{Makefile} provided also. All sources from the \fpc team are copiled
+with this system.
+
+These files are installed in the following directories:
+\begin{description}
+\item[linux]
+\item[Dos or Windows]
+\end{description}
+
+The template \file{Makefile} searches for the \file{makefile.fpc} in  the
+following places :
+\begin{enumerate}
+\item The {\em file} pointed to by the \var{FPCMAKE} environment variable.
+\item The directory pointed to by the \var{FPCDIR} envinonment variable.
+\item The directory pointed to by the \var{DEFAULTFPCDIR} make variable.
+\item The current directory.
+\end{enumerate}
+Thus, setting \var{FPCMAKE} or \var{FPCDIR} as a environment string will
+ensure that \file{makefile.fpc} is always found, and will be read by all
+makefiles, derived from the template.
+
+The following sections explain what variables are set by \var{makefile.fpc},
+what variables it expects to be set, and what targets it defines. After
+that, some settings in the template makefile are explained.
+
+\section{Programs needed to use the makefile}
+
+The following programs are needed by the makefile to function correctly:
+\begin{description}
+\item[cp] a copy program
+\item[date] a program that prints the date.
+\item[install] a program to install files.
+\item[make] the \file{make} program, obviously.
+\item[pwd] a program that prints the current working directory.
+\item[rm] a program to delete files.
+\end{description}
+These are standard programs on linux system, with the possible exception of
+\file{make}. For \dos or \windowsnt, they can be found in the 
+\file{gnuutils.zip} of the \fpc FTP site.
+
+\section{Variables used by \file{makefile.fpc}}
+
+In principle, the \var{makefile.fpc} only expects one variable to be set:
+\begin{description}
+\item[FPCDIR] This is the base directory of \fpc sources. The makefile
+expects to find a directory \file{rtl} below this directory.
+\end{description}
+
+However, many variables can be set, and influence the behaviour of the
+makefile.
+
+The first set of variables controls the directories used in the makefile:
+
+\begin{description}
+\item[INC] this is a list of directories, separated by spaces, that will 
+be added as include directories to the compiler command-line.
+
+\item[LIBDIR] is a list of library paths, separated by spaces. They are 
+prepended with \var{-Fl} and added to the compiler options.
+
+\item[NEEDLIBDIR] is a space-separated list of library paths. They are 
+prepended with \var{-Fl} and added to the compiler options.
+
+\item[NEEDOBJDIR] is a list of directories, separated by spaces, that is 
+added to the object files path, i.e. prepended with \var{-Fo}.
+
+\item[NEEDUNITDIR] is a list of directories, separated by spaces, that are
+added to the unit path of the compiler, i.e. they get \var {-Fu} prepended.
+
+\item[OBJDIR] is a list of directories, separated by spaces, that is 
+added to the object files path, i.e. prepended with \var{-Fo}.
+
+\item[OSINC] this is a space-separated list of OS-dependent directories 
+that will be added as include directories to the compiler command line.
+
+\item[PROCINC] is a space-separated list of processor-dependent directories 
+that will be added as include directories to the compiler command-line.
+
+\item[RTLDIR] Directory where the \var{RTL} unit sources are.
+If \var{RTLDIR} is not set, it is set to \mvar{RTL}/\mvar{OS\_TARGET}. \\
+If \var{RTL} is also not set, it is set to \mvar{FPCDIR}\var{/rtl/}\mvar{OS\_TARGET}.
+
+\item[RTL] If \var{RTLDIR} is not set, \var{RTL} is used to construct
+\var{RTLDIR}. \var{RTLDIR} is added to the compiler unit path, with \var{-Fu}
+prepended.
+
+\item[TARGETDIR] If set, this directory is added as the output directory of
+the compiler, where all unis and executables are written, i.e. it gets
+\var{-FE} prepended.
+
+\item[UNIT] If \var{UNITDIR} is not set, \var{UNIT} is used to construct
+\var{UNITDIR}. \var{UNITDIR} is added to the compiler unit path, with \var{-Fu}
+prepended. 
+
+\item[UNITDIR] Directory where the \var{RTL} compiled units are.
+If \var{UNITDIR} is not set, it is set to \mvar{UNIT}/\mvar{OS\_TARGET}. \\
+If \var{UNIT} is also not set, it is set to \mvar{FPCDIR}\var{/rtl/}\mvar{OS\_TARGET}.
+
+\item[UNITS] The content of this variable are appended to the
+\var{BASEINSTALLDIR} variable to install the units.
+
+\item[UNITTARGETDIR] If set, this directory is added as the output directory of
+the compiler, where all units are written, i.e. it gets
+\var{-FU} prepended. This overrides \var{TARGETDIR}.
+\end{description}
+
+The second set of variables controls the targets that are constructed
+by the makefile:
+
+\begin{description}
+\item[DEFAULTUNITS] If defined, only units will be made by the makefile. If
+not defined, then executables are made also.
+\item[EXEOBJECTS] This is a list of executable names that will be compiled.
+the makefile appends \mvar{EXEEXT} to these names.
+\item[LOADEROBJECTS] is a list of space-separated names that identify
+loaders to be compiled. This is mainly used in the compiler's RTL sources.
+\item[UNITOBJECTS] This is a list of unit names that will be compiled. The
+makefile appends \mvar{PPUEXT} to each of these names to form the unit file
+name. The sourcename is formed by adding \mvar{PASEXT}.
+\item[ZIPNAME] is the name of the archive that will be created by the
+makefile.
+\item[ZIPTARGET] is the target that is built before the archive is made.
+this target is built first. If successful, the zip archive will be made.
+\end{description}
+
+The following variables control the compiler command-line:
+\begin{description}
+\item[CFGFILE] if this variable is set, it will be used as the name of the
+config file to be used by the compiler.
+
+\item[CPU] the CPU type is added as a define to the compiler command line.
+Automatically determined by the makefile.
+
+\item[LIBNAME] if smartlinking is requested (i.e. \var{SMARTLINK} is set to
+\var{YES}), this is the name of the static library to produce. Don't add
+\var{lib} to this, the compiler will do that.
+
+\item[LIBTYPE] if set to \var{shared}, then the compiler will emit a shared
+library, with name \var{LIBNAME}.If \var{LIBTYPE} is set to \var{static},
+the compiler will emit a atatic, smartlinked library, 
+
+\item[NEEDGCCLIB] if this variable is defined, then the path to \file{libgcc}
+is added to the library path.
+
+\item[NEEDOTHERLIB] (\linux only) If this is defined, then the makefile will 
+append all directories that appear in \var{/etc/ld.so.conf} to the library path.
+
+
+\item[OPT] Any options that you want to the compiler command-line.
+
+\item[OPTDEF] Are optional defines, added to the command-line of the
+compiler. They do not get \var{-d} prepended.
+
+\item[OS\_TARGET] What platform you want to compile for. Added to the
+compiler command-line with a \var{-T} prepended.
+
+\item[SMARTLINK] if \var{SMARTLINK} is set to \var{YES} then the compiler
+will output smartlinked units if \var{LIBTYPE} is not set to \var{shared}.
+
+\end{description}
+
+\section{Variables set by \file{makefile.fpc}}
+
+All of the following variables are only set by \var{makefile.fpc}, if
+they aren't already defined. This means that you can ovverride them by
+setting them on the make command line, or setting them in the makefile you
+use, BEFORE \file{makefile.fpc} is included.
+
+The following directories are defined by the makefile:
+
+\begin{description}
+\item[BASEDIR] is set to the current directory if the \file{pwd} command is
+available. If not, it is set to '.'.
+
+\item[BASEINSTALLDIR] is the base for all directories where units are
+installed. On \linux, this is set to\\
+\mvar{PREFIXINSTALLDIR}\var{/lib/fpc/}\mvar{RELEASEVER}. On other systems,
+it is set to \mvar{PREFIXINSTALLDIR}
+
+\item[BININSTALLDIR] is set to \mvar{BASEINSTALLDIR}/\var{bin} on \linux,
+and\\
+\mvar{BASEINSTALLDIR}/\var{bin}/\mvar{OS\_TARGET} on other systems. This is
+the place where binaries are installed.
+
+\item[GCCLIBDIR] (\linux only) is set to the directory where \file{libgcc.a}
+is.
+
+\item[LIBINSTALLDIR] is set to \mvar{BASEINSTALLDIR} on \linux, and
+\mvar{BASEINSTALLDIR}/\var{lib} on other systems.
+
+\item[OTHERLIBDIR] (\linux only) is set to the full set of paths in \file{/etc/ld.so.conf}
+
+\item[PREFIXINSTALLDIR] is set to \file{/usr} on \linux, \file{/pp} on \dos
+or \windowsnt.
+
+\item[SHARED\_LIBINSTALLDIR] is where shared libraries are 
+installed. This equals \mvar{PREFIXINSTALLDIR}/\var{lib} on \linux, and
+\var{SHARED\_UNITINSTALLDIR} on other systems.
+
+\item[SHARED\_UNITINSTALLDIR] is where units from libraries are 
+installed. This equals \mvar{UNITINSTALLDIR}/\var{shared}
+
+\item[STATIC\_LIBINSTALLDIR] is where static libraries will be
+installed. By default, it equals \mvar{STATIC\_UNITINSTALLDIR}.
+
+\item[STATIC\_UNITINSTALLDIR] is where static, smartlinked units will be
+installed. It equals \mvar{UNITINSTALLDIR}/\var{static}.
+
+\item[UNITINSTALLDIR] is where units will be installed. This is set to\\
+\mvar{BASEINSTALLDIR}/\mvar{UNITPREFIX} \\
+on \linux. \\On other systems, it is
+set to \\\mvar{BASEINSTALLDIR}/\mvar{UNITPREFIX}/\mvar{OS\_TARGET}.
+\end{description}
+
+The following variables are program names, used in makefile targets.
+\begin{description}
+\item[AS] The assembler. Default set to \file{as}.
+\item[COPY] a file copy program. Default set to \file{cp -fp}.
+\item[CMP] a program to compare files. Default set to \var{cmp}.
+\item[DEL] a file removal program. Default set to \file{rm -f}.
+\item[DELTREE] a directory removal program. Default set to \file{rm -rf}.
+\item[DATE] a program to display the date.
+\item[DIFF] a program to produce diff files.
+\item[ECHO] an echo program.
+\item[INSTALL] a program to install files. Default set to \file{install -m
+644} on linux.
+\item[INSTALLEXE] a program to install executable files. Default set to \file{install -m
+755} on linux.
+\item[LD] The linker. Default set to \file{ld}.
+\item[LDCONFIG] (\linux only) the program used to update the loader cache.
+\item[MKDIR] a program to create directories if the don't exist yet. Default
+set to \file{install -m 755 -d}
+\item[MOVE] a file move program. Default set to \file{mv -f}
+\item[PP] the Free Pascal compiler
+\item[PPAS] the name of the shell script created by the compiler if the
+\var{-s} option is specified. This command will be executed after
+compilation, if the \var{-s} option was detected among the options.
+\item[PPUMOVE] the program to move units into one big unit library.
+\item[SED] a stream-line editor program. Default set to \file{sed}.
+\item[UPX] an executable packer to compress your executables into
+self-extracting compressed executables.
+\item[ZIPEXE] a zip program to compress files. zip targets are made with
+this program
+\end{description}
+
+The following variables denote extensions of files. These variables include
+the \var{.} (dot) of the extension. They are appended to object names.
+
+\begin{description}
+\item[ASMEXT] is the extension of assembler files produced by the compiler.
+\item[LOADEREXT] is the extension of the assembler files that make up the
+executable startup code.
+\item[OEXT] is the extension of the  object files that the compiler creates.
+\item[PACKAGESUFFIX] is a suffix that is appended to package names in zip
+targets. This serves so packages can be made for different OSes.
+\item[PASEXT] is the extension of pascal files used in the compile rules.
+it is determined by looking at the first \var{EXEOBJECTS} source file or 
+the first \var{UNITOBJECTS} files.
+\item[PPLEXT] is the extension of shared-library unit files.
+\item[PPUEXT] is the extension of default units.
+\item[SHAREDLIBEXT] is the extension of shared libraries.
+\item[SMARTEXT] is the extension of smartlinked unit assembler files.
+\item[STATICLIBEXT] is the extension of static libraries.
+\end{description}
+
+The following variables are defined to make targets and rules easier:
+
+\begin{description}
+\item[COMPILER] is the compltere compiler commandline, with all options
+added, after all Makefile variables have been examined.
+\item[DATESTR] contains the date.
+\item[EXEFILES] is a list of executables that will be created by the
+makefile.
+\item[EXEOFILES] is a list of executable object files that will be created
+by the makefile.
+\item[LOADEROFILES] is a list of object files that will be made from the
+loader assembler files. This is mainly for use in the compiler's RTL sources.
+\item[UNITFILES] a list of unit files that will be made. This is just 
+the list of unit objects, with the correct unit extension appended.
+\item[UNITOFILES] a list of unit object files that will be made. 
+This is just the list of unit objects, with the correct object file
+extension appended.
+\end{description}
+
+\section{Rules and targets created by \file{makefile.fpc}}
+
+The \var{makefile.fpc} defines a series of targets, which can be called by
+your own targets. They have names that resemble default names (such as
+'all', 'clean', only they have \var{fpc\_} prepended.
+
+The makefile makes the following pattern rules:
+\begin{description}
+\item[units] How to make a pascal unit form a pascal source file.
+\item[executables] how to make an executable from a pascal source file.
+\item[object file] how to make an object file from an assembler file.
+\end{description}
+
+The following build targets are defined:
+\begin{description}
+\item[fpc\_all] Target that builds all units and executables as well as
+loaders. If \var{DEFAULTUNITS} is defined, executables are excluded from the
+targets.
+\item[fpc\_exes] Target to make all executables in \var{EXEOBJECTS}.
+\item[fpc\_loaders] Target to make all files in \var{LOADEROBJECTS}.
+\item[fpc\_sharedlib] Target that makes all units as dynamic libraries.
+\item[fpc\_staticlib] Target that makes all units as smartlinked units.
+\item[fpc\_units] Target to make all units in \var{UNITOBJECTS}.
+\end{description}
+
+The following cleaning targets are defined:
+\begin{description}
+\item[fpc\_clean] cleans all files that result when \var{fpc\_all} was made.
+\item[fpc\_libsclean] is the same as \var{fpc\_clean}, but removes any
+shared or dynamic libraries that may have been built.
+\item[fpc\_cleanall] is the same as both previous target commands.
+\end{description}
+
+The following archiving targets are defined:
+\begin{description}
+\item[fpc\_zipinstalladd] will add to a (possibibly existing) archive file (it's
+name is taken from \mvar{ZIPNAME}. 
+\item[fpc\_zipinstall] is the same, only the archive is cleared first.
+\end{description}
+The zip is made uzing the \var{ZIPEXE} program. Under \linux, a
+\file{.tar.gz} file is created.
+
+The following targets produce information about the makefile:
+\begin{description}
+\item[fpc\_cfginfo] Gives generl configuration information: the location of
+the makefile, the compiler version, target OS, CPU.
+\item[fpc\_dirinfo] Gives the directories, used by the compiler.
+\item[fpc\_info] Executes all other info targets.
+\item[fpc\_installinfo] Gives all directories where files will be installed.
+\item[fpc\_objectinfo] lists all objects that will be made.
+\item[fpc\_toolsinfo] lists all defined tools.
+\end{description}
+
+\section{Using the provided template}
+The template makefile that comes with \fpc does nothing other than 
+offering you some variables to be set for the \file{makefile.fpc}. 
+After that it loads the \var{makefile.fpc} in the indixated places.
+
+Finally it declares a set of default targets:
+\begin{description}
+\item[all]  calls fpc\_all.
+\item[clean]  calls fpc\_clean.
+\item[install]  calls fpc\_install.
+\item[info]  calls fpc\_info.
+\item[staticlib]  calls fpc\_staticlib.
+\item[sharedlib]  calls fpc\_sharedlib.
+\item[libsclean]  calls fpc\_libsclean.
+\item[staticinstall]  calls fpc\_staticinstall.
+\item[sharedinstall]  calls fpc\_sharedinstall.
+\item[libinstall]  calls fpc\_libinstall.
+\end{description}
+
+You can override each of these targets to suit your setup.
+
+If you just have to compile some units and programs, you only need to set
+the following variables:
+\begin{description}
+\item[UNITOBJECTS] names of units you wish to be built.
+\item[EXEOBJECTS] names of executables you wish to be built.
+\end{description}
+
+You may want to set some of the following variables:
+\begin{description}
+\item[INC,PROCINC or OSINC] To indicate where include files can be found.
+\item[NEEDOPT] additional optionas added to the compile command.
+\item[NEEDUNITDIR] space-separated list of directories where units that you
+need are located.
+\item[TARGETDIR,UNITTARGETDIR] where do you want executables and units to 
+be written. Be aware that setting this variable may interfere with 
+\var{make}, since it will not find the target files.
+\item[DEFAULTUNITS] if you define this variable (to whatever value you want)
+then the \var{all} target will by default only make the units.
+\end{description}
+
+You may also set any of the variables that appear in the previous sections, 
+to override default behaviour of the makefile.
+
+After having set these variables, you can run 'make info' to see whether all
+variables are set to you satisfaction. If the \file{makefile.fpc} is not
+found, this command will inform you of this.
+
+After that, a simple 'make all' will make all units and executables.
+
 \end{document}

+ 13 - 0
docs/ref.tex

@@ -39,6 +39,19 @@
 \usepackage{fancyheadings}
 \pagestyle{fancy}
 \renewcommand{\chaptermark}[1]{\markboth{#1}{}}
+\latex{%
+\ifpdf
+\usepackage[pdftex,bookmarks=true]{hyperref}
+\pdfcompresslevel=9
+\pdfpagewidth=210mm
+\pdfpageheight=297mm
+\pdfinfo{/Author(Michael Van Canneyt)
+/Title(Standard units Reference Guide)
+/Subject(Free Pascal Reference guide)
+/Keywords(Free Pascal, Language, System Unit)
+}
+\fi
+}
 \makeindex
 %
 % start of document.

+ 15 - 8
docs/sockets.tex

@@ -548,24 +548,31 @@ The system file table is full.
 \SeeAlso
 \seef{SocketPair}, \seem{socket}{2}
 \end{function}
+
 for an example, see \seef{Accept}.
+
 \begin{function}{SocketPair}
 \Declaration
 Function SocketPair (Domain,SocketType,Protocol:Longint;var Pair:TSockArray) : Longint;
-
 \Description
 \var{SocketPair} creates 2 sockets in domain \var{Domain}, from type
 \var{SocketType} and using protocol \var{Protocol}.
 The pair is returned in \var{Pair}, and they are indistinguishable.
 The function returns -1 upon error and 0 upon success.
-
 \Errors
 Errors are reported in \var{SocketError}, and are the same as in \seef{Socket}
 \SeeAlso
-Str2UnixSockAddr{(const addr:string;var t:TUnixSockAddr;var len:longint)}
+\seep{Str2UnixSockAddr}
 \end{function}
-{\var{Str2UnixSockAddr} transforms a Unix socket address in a string to a
-\var{TUnixSockAddr} sturcture which can be passed to the \seef{Bind} call.
-}
-{None.}
-{\seef{Socket}, \seef{Bind}}
+
+\begin{procedure}{Str2UnixSockAddr}
+\Declaration
+Procedure Str2UnixSockAddr(const addr:string;var t:TUnixSockAddr;var len:longint)
+\Description
+\var{Str2UnixSockAddr} transforms a Unix socket address in a string to a
+\var{TUnixSockAddr} structure which can be passed to the \seef{Bind} call.
+\Errors
+None.
+\SeeAlso
+\seef{Socket}, \seef{Bind}
+\end{procedure}

+ 6 - 10
docs/strings.tex

@@ -25,24 +25,20 @@ Since the unit only provides some procedures and functions, there is
 only one section, which gives the declarations of these functions, together
 with an explanation. 
 \section{Functions and procedures.}
-\begin{procedure}{StrAlloc}
+\begin{function}{StrAlloc}
 \Declaration
-Procedure StrAlloc (Len : Longint);
-
+Function StrAlloc (Len : Longint);PChar
 \Description
-PChar
-\Errors
-
 \var{StrAlloc} reserves memory on the heap for a string with length \var{Len},
 terminating \var{\#0} included, and returns a pointer to it.
-
+\Errors
+If there is not enough memory, a run-time error occurs.
 \SeeAlso
-StrPCopy.
-\end{procedure}
+\seef{StrNew}, \seef{StrPCopy}.
+\end{function}
 \begin{function}{StrCat}
 \Declaration
 Function StrCat (Dest,Source : PChar) : PChar;
-
 \Description
 
 Attaches \var{Source} to \var{Dest} and returns \var{Dest}.

+ 281 - 208
docs/sysutils.tex

@@ -55,7 +55,7 @@ type
    end ;
 \end{verbatim}
 The following type is used in the \seef{FindFirst},\seef{FindNext} 
-and \seep{FindClose} functions. The \var{win32} version differs from 
+and \seepl{FindClose}{FindCloseSys} functions. The \var{win32} version differs from 
 the other versions. If code is to be portable, that part  shouldn't 
 be used.
 \begin{verbatim}
@@ -90,6 +90,14 @@ Const
   fmOpenWrite      = $0001;
   fmOpenReadWrite  = $0002;
 \end{verbatim}
+The following constants can be used in the \seef{FileSeek} call.
+\begin{verbatim}
+Const
+  fsFromBeginning = 0;
+  fsFromCurrent   = 1;
+  fsFromEnd       = 2;
+
+\end{verbatim}
 The following variables are used in the case translation routines.
 \begin{verbatim}
 type
@@ -704,7 +712,7 @@ None.
 \Declaration
 Function AddDisk (Const PAth : String) : Longint;
 \Description
-On Linux  both the \seef{Diskfree} and \seef{Disksize} functions need a 
+On Linux  both the \seef{DiskFree} and \seef{DiskSize} functions need a 
 file on the specified drive, since is required for the statfs system call.
 
 These filenames are set in drivestr[0..26], and the first 4 have been 
@@ -723,7 +731,7 @@ add more than 21 drives, the count is wrapped to 4.
 \Errors
 None. 
 \SeeAlso
-\seef{DiskFree}, \seef{DiskSize}
+\seefl{DiskFree}{DiskFreeSys}, \seefl{DiskSize}{DiskSizeSys}
 \end{functionl}
 
 \begin{function}{CreateDir}
@@ -745,7 +753,7 @@ In case of an error, the function returns \var{False}.
 \latex{\inputlisting{sysutex/ex26.pp}}
 \html{\input{sysutex/ex26.tex}}
  
-\begin{function}{DiskFree}
+\begin{functionl}{DiskFree}{DiskFreeSys}
 \Declaration
 Function DiskFree(Drive : Byte) : Longint;
 \Description
@@ -767,13 +775,13 @@ For more information, see \seef{AddDisk}
 \Errors
 On error, \var{-1} is returned.
 \SeeAlso
-\seef{DiskSize}, \seef{AddDisk}
-\end{function}
+\seefl{DiskSize}{DiskSizeSys}, \seef{AddDisk}
+\end{functionl}
 
 \latex{\inputlisting{sysutex/ex27.pp}}
 \html{\input{sysutex/ex27.tex}}
  
-\begin{function}{DiskSize}
+\begin{functionl}{DiskSize}{DiskSizeSys}
 \Declaration
 Function DiskSize(Drive : Byte) : Longint;
 \Description
@@ -795,10 +803,10 @@ For more information, see \seef{AddDisk}
 \Errors
 On error, \var{-1} is returned.
 \SeeAlso
-\seef{DiskFree}, \seef{AddDisk}
-\end{function}
+\seefl{DiskFree}{DiskFreeSys}, \seef{AddDisk}
+\end{functionl}
 
-For an example, see \seef{DiskFree}.
+For an example, see \seefl{DiskFree}{DiskFreeSys}.
  
 \begin{function}{GetCurrentDir}
 \Declaration
@@ -876,7 +884,7 @@ otherwise.
 \Errors
 On error, \var{False} is returned.
 \SeeAlso
-\seef{CreateFile}, \seef{FileExists}
+\seef{FileCreate}, \seef{FileExists}
 \end{function}
 
 \latex{\inputlisting{sysutex/ex31.pp}}
@@ -1062,7 +1070,8 @@ None.
 \seef{FileTruncate}, \seef{FileSeek}
 \end{procedure}
 
- 
+For an example, see \seef{FileCreate}
+
 \begin{function}{FileCreate}
 \Declaration
 Function FileCreate(Const FileName : String) : Longint;
@@ -1077,11 +1086,13 @@ overwritten.
 If an error occurs (e.g. disk full or non-existent path), the function
 returns \var{-1}.
 \SeeAlso
-\seef{FileClose}, \seef{FileWrite}, \seef{FileOpen}, \seef{FileRead},
+\seep{FileClose}, \seef{FileWrite}, \seef{FileOpen}, \seef{FileRead},
 \seef{FileTruncate}, \seef{FileSeek}
 \end{function}
 
- 
+\latex{\inputlisting{sysutex/ex37.pp}}
+\html{\input{sysutex/ex37.tex}}
+
 \begin{function}{FileExists}
 \Declaration
 Function FileExists(Const FileName : String) : Boolean;
@@ -1094,6 +1105,10 @@ None.
 \seef{FileAge}, \seef{FileGetAttr}, \seef{FileSetAttr}
 \end{function}
 
+
+\latex{\inputlisting{sysutex/ex38.pp}}
+\html{\input{sysutex/ex38.tex}}
+
  
 \begin{function}{FileGetAttr}
 \Declaration
@@ -1118,370 +1133,428 @@ In case of error, -1 is returned.
 \seef{FileSetAttr}, \seef{FileAge}, \seef{FileGetDate}.
 \end{function}
 
+\latex{\inputlisting{sysutex/ex40.pp}}
+\html{\input{sysutex/ex40.tex}}
+
 \begin{function}{FileGetDate}
 \Declaration
 Function FileGetDate(Handle : Longint) : Longint;
 \Description
+\var{FileGetdate} returns the filetime of the opened file with filehandle
+\var{Handle}. It is the same as \seef{FileAge}, with this difference that
+\var{FileAge} only needs the file name, while \var{FilegetDate} needs an
+open file handle.
 \Errors
+On error, -1 is returned.
 \SeeAlso
+\seef{FileAge}
 \end{function}
 
+\latex{\inputlisting{sysutex/ex39.pp}}
+\html{\input{sysutex/ex39.tex}}
  
 \begin{function}{FileOpen}
 \Declaration
 Function FileOpen(Const FileName : string; Mode : Integer) : Longint;
 \Description
+\var{FileOpen} opens a file with name \var{FileName} with mode \var{Mode}.
+\var{Mode} can be one of the following constants:
+\begin{description}
+\item[fmOpenRead] The file is opened for reading.
+\item[fmOpenWrite] The file is opened for writing.
+\item[fmOpenReadWrite] The file is opened for reading and writing.
+\end{description}
+If the file has been successfully opened, it can be read  from or written to
+(depending on the \var{Mode} parameter) with the \seef{FileRead} and
+\var{FileWrite} functions.
+
+Remark that you cannot open a file if it doesn't exist yet, i.e. it will not
+be created for you. If you want tp create a new file, or overwrite an old
+one, use the \seef{FileCreate} function.
 \Errors
+On Error, -1 is returned.
 \SeeAlso
-\seef{FileClose}, \seef{FileWrite}, \seef{FileCreate}, \seef{FileRead},
+\seep{FileClose}, \seef{FileWrite}, \seef{FileCreate}, \seef{FileRead},
 \seef{FileTruncate}, \seef{FileSeek}
 \end{function}
 
+For an example, see \seef{FileRead}
  
 \begin{function}{FileRead}
 \Declaration
 Function FileRead(Handle : Longint; Var Buffer; Count : longint) : Longint;
 \Description
+\var{FileRead} reads \var{Count} bytes from file-handle \var{Handle} and
+stores them into \var{Buffer}. Buffer must be at least \var{Count} bytes
+long. No checking on this is performed, so be careful not to overwrite any
+memory.  \var{Handle} must be the result of a \seef{FileOpen} call.
 \Errors
+On error, -1 is returned.
 \SeeAlso
-\seef{FileClose}, \seef{FileWrite}, \seef{FileCreate}, \seef{FileOpen},
+\seep{FileClose}, \seef{FileWrite}, \seef{FileCreate}, \seef{FileOpen},
 \seef{FileTruncate}, \seef{FileSeek}
 \end{function}
 
- 
+For an example, see \seef{FileOpen}
+
 \begin{function}{FileSearch}
 \Declaration
 Function FileSearch(Const Name, DirList : String) : String;
 \Description
+\var{FileSearch} looks for the file \var{Name} in \var{DirList}, where
+dirlist is a list of directories, separated by semicolons or colons.
+It returns the full filename of the first match found.
 \Errors
+On error, an empty string is returned.
 \SeeAlso
+\seef{ExpandFileName}, \seef{FindFirst}
 \end{function}
 
- 
+\latex{\inputlisting{sysutex/ex41.pp}}
+\html{\input{sysutex/ex41.tex}}
+
 \begin{function}{FileSeek}
 \Declaration
 Function FileSeek(Handle,Offset,Origin : Longint) : Longint;
 \Description
+\var{FileSeek} sets the file pointer on position \var{Offset}, starting from 
+\var{Origin}. Origin can be one of the following values: 
+\begin{description}
+\item[fsFromBeginning]  \var{Offset} is relative to the first byte of the file. This
+position is zero-based. i.e. the first byte is at offset 0.
+\item[fsFromCurrent]  \var{Offset} is relative to the current position.
+\item[fsFromEnd] \var{Offset} is relative to the end of the file. This means
+that \var{Offset} can only be zero or negative in this case.
+\end{description}
+If successfull, the function returns the new file position, relative to the
+beginning of the file.
+
+{\em Remark:} The abovementioned constants do not exist in Delphi.
 \Errors
+On error, -1 is returned.
 \SeeAlso
-\seef{FileClose}, \seef{FileWrite}, \seef{FileCreate}, \seef{FileOpen}
+\seep{FileClose}, \seef{FileWrite}, \seef{FileCreate}, \seef{FileOpen}
 \seef{FileRead}, \seef{FileTruncate}
 \end{function}
 
+\latex{\inputlisting{sysutex/ex42.pp}}
+\html{\input{sysutex/ex42.tex}}
+
+For an example, see \seef{FileCreate}
  
-\begin{function}{FileSetAttr}
+\begin{functionl}{FileSetAttr (Not on Linux)}{FileSetAttr}
 \Declaration
 Function FileSetAttr(Const Filename : String; Attr: longint) : Longint;
 \Description
+\var{FileSetAttr} sets the attributes of \var{FileName} to \var{Attr}.
+If the function was successful, 0 is returned, -1 otherwise.
+
+\var{Attr} can be set to an OR-ed combination of the pre-defined 
+\var{faXXX} constants.
 \Errors
+On error, -1 is returned (always on linux). 
 \SeeAlso
-\end{function}
+\seef{FileGetAttr}, \seef{FileGetDate}, \seef{FileSetDate}.
+\end{functionl}
 
  
-\begin{function}{FileSetDate}
+\begin{functionl}{FileSetDate (Not on Linux)}{FileSetDate}
 \Declaration
 Function FileSetDate(Handle,Age : Longint) : Longint;
 \Description
+\var{FileSetDate} sets the file date of the file with handle \var{Handle} 
+to \var{Age}, where \var{Age} is a DOS date-and-time stamp value.
+
+The function returns zero of successfull.
 \Errors
+On Linux, -1 is always returned, since this is impossible to implement.
+On Windows and DOS, a negative error code is returned.
 \SeeAlso
-\end{function}
+\end{functionl}
 
  
 \begin{function}{FileTruncate}
 \Declaration
 Function FileTruncate(Handle,Size: Longint) : boolean;
 \Description
+\var{FileTruncate} truncates the file with handle \var{Handle} to
+\var{Size} bytes. The file must have been opened for writing prior
+to this call. The function returns \var{True} is successful, \var{False}
+otherwise.
 \Errors
+On error, the function returns \var{False}.
 \SeeAlso
-\seef{FileClose}, \seef{FileWrite}, \seef{FileCreate}, \seef{FileOpen}
+\seep{FileClose}, \seef{FileWrite}, \seef{FileCreate}, \seef{FileOpen}
 \seef{FileRead}, \seef{FileSeek}
 \end{function}
 
+For an example, see \seef{FileCreate}.
  
 \begin{function}{FileWrite}
 \Declaration
 Function FileWrite(Handle : Longint; Var Buffer; Count : Longint) : Longint;
 \Description
+\var{FileWrite} writes \var{Count} bytes from \var{Buffer} to the file with
+handle \var{Handle}. Prior to this call, the file must have been opened 
+for writing. \var{Buffer} must be at least \var{Count} bytes large, or 
+a memory access error may occur.
+
+The function returns the number of bytes written, or -1 in case of an
+error.
 \Errors
+In case of error, -1 is returned.
 \SeeAlso
-\seef{FileClose}, \seef{FileCreate}, \seef{FileOpen}
+\seep{FileClose}, \seef{FileCreate}, \seef{FileOpen}
 \seef{FileRead}, \seef{FileTruncate}, \seef{FileSeek}
 \end{function}
 
- 
-\begin{procedure}{FindClose}
+For an example, see \seef{FileCreate}. 
+
+\begin{procedurel}{FindClose}{FindCloseSys}
 \Declaration
 Procedure FindClose(Var F : TSearchrec);
 \Description
+\var{FindClose} ends a series of \seef{FindFirst}/\seef{FindNext} calls,
+and frees any memory used by these calls. It is {\em absolutely} necessary
+to do this call, or huge memory losses may occur.
 \Errors
+None.
 \SeeAlso
-\end{procedure}
+\seef{FindFirst}, \seef{FindNext}.
+\end{procedurel}
 
+For an example, see \seef{FindFirst}.
  
 \begin{function}{FindFirst}
 \Declaration
 Function FindFirst(Const Path : String; Attr : Longint; Var Rslt : TSearchRec) : Longint;
 \Description
+\var{FindFirst} looks for files that match the name (possibly with
+wildcards) in \var{Path} and attributes \var{Attr}. It then fills up the
+\var{Rslt} record with data gathered about the file. It returns 0 if a file
+matching the specified criteria is found, a nonzero value (-1 on linux) 
+otherwise.
+
+The \var{Rslt} record can be fed to subsequent calls to \var{FindNext}, in
+order to find other files matching the specifications.
+
+{\em remark:} A \var{FindFirst} call must {\em always} be followed by a
+\seepl{FindClose}{FindCloseSys} call with the same \var{Rslt} record. Failure to do so will
+result in memory loss.
 \Errors
+On error the function returns -1 on linux, a nonzero error code on Windows.
 \SeeAlso
+\seep{FindClose}{FindCloseSys}, \seef{FindNext}.
 \end{function}
 
- 
+\latex{\inputlisting{sysutex/ex43.pp}}
+\html{\input{sysutex/ex43.tex}}
+
 \begin{function}{FindNext}
 \Declaration
 Function FindNext(Var Rslt : TSearchRec) : Longint;
 \Description
+\var{FindNext} finds a next occurrence of a search sequence initiated by
+\var{FindFirst}. If another record matching the criteria in Rslt is found, 0
+is returned, a nonzero constant is returned otherwise.
+
+{\em remark:} The last \var{FindNext} call must {\em always} be followed by a
+\var{FindClose} call with the same \var{Rslt} record. Failure to do so will
+result in memory loss.
 \Errors
+On error (no more file is found), a nonzero constant is returned.
 \SeeAlso
+\seef{FindFirst}, \seep{FindClose}
 \end{function}
 
+For an example, see \seef{FindFirst}
  
 \begin{function}{GetDirs}
 \Declaration
 Function GetDirs(Var DirName : String; Var Dirs : Array of pchar) : Longint; 
 \Description
+\var{GetDirs} splits DirName in a null-byte separated list of directory names,
+\var{Dirs} is an array of \var{PChars}, pointing to these directory names.
+The function returns the number of directories found, or -1 if none were found.
+DirName must contain only OSDirSeparator as Directory separator chars.
 \Errors
+None.
 \SeeAlso
+\seef{ExtractRelativePath}
 \end{function}
 
+\latex{\inputlisting{sysutex/ex45.pp}}
+\html{\input{sysutex/ex45.tex}}
  
 \begin{function}{RenameFile}
 \Declaration
 Function RenameFile(Const OldName, NewName : String) : Boolean;
 \Description
+\var{RenameFile} renames a file from \var{OldName} to \var{NewName}. The
+function returns \var{True} if successful, \var{False} otherwise.
+
+{\em Remark:} you cannot rename across disks or partitions. 
 \Errors
+On Error, \var{False} is returned.
 \SeeAlso
+\seef{DeleteFile}
 \end{function}
 
- 
+\latex{\inputlisting{sysutex/ex44.pp}}
+\html{\input{sysutex/ex44.tex}}
+
 \begin{function}{SetDirSeparators}
 \Declaration
 Function SetDirSeparators(Const FileName : String) : String;
 \Description
+\var{SetDirSeparators} returns \var{FileName} with all possible
+DirSeparators replaced by \var{OSDirSeparator}.
 \Errors
+None.
 \SeeAlso
+\seef{ExpandFileName}, \seef{ExtractFilePath}, \seef{ExtractFileDir}
 \end{function}
 
- 
+\latex{\inputlisting{sysutex/ex47.pp}}
+\html{\input{sysutex/ex47.tex}}
 
 \section{PChar functions}
 
-\begin{function}{StrAlloc}
+\subsection{Introduction}
+
+Most PChar functions are the same as their counterparts in the \file{STRINGS}
+unit. The following functions are the same :
+
+\begin{enumerate}
+\item \seef{StrCat} : Concatenates two \var{PChar} strings.
+\item \seef{StrComp} : Compares two \var{PChar} strings.
+\item \seef{StrCopy} : Copies a \var{PChar} string.
+\item \seef{StrECopy} : Copies a \var{PChar} string and returns a pointer to
+the terminating null byte.
+\item \seef{StrEnd} : Returns a pointer to the terminating null byte.
+\item \seef{StrIComp} : Case insensitive compare of 2 \var{PChar} strings.
+\item \seef{StrLCat} : Appends at most L characters from one \var{PChar} to
+another \var{PChar}.
+\item \seef{StrLComp} : Case sensitive compare of at most L characters of 2
+ \var{PChar} strings.
+\item \seef{StrLCopy} : Copies at most L characters from one \var{PChar} to
+another.
+\item \seef{StrLen} : Returns the length (exclusive terminating null byte)
+of a \var{PChar} string.
+\item \seef{StrLIComp} : Case insensitive compare of at most L characters of 2
+ \var{PChar} strings.  
+\item \seef{StrLower} : Converts a \var{PChar} to all lowercase letters.
+\item \seef{StrMove} : Moves one \var{PChar} to another.
+\item \seef{StrNew} : Makes a copy of a \var{PChar} on the heap, and returns
+a pointer to this copy.
+\item \seef{StrPos} : Returns the position of one \var{PChar} string in
+another?
+\item \seef{StrRScan} : returns a pointer to the last occurrence of on 
+ \var{PChar} string in another one.
+\item \seef{StrScan} : returns a pointer to the first occurrence of on 
+ \var{PChar} string in another one.
+\item \seef{StrUpper} : Converts a \var{PChar} to all uppercase letters.
+\end{enumerate}
+The subsequent functions are different from their counterparts in
+\file{STRINGS}, although the same examples can be used.
+
+
+\begin{functionl}{StrAlloc}{StrAllocSys}
 \Declaration
 Function StrAlloc(Size: cardinal): PChar;
 \Description
+\var{StrAlloc} reserves memory on the heap for a string with length \var{Len},
+terminating \var{\#0} included, and returns a pointer to it.
+
+Additionally, \var{StrAlloc} allocates 4 extra bytes to store the size of
+the allocated memory. Therefore this function is NOT compatible with the 
+\seef{StrAlloc} function of the \var{Strings} unit.
 \Errors
+None.
 \SeeAlso
-\end{function}
+\seef{StrBufSize}, \seepl{StrDispose}{StrDisposeSys}, \seef{StrAlloc}
+\end{functionl}
 
+For an example, see \seef{StrBufSize}.
  
 \begin{function}{StrBufSize}
 \Declaration
 Function StrBufSize(var Str: PChar): cardinal;
 \Description
+\var{StrBufSize} returns the memory allocated for \var{Str}. This function
+ONLY gives the correct result if \var{Str} was allocated using
+\seefl{StrAlloc}{StrAllocSys}.
 \Errors
+If no more memory is available, a runtime error occurs.
 \SeeAlso
+\seefl{StrAlloc}{StrAllocSys}.\seepl{StrDispose}{StrDisposeSys}.
 \end{function}
 
+\latex{\inputlisting{sysutex/ex46.pp}}
+\html{\input{sysutex/ex46.tex}}
+
  
-\begin{procedure}{StrDispose}
+\begin{procedurel}{StrDispose}{StrDisposeSys}
 \Declaration
 Procedure StrDispose(var Str: PChar);
 \Description
+\var{StrDispose} frees any memory allocated for \var{Str}. This function
+will only function correctly if \var{Str} has been allocated using
+\seefl{StrAlloc}{StrAllocSys} from the \file{SYSUTILS} unit.
 \Errors
+If an invalid pointer is passed, or a pointer not allocated with
+\var{StrAlloc}, an error may occur.
 \SeeAlso
-\end{procedure}
+\seef{StrBufSize}, \seefl{StrAlloc}{StrAllocSys}, \seep{StrDispose}
+\end{procedurel}
 
+For an example, see \seef{StrBufSize}.
  
-\begin{function}{StrPCopy}
+\begin{functionl}{StrPCopy}{StrPCopySys}
 \Declaration
 Function StrPCopy(Dest: PChar; Source: string): PChar;
 \Description
+\var{StrPCopy} Converts the Ansistring in \var{Source} to a Null-terminated 
+string, and copies it to \var{Dest}. \var{Dest} needs enough room to contain
+the string \var{Source}, i.e. \var{Length(Source)+1} bytes.
 \Errors
+No checking is performed to see whether \var{Dest} points to enough memory
+to contain \var{Source}.
 \SeeAlso
-\end{function}
+\seefl{StrPLCopy}{StrPLCopySys}, \seef{StrPCopy}
+\end{functionl}
 
  
-\begin{function}{StrPLCopy}
+\begin{functionl}{StrPLCopy}{StrPLCopySys}
 \Declaration
 Function StrPLCopy(Dest: PChar; Source: string; MaxLen: cardinal): PChar;
 \Description
+\var{StrPLCopy} Converts maximally \var{MaxLen} characters of the 
+Ansistring in \var{Source} to a Null-terminated  string, and copies 
+it to \var{Dest}. \var{Dest} needs enough room to contain
+the  characters.
 \Errors
-\SeeAlso
-\end{function}
-
- 
-\begin{function}{StrPas}
-\Declaration
-Function StrPas(Str: PChar): string;
-\Description
-\Errors
-\SeeAlso
-\end{function}
-
- 
-\begin{function}{StrCat}
-\Declaration
-Function StrCat(dest,source : pchar) : pchar;
-\Description
-\Errors
-\SeeAlso
-\end{function}
-
- 
-\begin{function}{StrComp}
-\Declaration
-Function StrComp(str1,str2 : pchar) : longint;
-\Description
-\Errors
-\SeeAlso
-\end{function}
-
- 
-\begin{function}{StrCopy}
-\Declaration
-Function StrCopy(dest,source : pchar) : pchar;
-\Description
-\Errors
-\SeeAlso
-\end{function}
-
- 
-\begin{function}{StrECopy}
-\Declaration
-Function StrECopy(dest,source : pchar) : pchar;
-\Description
-\Errors
-\SeeAlso
-\end{function}
-
- 
-\begin{function}{StrEnd}
-\Declaration
-Function StrEnd(p : pchar) : pchar;
-\Description
-\Errors
-\SeeAlso
-\end{function}
-
- 
-\begin{function}{StrIComp}
-\Declaration
-Function StrIComp(str1,str2 : pchar) : longint;
-\Description
-\Errors
-\SeeAlso
-\end{function}
-
- 
-\begin{function}{StrLCat}
-\Declaration
-Function StrLCat(dest,source : pchar;l : longint) : pchar;
-\Description
-\Errors
-\SeeAlso
-\end{function}
-
- 
-\begin{function}{StrLComp}
-\Declaration
-Function StrLComp(str1,str2 : pchar;l : longint) : longint;
-\Description
+No checking is performed to see whether \var{Dest} points to enough memory
+to contain L characters of \var{Source}.
 \Errors
 \SeeAlso
-\end{function}
-
- 
-\begin{function}{StrLCopy}
-\Declaration
-Function StrLCopy(dest,source : pchar;maxlen : longint) : pchar;
-\Description
-\Errors
-\SeeAlso
-\end{function}
-
- 
-\begin{function}{StrLen}
-\Declaration
-Function StrLen(p : pchar) : longint;
-\Description
-\Errors
-\SeeAlso
-\end{function}
-
- 
-\begin{function}{StrLIComp}
-\Declaration
-Function StrLIComp(str1,str2 : pchar;l : longint) : longint;
-\Description
-\Errors
-\SeeAlso
-\end{function}
-
- 
-\begin{function}{StrLower}
-\Declaration
-Function strlower(p : pchar) : pchar;
-\Description
-\Errors
-\SeeAlso
-\end{function}
-
- 
-\begin{function}{StrMove}
-\Declaration
-Function StrMove(dest,source : pchar;l : longint) : pchar;
-\Description
-\Errors
-\SeeAlso
-\end{function}
-
- 
-\begin{function}{StrNew}
-\Declaration
-Function StrNew(p : pchar) : pchar;
-\Description
-\Errors
-\SeeAlso
-\end{function}
-
- 
-\begin{function}{StrPos}
-\Declaration
-Function StrPos(str1,str2 : pchar) : pchar;
-\Description
-\Errors
-\SeeAlso
-\end{function}
-
- 
-\begin{function}{StrRScan}
-\Declaration
-Function StrRScan(p : pchar;c : char) : pchar;
-\Description
-\Errors
-\SeeAlso
-\end{function}
-
- 
-\begin{function}{StrScan}
-\Declaration
-Function StrScan(p : pchar;c : char) : pchar;
-\Description
-\Errors
-\SeeAlso
-\end{function}
+\seefl{StrPCopy}{StrPCopySys}.
+\end{functionl}
 
  
-\begin{function}{StrUpper}
+\begin{functionl}{StrPas}{StrPasSys}
 \Declaration
-Function StrUpper(p : pchar) : pchar;
+Function StrPas(Str: PChar): string;
 \Description
+Converts a null terminated string in \var{Str} to an Ansitring, and returns
+this string. This string is NOT truncated at 255 characters as is the 
 \Errors
+None.
 \SeeAlso
-\end{function}
+\seef{StrPas}.
+\end{functionl}
 
-\section{String functions}
+\section{String handling functions}
 
 \begin{function}{AdjustLineBreaks}
 \Declaration
@@ -1672,13 +1745,13 @@ Function CompareText(const S1, S2: string): integer;
 \end{function}
 
  
-\begin{procedure}{DisposeStr}
+\begin{procedurel}{DisposeStr}{DisposeStrSys}
 \Declaration
 Procedure DisposeStr(S: PString);
 \Description
 \Errors
 \SeeAlso
-\end{procedure}
+\end{procedurel}
 
  
 \begin{function}{FloatToStr}
@@ -1780,13 +1853,13 @@ Function LowerCase(const s: string): string;
 \end{function}
 
  
-\begin{function}{NewStr}
+\begin{functionl}{NewStr}{NewStrSys}
 \Declaration
 Function NewStr(const S: string): PString;
 \Description
 \Errors
 \SeeAlso
-\end{function}
+\end{functionl}
 
  
 \begin{function}{QuotedStr}

+ 16 - 1
docs/units.tex

@@ -34,6 +34,19 @@
 \usepackage{fancyheadings}
 \pagestyle{fancy}
 \renewcommand{\chaptermark}[1]{\markboth{#1}{}}
+\latex{%
+\ifpdf
+\usepackage[pdftex,bookmarks=true]{hyperref}
+\pdfcompresslevel=9
+\pdfpagewidth=210mm
+\pdfpageheight=297mm
+\pdfinfo{/Author(Michael Van Canneyt)
+/Title(Standard units Reference Guide)
+/Subject(Free Pascal Standard units reference guide)
+/Keywords(Free Pascal, Units,RTL)
+}
+\fi
+}
 \makeindex
 %
 % start of document.
@@ -108,6 +121,8 @@ lookup.
 \input{sockets.tex}
 % the strings unit
 \input{strings.tex}
-
+% the sysutils unit
+\input{sysutils.tex}
+% end of units. Index.
 \printindex
 \end{document}

+ 20 - 3
docs/user.tex

@@ -21,7 +21,6 @@
 \documentclass{report}
 \usepackage{a4}
 \usepackage{html}
-\makeindex
 \latex{\usepackage{multicol}}
 \latex{\usepackage{fpcman}}
 \latex{\usepackage{epsfig}}
@@ -33,6 +32,20 @@
 \newcommand{\olabel}[1]{\label{option:#1}}
 % We should change this to something better. See \seef etc.
 \newcommand{\seeo}[1]{See \ref{option:#1}}
+\latex{%
+\ifpdf
+\usepackage[pdftex,bookmarks=true]{hyperref}
+\pdfcompresslevel=9
+\pdfpagewidth=210mm
+\pdfpageheight=297mm
+\pdfinfo{/Author(Michael Van Canneyt)
+/Title(Users' Guide)
+/Subject(Free Pascal Users' guide)
+/Keywords(Free Pascal)
+}
+\fi
+}
+\makeindex
 \begin{document}
 \title{Free Pascal :\\ Users' manual}
 \docdescription{Users' manual for \fpc, version \fpcversion}
@@ -203,7 +216,11 @@ The screen of the installation program looks like figure \ref{fig:install}.
 \begin{figure}
 \caption{The \dos install program screen.}
 \label{fig:install}
+\ifpdf
+\epsfig{file=pics/install.pdf,width=\textwidth}
+\else
 \epsfig{file=pics/install.eps,width=\textwidth}
+\fi
 \end{figure}
 \end{latexonly}
 
@@ -412,7 +429,7 @@ The examples in this section suppose that you have a \file{ppc386.cfg} which
 is set up correctly, and which contains at least the path setting for the
 RTL units. In principle this file is generated by the installation program.
 You may have to check that it is in the correct place (see section
-\ref{se:config_file} for more information on this).
+\ref{se:configfile} for more information on this).
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % Where the compiler looks for its files.
@@ -1088,7 +1105,7 @@ compiler to define only some very basic types.
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % Using the configuration file
 \section{Using the configuration file}
-\label{se:config_file}
+\label{se:configfile}
 Using the configuration file \file{ppc386.cfg} is an alternative to command
 line options. When a configuration file is found, it is read, and the lines
 in it are treated like you typed them on the command line. They are treated