+ applied some changes by carl.

This commit is contained in:
michael 1998-07-17 10:04:17 +00:00
parent 35c2815722
commit c635ab47c7

View File

@ -98,7 +98,7 @@ Shortint & -127 .. 127 & 1\\
Integer & -32768 .. 32767 & 2 \\ Integer & -32768 .. 32767 & 2 \\
Word & 0 .. 65535 & 2 \\ Word & 0 .. 65535 & 2 \\
Longint & -2147483648 .. 2147483648 & 4\\ Longint & -2147483648 .. 2147483648 & 4\\
Cardinal\footnote{The cardinal type support is buggy until version 0.9.3} & 0..4294967296 & 4 \\ \hline Cardinal\footnote{The cardinal type support is buggy until version 0.99.6} & 0..4294967296 & 4 \\ \hline
\end{FPCltable} \end{FPCltable}
\fpc does automatic type conversion in expressions where different kinds of \fpc does automatic type conversion in expressions where different kinds of
@ -115,12 +115,13 @@ as \var{\%11111111}.
\subsection{Real types} \subsection{Real types}
\fpc uses the math coprocessor (or an emulation) for al its floating-point \fpc uses the math coprocessor (or an emulation) for al its floating-point
calculations. The native type for the coprocessor is \var{Double}. Other calculations. The Real native type for is processor dependant,
than that, all Turbo Pascal real types are supported. They're listed in but it is either Single or Double. Only the IEEE floating point type are
supported, and these depend on the target processor and emulation options .
The true Turbo Pascal compatible types are listed in
\seet{Reals}. \seet{Reals}.
\begin{FPCltable}{lccr}{Supported Real types}{Reals} \begin{FPCltable}{lccr}{Supported Real types}{Reals}
Type & Range & Significant digits & Size\footnote{In Turbo Pascal.} \\ \hline Type & Range & Significant digits & Size\footnote{In Turbo Pascal.} \\ \hline
Real & 2.9E-39 .. 1.7E38 & 11-12 & 6 \\
Single & 1.5E-45 .. 3.4E38 & 7-8 & 4 \\ Single & 1.5E-45 .. 3.4E38 & 7-8 & 4 \\
Double & 5.0E-324 .. 1.7E308 & 15-16 & 8 \\ Double & 5.0E-324 .. 1.7E308 & 15-16 & 8 \\
Extended & 1.9E-4951 .. 1.1E4932 & 19-20 & 10\\ Extended & 1.9E-4951 .. 1.1E4932 & 19-20 & 10\\
@ -128,9 +129,8 @@ Extended & 1.9E-4951 .. 1.1E4932 & 19-20 & 10\\
\end{FPCltable} \end{FPCltable}
Until version 0.9.1 of the compiler, all the real types are mapped to type Until version 0.9.1 of the compiler, all the real types are mapped to type
\var{Double}, meaning that they all have size 8. From version 0.9.3, the \var{Double}, meaning that they all have size 8. The \seef{SizeOf} function
\var{Extended} and \var{single} types are defined with the same suze as in is your friend here.
Turbo Pascal. The \seef{SizeOf} function is your friend here.
\subsection{Character types} \subsection{Character types}
\subsubsection{Char} \subsubsection{Char}
@ -291,6 +291,9 @@ be called, which may have strange side-effects.
\end{verbatim} \end{verbatim}
Here \var{Func} is a function which returns a \var{Boolean} type. Here \var{Func} is a function which returns a \var{Boolean} type.
{\em Remark:} The wordbool, longbool and bytebool were not supported
by \fpc until version 0.99.6.
\subsection{Arrays} \subsection{Arrays}
\fpc supports arrays as in Turbo Pascal, multi-dimensional arrays \fpc supports arrays as in Turbo Pascal, multi-dimensional arrays
and packed arrays are also supported. and packed arrays are also supported.
@ -1008,7 +1011,7 @@ valid for both.
Function overloading simply means that you can define the same function more Function overloading simply means that you can define the same function more
than once, but each time with a different set of arguments. than once, but each time with a different set of arguments.
When the compiler encounters a unction call, it will look at the function When the compiler encounters a function call, it will look at the function
parameters to decide which od the defined function parameters to decide which od the defined function
This can be useful if you want to define the same function for different This can be useful if you want to define the same function for different
types. For example, if the RTL, the \var{Dec} procedure is types. For example, if the RTL, the \var{Dec} procedure is
@ -1061,18 +1064,9 @@ procedures which accept arrays of fixed length.
\section{Using assembler in your code} \section{Using assembler in your code}
\fpc supports the use of assembler in your code, but not inline \fpc supports the use of assembler in your code, but not inline
assembler. assembly functions (i.e. functions declared with the assembler macros. Assembly functions (i.e. functions declared with the
\var{Assembler} keyword) are supported as of version 0.9.7. \var{Assembler} keyword) are supported as of version 0.9.7. (see
{\em Remark :}
\fpc issues AT\&T assembly language, as understood by most
unix assemblers (most notably : GNU \var{as}).
Intel assembler syntax is available as of version 0.9.8 but the Intel
support isn't complete in the sense that it is converted to AT\&T syntax,
and some constructions aren't supported by the conversion mechanism (see
\progref for more information about this). \progref for more information about this).
Therefore all examples of assembly language will be given in AT\&T syntax,
as it is the 'native' assembly from \fpc.
The following is an example of assembler inclusion in your code. The following is an example of assembler inclusion in your code.
\begin{verbatim} \begin{verbatim}
@ -1080,20 +1074,21 @@ The following is an example of assembler inclusion in your code.
Statements; Statements;
... ...
Asm Asm
Movl 0,%eax your asm code here
... ...
end; end;
... ...
Statements; Statements;
\end{verbatim} \end{verbatim}
The assembler instructions between the \var{Asm} and \var{end} keywords will The assembler instructions between the \var{Asm} and \var{end} keywords will
be inserted in the assembler generated by the compiler. be inserted in the assembler generated by the compiler.
You can still use comditionals in your assembler, the compiler will You can still use conditionals in your assembler, the compiler will
recognise it, and treat it as any other conditionals. recognise it, and treat it as any other conditionals.
Contrary to Turbo Pascal, it isn't possible (yet) to reference variables by \emph{ Remark: } Before version 0.99.1, \fpc did not support
their names in the assembler parts of your code. reference to variables by their names in the assembler parts of your code.
\section{Modifiers} \section{Modifiers}
\fpc doesn't support all Turbo Pascal modifiers, but \fpc doesn't support all Turbo Pascal modifiers, but
@ -1325,7 +1320,7 @@ powerful tool for making externally accessible object files.
\subsection{[RegisterList]} \subsection{[RegisterList]}
This modifier list is used to indicate the registers that are modified by an This modifier list is used to indicate the registers that are modified by an
assembler block in your code. The compiler stores certain results in the assembler block in your code. The compiler stores certain results in the
registers. If you modify theregisters in an assembly block, the compiler registers. If you modify the registers in an assembly block, the compiler
should, sometimes, be told about it. should, sometimes, be told about it.
The prototype syntax of the \var{Registerlist} modifier is: The prototype syntax of the \var{Registerlist} modifier is:
\begin{verbatim} \begin{verbatim}
@ -1333,7 +1328,7 @@ asm
statements statements
end; ['register1','register2',...,'registern']; end; ['register1','register2',...,'registern'];
\end{verbatim} \end{verbatim}
Where \var{'register'} is one of \var{'EAX',EBX',ECX','EDX'} etc. Where is register one of any of the available processor registers.
\subsection{Unsupported Turbo Pascal modifiers} \subsection{Unsupported Turbo Pascal modifiers}
@ -1372,14 +1367,6 @@ byte = 0..255;
word = 0..65535; word = 0..65535;
\end{verbatim} \end{verbatim}
The following Real types are declared:
\begin{verbatim}
double = real;
{$ifdef VER0_6}
extended = real;
single = real;
{$endif VER0_6}
\end{verbatim}
And the following pointer types: And the following pointer types:
\begin{verbatim} \begin{verbatim}
@ -1399,17 +1386,21 @@ Const
filemode : byte = 2; filemode : byte = 2;
\end{verbatim} \end{verbatim}
Further, the following general-purpose constants are also defined: Further, the following non processor specific general-purpose constants
are also defined:
\begin{verbatim} \begin{verbatim}
const const
test8086 : byte = 2; { always i386 or newer }
test8087 : byte = 3; { Always 387 or higher. emulated if needed. }
erroraddr : pointer = nil; erroraddr : pointer = nil;
errorcode : word = 0; errorcode : word = 0;
{ max level in dumping on error } { max level in dumping on error }
max_frame_dump : word = 20; max_frame_dump : word = 20;
\end{verbatim} \end{verbatim}
\emph{ Remark: } Processor specific global constants are named Testxxxx
where xxxx represents the processor number (such as Test8086, Test68000),
and are used to determine on what generation of processor the program
is running on.
\subsection{Variables} \subsection{Variables}
The following variables are defined and initialized in the system unit: The following variables are defined and initialized in the system unit:
\begin{verbatim} \begin{verbatim}
@ -2007,10 +1998,10 @@ arguments were given to the running program, \var{0} is returned.
be between \var{0} and \var{Paramcount}, these values included. be between \var{0} and \var{Paramcount}, these values included.
The zeroth argument is the name with which the program was started. The zeroth argument is the name with which the program was started.
} }
{Under Linux, command-line arguments may be longer than 255 characters. In { In all cases, the command-line will be truncated to a length of 255,
that case, the string is truncated. If you want to access the complete even though the operating system may support bigger command-lines. If you
string, you must use the \var{argv} pointer to access the real values of the want to access the complete command-line, you must use the \var{argv} pointer
command-line parameters.} to access the real values of the command-line parameters.}
{\seef{Paramcount}} {\seef{Paramcount}}
For an example, see \seef{Paramcount}. For an example, see \seef{Paramcount}.
@ -2097,7 +2088,6 @@ If \var{F} is a typed file, then each of the variables must be of the type
specified in the declaration of \var{F}. Untyped files are not allowed as an specified in the declaration of \var{F}. Untyped files are not allowed as an
argument.} argument.}
{If no data is available, a run-time error is generated. This behavior can {If no data is available, a run-time error is generated. This behavior can
be controlled with the \var{\{\$i\}} compiler switch.} be controlled with the \var{\{\$i\}} compiler switch.}
{\seep{Readln}, \seep{Blockread}, \seep{Write}, \seep{Blockwrite}} {\seep{Readln}, \seep{Blockread}, \seep{Write}, \seep{Blockwrite}}