Преглед изворни кода

* Many small things added.

michael пре 27 година
родитељ
комит
be00149b6b
5 измењених фајлова са 409 додато и 73 уклоњено
  1. 9 0
      docs/go32.tex
  2. 41 5
      docs/linux.tex
  3. 3 7
      docs/prog.tex
  4. 116 16
      docs/ref.tex
  5. 240 45
      docs/user.tex

+ 9 - 0
docs/go32.tex

@@ -664,3 +664,12 @@ block, described by selector \var{Sel}.
 
 For an example, see \seef{GlobalDosAlloc}.
 
+\functionl{Set\_Descriptor\_Access\_right}{SetDescriptorAccesRight}{(Des: word; W: word)}{Longint}
+{\var{Set\_Descriptor\_Access\_right} sets the access rights of a
+descriptor \var{Des}.}
+{None.}{seef{GetDescriptorAccesRight}}
+
+\functionl{Get\_Descriptor\_Access\_right}{GetDescriptorAccesRight}{(Des: word)}{Longint}
+{\var{Get\_Descriptor\_Access\_right} gets the access rights of a
+descriptor \var{Des}.}
+{None.}{seef{SetDescriptorAccesRight}}

+ 41 - 5
docs/linux.tex

@@ -385,7 +385,13 @@ the following constants:
   fs_proc     = $9fa0;
   fs_xia      = $012FD16D;
 \end{verbatim}
-
+the \seep{FLock} call uses the following mode constants :
+\begin{verbatim}
+  LOCK_SH = 1;
+  LOCK_EX = 2;
+  LOCK_UN = 8;
+  LOCK_NB = 4;
+\end{verbatim}
 
 \section{Functions and procedures}
 
@@ -1192,22 +1198,37 @@ Other errors include the ones by the fork and exec programs
 
 \input{linuxex/ex38.tex}
 
-\procedure {POpen}{(F : Text; Cmd : pathstr; rw : char)}
+\procedure {POpen}{(Var F : FileType; Cmd : pathstr; rw : char)}
 { Popen runs the command specified in \var{Cmd},
  and redirects the standard in or output of the
 command to the other end of the pipe \var{F}. The parameter \var{rw}
 indicates the direction of the pipe. If it is set to \var{'W'}, then F can
 be used to write data, which will then be read by the command from stdinput.
 If it is set to \var{'R'}, then the standard output of the command can be 
-read from \var{F}. \var{F} should be reset or rewritten.
-.}
+read from \var{F}. \var{F} should be reset or rewritten prior to using it.
+
+\var{F} can be of type \var{Text} or \var{File}.
+
+A file opened with \var {POpen} can be closed with \var{Close}, but also
+with \seef{PClose}. The result is the same, but \var{PClose} returns the
+exit status of the command \var{Cmd}.}
 {Errors are reported in \var{LinuxError} and are essentially those of the
 Execve, Dup and AssignPipe commands.
 }
-{\seep{AssignPipe}, \seem{popen}{3}}
+{\seep{AssignPipe}, \seem{popen}{3}, \seef{PClose}}
 
 \input{linuxex/ex37.tex}
 
