+ Some completions for ansistrings and MODE switch

This commit is contained in:
michael 1999-01-26 14:39:26 +00:00
parent 699b53f316
commit db12b9222a
2 changed files with 106 additions and 6 deletions

View File

@ -854,7 +854,29 @@ greater than 1024. The first number sets the size of the stack, and the
second the size of the heap. (Stack setting is ignored under \linux).
The two numbers can be set on the command line using the \var{-Ch}
(and \var{-Cs} switches.
\subsection{\var{\$MODE} : Set compiler compatibility mode}
The \var{\{\$MODE\}} sets the compatibility mode of the compiler. This
is equivalent to setting one of the command-line options \var{-So} or
\var{-Sd} or \var{-S2}. it has the following arguments:
\begin{description}
\item[Default] Default mode. This reverts back to the mode that was set on
the command-line.
\item[Delphi] Delphi compatibility mode. All object-pascal extensions are
enabled. This is the same as the command-line option \var{-Sd}.
\item[TP] Turbo pascal compatibility mode. Object pascal extensions are
disabled, except ansistrings, which remain valid. This is the same as the command-line option \var{-So}
\item[FPC] FPC mode.
\item[OBJFPC] Object pascal mode. This is the same as the \var{-S2}
command-line option.
\item[GPC] GNU pascal mode. This is the same as the \var{-Sp} command-line
option.
\end{description}
For an exact description of each of these modes, see appendix \ref{ch:AppD},
on page \pageref{ch:AppD}
\subsection{\var{\$N} : Numeric processing }
This switch is recognised for Turbo Pascal compatibility, but is otherwise
@ -3587,4 +3609,80 @@ change this by redefining the \var{maxunits} constant in the
\file{files.pas} compiler source file.
\end{enumerate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Appendix D
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Compiler modes}
\label{ch:AppD}
Here we list the exact effect of the different compiler modes. They can be
set with the \var{\$Mode} switch, or by command line switches.
\section{FPC mode}
This mode is selected by the \var{{\$MODE FPC}} switch. On the command-line,
this means that you use none of the other compatibility mode switches.
It is the default mode of the compiler. This means essentially:
\begin{enumerate}
\item You must use the address operator to assign procedural variables.
\item A forward declaration must be repeated exactly the same by the
implementation of a function/procedure. In particular, you can not omit the
parameters when implementing the function or procedure.
\item Overloading of functions is allowed.
\item Nested comments are allowed.
\item The Objpas unit is NOT loaded.
\item You can use the cvar type.
\item PChars are converted to strings automatically.
\end{enumerate}
\section{TP mode}
This mode is selected by the \var{{\$MODE TP}} switch. On the command-line,
this mode is selected by the \var{-So} switch.
\begin{enumerate}
\item You cannot use the address operator to assign procedural variables.
\item A forward declaration must not be repeated exactly the same by the
implementation of a function/procedure. In particular, you can omit the
parameters when implementing the function or procedure.
\item Overloading of functions is not allowed.
\item Nested comments are not allowed.
\item You can not use the cvar type.
\end{enumerate}
\section{Delphi mode}
This mode is selected by the \var{{\$MODE DELPHI}} switch. On the command-line,
this mode is selected by the \var{-Sd} switch.
\begin{enumerate}
\item You can not use the address operator to assign procedural variables.
\item A forward declaration must not be repeated exactly the same by the
implementation of a function/procedure. In particular, you can not omit the
parameters when implementing the function or procedure.
\item Overloading of functions is not allowed.
\item Nested comments are not allowed.
\item The Objpas unit is loaded right after the system unit.
\end{enumerate}
\section{GPC mode}
This mode is selected by the \var{{\$MODE GPC}} switch. On the command-line,
this mode is selected by the \var{-Sp} switch.
\begin{enumerate}
\item You cmust use the address operator to assign procedural variables.
\item A forward declaration must not be repeated exactly the same by the
implementation of a function/procedure. In particular, you can omit the
parameters when implementing the function or procedure.
\item Overloading of functions is not allowed.
\item Nested comments are not allowed.
\item You can not use the cvar type.
\end{enumerate}
\section{OBJFPC mode}
This mode is selected by the \var{{\$MODE OBJFPC}} switch. On the command-line,
this mode is selected by the \var{-S2} switch.
\begin{enumerate}
\item You must use the address operator to assign procedural variables.
\item A forward declaration must be repeated exactly the same by the
implementation of a function/procedure. In particular, you can not omit the
parameters when implementing the function or procedure.
\item Overloading of functions is allowed.
\item Nested comments are allowed.
\item The Objpas unit is loaded right after the system unit.
\item You can use the cvar type.
\item PChars are converted to strings automatically.
\end{enumerate}
\end{document}

View File

@ -801,10 +801,11 @@ The result of such a typecast must be use with care. In general, it is best
to consider the result of such a typecast as read-only, i.e. suitable for
passing to a procedure that needs a constant pchar argument.
It is safe to use the result of such a typecast for modification ONLY
if the following conditios are met:
It is therefore NOT advisable to typecast one of the following:
\begin{enumerate}
\item If you're typecasting an expre
\item expressions.
\item strings that have reference count>0. (call uniquestring if you want to
ensure a string has reference count 1)
\end{enumerate}
\subsection{Constant strings}
@ -824,7 +825,8 @@ The example shows also that you can add two strings. The resulting string is
just the concatenation of the first with the second string, without spaces in
between them. Strings can not be substracted, however.
Whether the constant string is stord as an ansistring or a short string
Whether the constant string is stored as an ansistring or a short string
depends on the settings of the \var{\{\$H\}} switch.
\subsection{PChar}
@ -2991,7 +2993,7 @@ statements, procedures, and variable or type declarations.
A pascal program consists of the program header, followed possibly by a
'uses' clause, and a block.
\input{syntax/program.syn}
The program header is provided for backwards compatibility, nd is oignored
The program header is provided for backwards compatibility, and is ignored
by the compiler.
The uses clause serves to identify all units that are needed by the program.
The system unit doesn't have to be in this list, since it is always loaded