+\function{PClose}{(Var F : FileType)}{longint}
+{ \var{PClose} closes a file opened with \var{POpen}. It waits for the
+command to complete, and then returns the exit status of the command. 
+}
+{\var{LinuxError} is used to report errors. If it is different from zero,
+the exit status is not valid.}
+{\seep{POpen}}
+
+For an example, see \seep{POpen}
+
 \function{Fcntl}{(Fd :  text, Cmd : Integer)}{Integer}
 {
 Read a file's attributes. \var{Fd} is an assigned file.
@@ -1961,3 +1982,18 @@ otherwise.
 {Errors are reported in LinuxError.}
 {\seem{termios}{2}}
 
+\function{FLock}{(Var F; Mode : longint)}
+{\var{FLock} implements file locking. it sets or removes a lock on the file
+\var{F}. F can be of type \var{Text} or \var{File}, or it can be a \linux
+filedescriptor (a longint)
+
+\var{Mode} can be one of the following constants :
+\begin{description}
+\item [LOCK_SH] \ sets a shared lock.
+\item [LOCK_EX] \ sets an exclusive lock.
+\item [LOCK_UN] \ unlocks the file.
+\item [LOCK_NB] \ This can be OR-ed together with the other. If this is done
+the application doesn't block when locking.
+\end{description}
+}
+{Errors are reported in \var{LinuxError}.}{\seef{Fcntl}, \seem{flock}{2}}

+ 3 - 7
docs/prog.tex

@@ -31,7 +31,7 @@
 \begin{document}
 \title{Free Pascal \\ Programmers' manual}
 \docdescription{Programmers' manual for \fpc, version \fpcversion}
-\docversion{1.1}
+\docversion{1.3}
 \date{March 1998}
 \author{Micha\"el Van Canneyt}
 \maketitle
@@ -1265,8 +1265,8 @@ This method is equivalent to the following statement:
 \begin{verbatim}
 Procedure ProcName (Args : TPRocArgs); cdecl; external;
 \end{verbatim} 
-However, the \var{[ C ]} directive is deprecated, and may no longer be
-supported in future versions of \fpc, therefore you should use the
+However, the \var{[ C ]} directive is no longer supoerted as of version
+0.99.5  of \fpc, therefore you should use the
 \var{external} directive, with the \var{cdecl} directive, if needed.
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1357,10 +1357,6 @@ In case you used
 \begin{verbatim}
 Procedure ProcName (Args : TPRocArgs); external;
 \end{verbatim}
-Or the older method
-\begin{verbatim}
-Procedure ProcName (Args : TPRocArgs); [ C ];
-\end{verbatim}
 You still need to explicity link to the library. This can be done in 2 ways:
 \begin{enumerate}
 \item You can tell the compiler in the source file what library to link to

+ 116 - 16
docs/ref.tex

@@ -34,8 +34,8 @@
 \begin{document}
 \title{Free Pascal :\\ Reference guide.}
 \docdescription{Reference guide for Free Pascal.}
-\docversion{1.3}
-\date{September 1997}
+\docversion{1.4}
+\date{March 1998}
 \author{Micha\"el Van Canneyt
 % \\ Florian Kl\"ampfl
 }
@@ -292,10 +292,8 @@ be called, which may have strange side-effects.
 Here \var{Func} is a function which returns a \var{Boolean} type.
 
 \subsection{Arrays}
-\fpc supports arrays as in Turbo Pascal, except that packed arrays are not
-supported. 
-
-Multi-dimensional arrays are also supported.
+\fpc supports arrays as in Turbo Pascal, multi-dimensional arrays 
+and packed arrays are also supported.
 
 \subsection{Pointers}
 \fpc supports the use of pointers. A variable of the type \var{Pointer}
@@ -418,7 +416,9 @@ The reason for this is that by default, elements of a record are aligned at
 2-byte boundaries, for performance reasons. This default behaviour can be
 changed with the \var{\{\$PackRecords n\}} switch. Possible values for
 \var{n} are 1, 2 and 4. This switch tells the compiler to align elements of
-a record on 1,2 or 4 byte boundaries. Take a look at the following program:
+a record or object or class on 1,2 or 4 byte boundaries. 
+
+Take a look at the following program:
 \begin{CodEx}
 \begin{verbatim}
 Program PackRecordsDemo;
@@ -451,7 +451,7 @@ And this is as expected. In \var{Trec1}, each of the elements \var{A} and
 \var{B} takes 2 bytes of memory, and in  \var{Trec1}, \var{A} takes only 1
 byte of memory.
 
-As from version 0.9.3 (a developers' version), \fpc supports also the
+{\em Remark:} As from version 0.9.3 (a developers' version), \fpc supports also the
 'packed record', this is a record where all the elements are byte-aligned.
 
 Thus the two following declarations are equivalent:
@@ -709,6 +709,25 @@ destructor will then be called, before removing the object from the heap.
 In view of the compiler warning remark, the now following Delphi approach may 
 be considered a more natural way of object-oriented programming.
 
+{\em Remark:}
+\fpc also supports the packed object. This is the same as an object, only 
+the elements (fields) of the object are byte-aligned, just as in the packed
+record.
+
+The declaration of a packed object is similar to the declaration
+of a packed record :
+\begin{verbatim}
+Type
+  TObj = packed object;
+   Constructor init;
+   ...
+   end;
+  Pobj = ^TObj;
+
+Var PP : Pobj;
+\end{verbatim}  
+Similarly, the \var{\{$PACKRECORDS \}} directive acts on objects as well.
+
 \subsection{The Delphi approach}
 In the Delphi approach to Object Oriented Programming, everything revolves
 around  the concept of 'Classes'. 
@@ -757,7 +776,16 @@ So, to initialize an instance of some class, you do the following :
   ClassVar:=ClassType.ConstructorName;
 \end{verbatim}
 
-{\em Remark :} \fpc doesn't support the concept of properties yet.
+{\em Remark :}
+\begin{itemize}
+\item \fpc doesn't support the concept of properties yet.
+\item The \var{\{\$Packrecords \}} directive also affects classes.
+i.e. the alignment in memory of the different fields depends on the
+value of  the \var{\{\$Packrecords \}} directive.
+\item Just as for objects and records, you can declare a packed class.
+This has the same effect as on an object, or record, namely that the
+elements are aligned on 1-byte boundaries. i.e. as close as possible.
+\end{itemize}
 
 \section{Statements controlling program flow.}
 
@@ -1107,9 +1135,11 @@ function \var{Second}, since it isn't declared in the interface part.
 However, it will be possible to access the function \var{Second} at the
 assembly-language level, by using it's mangled name (\progref).
 
-\subsection{C}
-The \var{C} modifier can be used to declare a function that resides in a
-object file generated by a C compiler. It allows you to use the function in
+\subsection{cdecl}
+\label{se:cdecl}
+The \var{cdecl} modifier can be used to declare a function that uses a C
+type calling convention. This must be used if you wish to acces functions in
+an object file generated by a C compiler. It allows you to use the function in
 your code, and at linking time, you must link the object file containing the
 \var{C} implementation of the function or procedure.
 
@@ -1118,9 +1148,11 @@ As an example:
 \begin{verbatim}
 program CmodDemo;
 
+{$LINKLIB c}
+
 Const P : Pchar = 'This is fun !';
 
-Function strlen (P : Pchar) : Longint; [ C ];
+Function strlen (P : Pchar) : Longint; cdecl; external;
 
 begin
   Writeln ('Length of (',p,') : ',strlen(p))
@@ -1128,13 +1160,71 @@ end.
 \end{verbatim}
 \end{CodEx}
 When compiling this, and linking to the C-library, you will be able to call
-the \var{strlen} function throughout your program.
+the \var{strlen} function throughout your program. The \var{external}
+directive tells the compiler that the function resides in an external
+object filebrary (see \ref{se:external}). 
 
 {\em Remark} The parameters in our declaration of the \var{C} function should 
-match exactly the ones in the declaration in \var{C}. S
-ince \var{C} is case sensitive, this means also that the name of the
+match exactly the ones in the declaration in \var{C}. Since \var{C} is case 
+sensitive, this means also that the name of the
 function must be exactly the same.
 
+\subsection{external}
+\label{se:external}
+The \var{external} modifier can be used to declare a function that resides in
+an external object file. It allows you to use the function in
+your code, and at linking time, you must link the object file containing the
+implementation of the function or procedure.
+
+As an example:
+\begin{CodEx}
+\begin{verbatim}
+program CmodDemo;
+
+{$Linklib c}
+
+Const P : Pchar = 'This is fun !';
+
+Function strlen (P : Pchar) : Longint; cdecl; external;
+
+begin
+  Writeln ('Length of (',p,') : ',strlen(p))
+end.
+\end{verbatim}
+\end{CodEx}
+
+{\em Remark} The parameters in our declaration of the \var{external} function 
+should match exactly the ones in the declaration in the object file.
+Since \var{C} is case sensitive, this means also that the name of the
+function must be exactly the same.
+
+The \var{external} modifier has also an extended syntax:
+\begin{enumerate}
+\item
+
+\begin{verbatim}
+external 'lname';
+\end{verbatim}
+Tells the compiler that the function resides in library 'lname'. The
+compiler will the automatically link this library to your program.
+
+\item
+\begin{verbatim}
+external 'lname' name Fname;
+\end{verbatim}
+Tells the compiler that the function resides in library 'lname', but with
+name 'Fname'. The compiler will the automatically link this library to your 
+program, and use the correct name for the function.
+
+\item \windows and \ostwo only:
+\begin{verbatim}
+external 'lname' Index Ind;
+\end{verbatim}
+Tells the compiler that the function resides in library 'lname', but with
+indexname \var{Ind}. The compiler will the automatically link this library to your 
+program, and use the correct index for the function.
+\end{enumerate}
+
 \subsection{Export}
 Sometimes you must provide a callback function for a C library, or you want
 your routines to be callable from a C program. Since \fpc and C use
@@ -1343,6 +1433,16 @@ program terminated normally.
 \var{ExitCode} is always passed to the operating system as the exit-code of
 your process.
 
+Under \file{GO32}, the following constants are also defined :
+\begin{verbatim}
+const
+   seg0040 = $0040;
+   segA000 = $A000;
+   segB000 = $B000;
+   segB800 = $B800;
+\end{verbatim}
+These constants allow easy access to the bios/screen segment via mem/absolute.
+
 \section{Functions and Procedures}
 \function{Abs}{(X : Every numerical type)}{Every numerical type}
 {\var{Abs} returns the absolute value of a variable. The result of the

+ 240 - 45
docs/user.tex

@@ -24,6 +24,7 @@
 \makeindex
 \latex{\usepackage{multicol}}
 \latex{\usepackage{fpcman}}
+\latex{\usepackage{epsfig}}
 \html{\input{fpc-html.tex}}
 \newcommand{\remark}[1]{\par$\rightarrow$\textbf{#1}\par}
 \newcommand{\olabel}[1]{\label{option:#1}}
@@ -182,10 +183,28 @@ We discuss the process for each platform separately.
 First, you must get the latest distribution files of \fpc. They come as zip
 files, which you must unzip first. The distribution zip file contains an
 installation program \file{INSTALL.EXE}. You must run this program to install
-the compiler. It allows you to select:
+the compiler. 
+
+\html{
+The screen of the installation program looks like this:
+
+\htmladdimg{../pics/install.gif}
+}
+\latex{
+The screen of the installation program looks like figure \ref{fig:install}.
+\begin{figure}
+\caption{The \dos install program screen.}
+\label{fig:install}
+\epsfig{file=pics/install.eps,width=\textwidth}
+\end{figure}
+}
+
+The program allows you to select:
 \begin{itemize}
 \item What components you wish to install. (e.g do you want the sources or
-not, do you want Free Vision etc.)
+not, do you want docs or not) Items that you didn't download will not
+be enabled, i.e. you can't select them.
+
 \item Where you want to install (the default location is \verb|C:\PP|).
 \end{itemize}
 The installation program generates a batch file which sets some environment
@@ -252,8 +271,12 @@ rpm -i fpc-pascal-XXX.rpm
 
 If you use debian, installation is limited to 
 \begin{verbatim}
-???
+dpkg -i fpc-XXX.deb
 \end{verbatim}
+Here again, \var{XXX} is the version number of the \file{.deb} file.
+
+You need root access to install these packages. The \file{.tar} file
+allows you to do an installation if you don't have root permissions.
 
 When downloading the \var{.tar} file, installation is more interactive:
 
@@ -439,6 +462,17 @@ So don't delete them. If you want to distribute the unit, you must
 provide both the \file{.ppu} and \file{.o} file. One is useless without the
 other.
 
+{\em Remark:}
+Under \linux, a unit source file {\em must} have a lowercase filename.
+Since Pascal is case independent, you can specify the names of units in the
+\var{uses} clause in either case. To get a unique filename, the \fpc compiler
+changes the name of the unit to all lowercase when looking for unit files.
+
+The compiler produces lowercase files, so your unit will be found, even if
+your source file has uppercase letters in it. Only when the compiler tries to
+recompile the unit, it will not find your source because of the uppercase
+letters. 
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % Creating an executable for GO32V1, PMODE/DJ targets
 \section{Creating an executable for GO32V1 and PMODE/DJ targets}
@@ -451,7 +485,7 @@ section (unless they're cross-compiling)
 %
 \subsection{GO32V1}
 When compiling under \dos, GO32V2 is the default target. However, if you use
-go32V1 (using the \var{-TDOS} switch), the 
+go32V1 (using the \var{-TGO32V1} switch), the 
 compilation process leaves you with a file which you cannot execute right away.
 There are 2 things you can do when compiling has finished.
 
@@ -807,18 +841,12 @@ blocks. Here \var{xxx} is one of the following:
 file.   
 \end{description}
 \item [-S2] \olabel{Stwo} Switch on Delphi 2 extensions.
-\item [-Sann] \olabel{Sa} How severe should the compiler check your code ?
-\var{nn} can be one of the following:
-\begin{itemize}
-\item \var{0} : Only ANSI Pascal expressions allowed.
-\item \var{1} : Do not necessarily assign function results to variables.
-\item \var{2} : Address operator \var{@} returns a typed pointer.
-\item \var{4} : Assignment results are typed. (This allows constructs like
-\var{a:=b:=0}. See also ...
-\item \var{9} : Allows expressions with no side effect. \remark{Florian ???}
-\end{itemize}
 \item [-Sc] \olabel{Sc} Support C-style operators, i.e. \var{*=, +=, /= and
 -=}.
+\item [-Se] \olabel{Se} The compiler stops after the first error. Normally,
+the compiler tries to continue compiling after an error, until 50 errors are
+reached, or a fatal error is reachd, and then it stops. With this switch,
+the compiler will stop after the first error.
 \item [-Sg] \olabel{Sg} Support the \var{label} and \var{goto} commands.
 \item [-Si] \olabel{Si} Support \var{C++} style INLINE.
 \item [-Sm] \olabel{Sm} Support C-style macros.
@@ -843,12 +871,15 @@ 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
 before the options that you type on the command line.
 
+You can specify comments in the configuration file with the \var{\#} sign.
+Everything from the \var{\#} on will be ignored.
+
 The compiler looks for the \file{ppc386.cfg} file in the following places :
 \begin{enumerate}
 \item The current directory.
 \item Under \dos, the directory where the compiler is. Under \linux, 
-       the compiler looks in the \file{/etc} directory, or, if specified,
-the directory in the \var{PPC\_CONFIG\_PATH} environment variable.
+       the compiler looks in the \file{/etc} directory
+\item if specified, the directory in the \var{PPC\_CONFIG\_PATH} environment variable.
 \end{enumerate}
 When the compiler has finished reading the configuration file, it continues
 to treat the command line options.
@@ -1102,6 +1133,7 @@ this text is processed too.
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 \chapter{Utilities and units that come with Free Pascal}
+\label{ch:Utilities}
 Besides the compiler and the Run-Time Library, \fpc comes with some utility
 programs and units. Here we list these programs and units. 
 
@@ -1122,7 +1154,9 @@ These programs have no other purpose than demonstrating the capabilities of
 \fpc. They are located in the \file{demo} directory of the sources.
 \item All example programs of the documentation are available. Check out the
 directories that end on \file{ex} in the documentation sources. There you
-wll find all example sources.
+will find all example sources.
+\item \file{ppumove} is a program to make shared or static libraries from
+units. It should be distributed in binary form along with the compiler.
 \end{itemize}
 
 
@@ -1131,68 +1165,72 @@ wll find all example sources.
 \section{Supplied units}
 Here we list the units that come with the \fpc distribution. Since there is
 a difference in the supplied units per operating system, we list them
-separately per system.
+separately per system. They are documented in the \unitsref.
 
 %
-%
-
 % Under DOS
+%
 \subsection{Under DOS}
 \begin{itemize}
-\item \seestrings\ This unit provides basic
+\item [strings] This unit provides basic
 string handling routines for the \var{pchar} type, comparable to similar
 routines in standard \var{C} libraries.
-\item \seeobjects\  This unit provides basic
+\item [objects]  This unit provides basic
 routines for handling objects.
-\item \seedos\ This unit provides basic routines for
+\item [dos] This unit provides basic routines for
 accessing the operating system \dos. It provides almost the same
 functionality as the Turbo Pascal unit. 
-\item \seeprinter\  This unit provides all you
+\item [printer]  This unit provides all you
 need for rudimentary access to the printer.
-\item \seegetopts\ This unit gives you the
+\item [getopts] This unit gives you the
 \gnu \var{getopts} command-line arguments  handling mechanism. 
 It also supports long options.
-\item \seecrt\ This unit provides basic screen
+\item [crt] This unit provides basic screen
 handling routines. It provides the same functionality  as the Turbo Pascal \var{CRT}
 unit.
-\item \seegraph\ This unit provides basic graphics
+\item [graph] This unit provides basic graphics
 handling, with routines to draw lines on the screen, display texts etc. It
 provides the same functions as the Turbo Pascal unit.
-\item \seego\ This unit provides access to possibilities of the \var{GO32}
+\item [go32] This unit provides access to possibilities of the \var{GO32}
 \dos extender.
+\item [emu387] This unit provides support for the coprocessor emulator.
+\item [mmx] This unit provides support for \var{mmx} extensions in your
+code.
 \end{itemize}
-\remark{Florian, I don't know the full list - let me know what is available}
 
 %
-%
-
 % Under Linux
+%
 \subsection{Under Linux}
 \begin{itemize}
-\item \seestrings\ This unit provides basic
+\item [strings] This unit provides basic
 string handling routines for the \var{PChar} type, comparable to similar
 routines in standard \var{C} libraries.
-\item \seeobjects\ This unit provides basic
+\item [objects] This unit provides basic
 routines for handling objects.
-\item \seecrt\ This unit provides basic screen
+\item [crt] This unit provides basic screen
 handling routines. It provides the same functionality Turbo Pascal \var{CRT}
 unit. It works on any terminal which supports the \var{vt100} escape
 sequences.
-\item \seedos\ This unit provides an emulation of the
+\item [dos] This unit provides an emulation of the
 same unit under \dos. It is intended primarily for easy porting of Pascal
 programs from \dos to \linux. For good performance, however, it is
 recommended to use the \var{linux} unit.
-\item \seelinux This unit provides access to the
+\item [linux] This unit provides access to the
 \linux operating system. It provides most file and I/O handling routines
 that you may need. It implements most of the standard \var{C} library constructs
 that you will find on a Unix system. If you do a lot of disk/file
 operations, the use of this unit is recommended over the one you use under
 Dos.
-\item \seeprinter\ This unit provides an
+\item [printer] This unit provides an
 interface to the standard Unix printing mechanism.
-\item \seegetopts This unit gives you the
+\item [getopts] This unit gives you the
 \gnu \var{getopts} command-line arguments  handling mechanism. 
 It also supports long options.
+\item [mmx] This unit provides support for \var{mmx} extensions in your
+code.
+\item [sockets] This unit gives you access to sockets and TCP/IP
+programming.
 \end{itemize}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1249,14 +1287,19 @@ which you can debug it using \gnu \var{gdb}.
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Using \var{gdb
+% Using gdb
 \section{Using \var{gdb} to debug your program}
 
 To use gdb to debug your program, you can start the debugger, and give it as
-an option the name of your program:
+an option the {\em full} name of your program:
 \begin{verbatim}
 gdb hello
 \end{verbatim}
+Or, under \dos :
+\begin{verbatim}
+gdb hello.exe
+\end{verbatim}
+
 This starts the debugger, and the debugger immediately loads your program
 into memory, but it does not run the program yet. Instead, you are presented
 with the following (more or less) message, followed by the \var{gdb} prompt
@@ -1307,6 +1350,71 @@ read or written.
 for more information, see the \var{gdb} users' guide, or use the \var{'help'}
 function in \var{gdb}.
 
+The appendix {\ref{ch:GdbIniFile}} contains a sample init file for
+\var{gdb}, which produces good results when debugging \fpc programs.
+
+\section{Caveats when debugging with \var{gdb}}
+There are some peculiarities of \fpc which you should be aware of when using
+\var{gdb}. We list the main ones here:
+\begin{enumerate}
+\item \fpc generates information for GDB in uppercare letters. This is a
+consequence of the fact that pascal is a case insensitive language. So, when
+referring to a variable or function, you need to make it's name all
+uppercase.
+
+As an example, of you want to watch the value of a loop variable
+\var{count}, you should type
+\begin{verbatim}
+watch COUNT
+\end{verbatim}
+Or if you want stop when a certain function (e.g \var{MyFunction}) is called, 
+type
+\begin{verbatim}
+break MYFUNCTION
+\end{verbatim}
+
+\item Line numbers may be off by a little. This is a bug in \fpc and will be
+fixed as soon as possible.
+
+\item \var{gdb} does not know sets.
+
+\item \var{gdb} doesn't know strings. Strings are represented in \var{gdb} 
+as records with a length field and an array of char contaning the string.
+
+You can also use the following user function to print strings:
+\begin{verbatim}
+define pst
+set $pos=&$arg0
+set $strlen = {byte}$pos
+print {char}&$arg0.st@($strlen+1)
+end
+
+document pst
+  Print out a Pascal string
+end 
+\end{verbatim}
+If you insert it in your \file{gdb.ini} file, you can look at a string with this
+function. There is a sample \file{gdb.ini} in appendix \ref{ch:GdbIniFile}.
+
+
+\item Objects are difficult to handle, mainly because \var{gdb} is oriented
+towards C and C++. The workaround implemented in \fpc is that object methods
+are represented as functions, with an extra parameter \var{this} (all
+lowercase !) The name of this function is a concatenation of the object type
+and the function name, separated by two underscore characters.
+
+
+For example, the method \var{TPoint.Draw} would be converted to
+\var{TPOINT\_\_DRAW}, and could be stopped at with
+\begin{verbatim}
+break TPOINT__DRAW
+\end{verbatim}
+
+\item Global overloaded functions confuse \var{gdb} because they have the same
+name. Thus you cannot set a breakpoint at an overloaded function, unless you
+know it's line number, in which case you can set a breakpoint at the
+starting linenumber of the function.
+\end{enumerate}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % Using gprof
@@ -1624,8 +1732,9 @@ Windows, I'd be willing to include it here.
 The following is alphabetical listing of all command-line options, as
 generated by the compiler:
 \begin{verbatim}
+ppc386 [options] <inputfile> [options]
 + switch option on, - off
-  -a     the compiler doesn''t delete the generated assembler file
+  -a     the compiler doesn't delete the generated assembler file
   -B+    build
   -C     code generation options
            -Ca      not implemented
@@ -1662,10 +1771,8 @@ generated by the compiler:
   -P     use pipes instead of creating temporary assembler files
   -S     syntax options
            -S2      switch some Delphi 2 extension on
-           -Sa      semantic check of expressions (higher level includes lower)
-                     -Sa4  assigment results are typed (allows a:=b:=0)
-                     -Sa9  allows expressions with no side effect
            -Sc      supports operators like C (*=,+=,/= and -=)
+           -Se      compiler stops after the first error
            -Sg      allows LABEL and GOTO
            -Si      support C++ stlyed INLINE
            -Sm      support macros like C (global)
@@ -1674,7 +1781,7 @@ generated by the compiler:
            -St      allows static keyword in objects
   -s     don't call assembler and linker (only with -a)
   -T<x>  Target operating system
-           -TDOS    DOS extender by DJ Delorie
+           -TGO32V1 DOS extender by DJ Delorie
            -TOS2    OS/2 2.x
            -TLINUX  Linux
            -TWin32  Windows 32 Bit
@@ -1721,6 +1828,8 @@ Processor specific options:
            -O5      optimize for Pentium (tm)
            -O6      optimizations for PentiumPro (tm)
   
+  -?     shows this help
+  -h     shows this help without waiting
 \end{verbatim}
 
 
@@ -1742,6 +1851,7 @@ assembler
 begin
 break
 case
+cdecl
 class
 const
 constructor
@@ -1770,6 +1880,7 @@ goto
 if
 implementation
 in
+index
 inherited
 initialization
 inline
@@ -1804,6 +1915,7 @@ self
 set
 shl
 shr
+stdcall
 string
 then
 to
@@ -2250,6 +2362,57 @@ When trying to do a build, the compiler cannot compile one of the units.
 \item [Re-raise isn't possible there]
 You are trying to raise an exception where it isn't allowed. You can only
 raise exceptions in an \var{except} block.
+
+\item [ Syntax error while parsing a conditional compiling expression ]
+\item [ Evaluating a conditional compiling expression ]
+\item [ Keyword redefined as macro has no effect ]
+\item [ compiler switches aren't allowed in (* ... *) styled comments ]
+\item [ No DLL File specified ]
+\item [ Illegal open parameter ]
+\item [ Illegal floating point constant ]
+\item [ string types doesn't match, because of \$V+ mode ]
+\item [ Only class methods can be referred with class references ]
+\item [ Only class methods can be accessed in class methods ]
+\item [ Constant and CASE types do not match ]
+\item [ The symbol can't be exported from a library ]
+\item [ A virtual method must be overridden using the OVERRIDE directive:  ]
+\item [ There is no method in an ancestor class to be overridden: ]
+\item [ No member is provided to access property ]
+\item [ Illegal symbol for property access ]
+\item [ Cannot write a protected field of an object ]
+\item [ range check error in set constructor or duplicate set element ]
+\item [ Pointer to class expected ]
+\item [ Operator is not overloaded ]
+\item [ Variable or type indentifier expected ]
+\item [ Assembler incompatible with function return value ]
+\item [ Procedure overloading is switched off ]
+\item [ Comparative operator must return a boolean value ]
+\item [ Use of unsupported feature! ]
+\item [ absolute can only be associated to ONE variable ]
+\item [ absolute can only be associated a var or const ]
+\item [ succ or pred on enums with assignments not possible ]
+\item [ Array properties aren't allowed at this point ]
+\item [ No property found to override ]
+\item [ Only one default property is allowed, found inherited default property in class ]
+\item [ The default property must be an array property ]
+\item [ Internal Error in SymTableStack() ]
+\item [ Error in type defenition ]
+\item [ Only static variables can be used in static methods or outside methods ]
+\item [ Invalid call to tvarsym.mangledname() ]
+\item [ illegal type declaration of set elements ]
+\item [ Forward class definition not resolved  ]
+\item [ identifier idents no member ]
+\item [ The use of a far pointer isn't allowed there ]
+\item [ procedure call with stackframe ESP/SP ]
+\item [ Abstract methods can't be called directly ]
+\item [ Internal Error in getfloatreg(), allocation failure ]
+\item [ Unknown float type ]
+\item [ SecondVecn() base defined twice ]
+\item [ Extended cg68k not supported ]
+\item [ 32-bit unsigned not supported in MC68000 mode ]
+\item [ Internal Error in secondinline() ]
+\item [ Stack limit excedeed in local routine ]
+
 \end{description}
 
 \chapter{Run time errors}
@@ -2714,4 +2877,36 @@ the installation section.
 {\em   A} : \ostwo installs an emulator for native \ostwo images, but does not
    provide FPU emulation for DOS sessions.
 
+
+\chapter{A sample \file{gdb.ini} file}
+\label{ch:GdbIniFile}
+
+Here you have a sample \file{gdb.ini} file listing, which gives better
+results when using \var{gdb}. Under \linux you should put this in a
+\file{.gdbinit} file in your home directory or the current directory..  
+ 
+\begin{verbatim}
+set print demangle off
+set gnutarget auto
+set verbose on
+set complaints 1000
+dir ./rtl/dosv2
+set language c++
+set print vtbl on
+set print object on
+set print sym on
+set print pretty on
+disp /i $eip
+
+define pst
+set $pos=&$arg0
+set $strlen = {byte}$pos
+print {char}&$arg0.st@($strlen+1)
+end
+
+document pst
+  Print out a pascal string
+end    
+\end{verbatim}
+
 \end{document}