|
@@ -24,9 +24,9 @@
|
|
\begin{latexonly}
|
|
\begin{latexonly}
|
|
\ifpdf
|
|
\ifpdf
|
|
\pdfinfo{/Author(Michael Van Canneyt)
|
|
\pdfinfo{/Author(Michael Van Canneyt)
|
|
- /Title(Standard units Reference Guide)
|
|
|
|
|
|
+ /Title(Free Pascal Language Reference Guide)
|
|
/Subject(Free Pascal Reference guide)
|
|
/Subject(Free Pascal Reference guide)
|
|
- /Keywords(Free Pascal, Language, System Unit)
|
|
|
|
|
|
+ /Keywords(Free Pascal, Language)
|
|
}
|
|
}
|
|
\fi
|
|
\fi
|
|
\end{latexonly}
|
|
\end{latexonly}
|
|
@@ -65,13 +65,17 @@
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
% About this guide
|
|
% About this guide
|
|
\section*{About this guide}
|
|
\section*{About this guide}
|
|
-This document describes all constants, types, variables, functions and
|
|
|
|
-procedures as they are declared in the system unit.
|
|
|
|
-Furthermore, it describes all pascal constructs supported by \fpc, and lists
|
|
|
|
-all supported data types. It does not, however, give a detailed explanation
|
|
|
|
-of the pascal language. The aim is to list which Pascal constructs are
|
|
|
|
-supported, and to show where the \fpc implementation differs from the
|
|
|
|
-Turbo Pascal implementation.
|
|
|
|
|
|
+This document serves as the reference for the Pascal langauge as implemented
|
|
|
|
+by the \fpc compiler. It describes all Pascal constructs supported by
|
|
|
|
+\fpc, and lists all supported data types. It does not, however, give a
|
|
|
|
+detailed explanation of the pascal language. The aim is to list which
|
|
|
|
+Pascal constructs are supported, and to show where the \fpc implementation
|
|
|
|
+differs from the Turbo Pascal or Delphi implementations.
|
|
|
|
+
|
|
|
|
+Earlier versions of this document also contained the reference documentation
|
|
|
|
+of the \file{system} unit and \file{objpas} unit. This has been moved to the
|
|
|
|
+RTL reference guide.
|
|
|
|
+
|
|
\subsection*{Notations}
|
|
\subsection*{Notations}
|
|
Throughout this document, we will refer to functions, types and variables
|
|
Throughout this document, we will refer to functions, types and variables
|
|
with \var{typewriter} font. Functions and procedures have their own
|
|
with \var{typewriter} font. Functions and procedures have their own
|
|
@@ -131,8 +135,6 @@ Note, that one of the possibilities can be empty:
|
|
This means that both the first or second possibility are optional.
|
|
This means that both the first or second possibility are optional.
|
|
Of course, all these elements can be combined and nested.
|
|
Of course, all these elements can be combined and nested.
|
|
|
|
|
|
-\part{The Pascal language}
|
|
|
|
-
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
% The Pascal language
|
|
% The Pascal language
|
|
|
|
|
|
@@ -3660,9 +3662,9 @@ When this statement is encountered, the control variable is initialized with
|
|
the initial value, and is compared with the final value.
|
|
the initial value, and is compared with the final value.
|
|
What happens next depends on whether \var{to} or \var{downto} is used:
|
|
What happens next depends on whether \var{to} or \var{downto} is used:
|
|
\begin{enumerate}
|
|
\begin{enumerate}
|
|
-\item In the case \var{To} is used, if the initial value larger than the final
|
|
|
|
|
|
+\item In the case \var{To} is used, if the initial value is larger than the final
|
|
value then \var{Statement} will never be executed.
|
|
value then \var{Statement} will never be executed.
|
|
-\item In the case \var{DownTo} is used, if the initial value larger than the final
|
|
|
|
|
|
+\item In the case \var{DownTo} is used, if the initial value is less than the final
|
|
value then \var{Statement} will never be executed.
|
|
value then \var{Statement} will never be executed.
|
|
\end{enumerate}
|
|
\end{enumerate}
|
|
After this check, the statement after \var{Do} is executed. After the
|
|
After this check, the statement after \var{Do} is executed. After the
|
|
@@ -5371,3185 +5373,6 @@ parameters. In the case of functions, ordinal values must be returned
|
|
in the accumulator. In the case of floating point values, these depend
|
|
in the accumulator. In the case of floating point values, these depend
|
|
on the target processor and emulation options.
|
|
on the target processor and emulation options.
|
|
|
|
|
|
-%
|
|
|
|
-% System unit reference guide.
|
|
|
|
-%
|
|
|
|
-
|
|
|
|
-\part{Reference : The System unit}
|
|
|
|
-
|
|
|
|
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
-% The system unit
|
|
|
|
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
-\chapter{The system unit}
|
|
|
|
-\label{ch:refchapter}
|
|
|
|
-\FPCexampledir{refex}
|
|
|
|
-The system unit contains the standard supported functions of \fpc. It is the
|
|
|
|
-same for all platforms. Basically it is the same as the system unit provided
|
|
|
|
-with Borland or Turbo Pascal.
|
|
|
|
-
|
|
|
|
-Functions are listed in alphabetical order. Arguments of functions or
|
|
|
|
-procedures that are optional are put between square brackets.
|
|
|
|
-
|
|
|
|
-The pre-defined constants and variables are listed in the first section.
|
|
|
|
-The second section contains an overview of all functions, grouped by
|
|
|
|
-functionality, and the last section contains the supported functions
|
|
|
|
-and procedures.
|
|
|
|
-
|
|
|
|
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
-% Types, Constants and Variables
|
|
|
|
-\section{Types, Constants and Variables}
|
|
|
|
-
|
|
|
|
-\subsection{Types}
|
|
|
|
-The following integer types are defined in the System unit:
|
|
|
|
-\begin{verbatim}
|
|
|
|
-Shortint = -128..127;
|
|
|
|
-SmallInt = -32768..32767;
|
|
|
|
-Longint = $80000000..$7fffffff;
|
|
|
|
-byte = 0..255;
|
|
|
|
-word = 0..65535;
|
|
|
|
-dword = longword;
|
|
|
|
-cardinal = longword;
|
|
|
|
-Integer = smallint;
|
|
|
|
-\end{verbatim}
|
|
|
|
-The following types are used for the functions that need compiler magic
|
|
|
|
-such as \seep{Val} or \seep{Str}:
|
|
|
|
-\begin{verbatim}
|
|
|
|
-StrLenInt = LongInt;
|
|
|
|
-ValSInt = Longint;
|
|
|
|
-ValUInt = Cardinal;
|
|
|
|
-ValReal = Extended;
|
|
|
|
-\end{verbatim}
|
|
|
|
-The \var{Real48} type is defined to emulate the old \tp \var{Real} type:
|
|
|
|
-\begin{verbatim}
|
|
|
|
-Real48 = Array[0..5] of byte;
|
|
|
|
-\end{verbatim}
|
|
|
|
-The assignment operator has been overloaded so this type can be assigned
|
|
|
|
-to the \fpc native \var{Double} and \var{Extended} types.
|
|
|
|
-\seefl{Real2Double}{RealToDouble}.
|
|
|
|
-
|
|
|
|
-The following character types are defined for Delphi compatibility:
|
|
|
|
-\begin{verbatim}
|
|
|
|
-TAnsiChar = Char;
|
|
|
|
-AnsiChar = TAnsiChar;
|
|
|
|
-\end{verbatim}
|
|
|
|
-And the following pointer types as well:
|
|
|
|
-\begin{verbatim}
|
|
|
|
- PChar = ^char;
|
|
|
|
- pPChar = ^PChar;
|
|
|
|
- PAnsiChar = PChar;
|
|
|
|
- PQWord = ^QWord;
|
|
|
|
- PInt64 = ^Int64;
|
|
|
|
- pshortstring = ^shortstring;
|
|
|
|
- plongstring = ^longstring;
|
|
|
|
- pansistring = ^ansistring;
|
|
|
|
- pwidestring = ^widestring;
|
|
|
|
- pextended = ^extended;
|
|
|
|
- ppointer = ^pointer;
|
|
|
|
-\end{verbatim}
|
|
|
|
-For the \seef{SetJmp} and \seep{LongJmp} calls, the following jump bufer
|
|
|
|
-type is defined (for the I386 processor):
|
|
|
|
-\begin{verbatim}
|
|
|
|
- jmp_buf = record
|
|
|
|
- ebx,esi,edi : Longint;
|
|
|
|
- bp,sp,pc : Pointer;
|
|
|
|
- end;
|
|
|
|
- PJmp_buf = ^jmp_buf;
|
|
|
|
-\end{verbatim}
|
|
|
|
-The following records and pointers can be used to scan the
|
|
|
|
-entries in the string message handler tables:
|
|
|
|
-\begin{verbatim}
|
|
|
|
- tmsgstrtable = record
|
|
|
|
- name : pshortstring;
|
|
|
|
- method : pointer;
|
|
|
|
- end;
|
|
|
|
- pmsgstrtable = ^tmsgstrtable;
|
|
|
|
-
|
|
|
|
- tstringmessagetable = record
|
|
|
|
- count : dword;
|
|
|
|
- msgstrtable : array[0..0] of tmsgstrtable;
|
|
|
|
- end;
|
|
|
|
- pstringmessagetable = ^tstringmessagetable;
|
|
|
|
-\end{verbatim}
|
|
|
|
-
|
|
|
|
-The base class for all classes is defined as:
|
|
|
|
-\begin{verbatim}
|
|
|
|
-Type
|
|
|
|
- TObject = Class
|
|
|
|
- Public
|
|
|
|
- constructor create;
|
|
|
|
- destructor destroy;virtual;
|
|
|
|
- class function newinstance : tobject;virtual;
|
|
|
|
- procedure freeinstance;virtual;
|
|
|
|
- function safecallexception(exceptobject : tobject;
|
|
|
|
- exceptaddr : pointer) : longint;virtual;
|
|
|
|
- procedure defaulthandler(var message);virtual;
|
|
|
|
- procedure free;
|
|
|
|
- class function initinstance(instance : pointer) : tobject;
|
|
|
|
- procedure cleanupinstance;
|
|
|
|
- function classtype : tclass;
|
|
|
|
- class function classinfo : pointer;
|
|
|
|
- class function classname : shortstring;
|
|
|
|
- class function classnameis(const name : string) : boolean;
|
|
|
|
- class function classparent : tclass;
|
|
|
|
- class function instancesize : longint;
|
|
|
|
- class function inheritsfrom(aclass : tclass) : boolean;
|
|
|
|
- class function inheritsfrom(aclass : tclass) : boolean;
|
|
|
|
- class function stringmessagetable : pstringmessagetable;
|
|
|
|
- procedure dispatch(var message);
|
|
|
|
- procedure dispatchstr(var message);
|
|
|
|
- class function methodaddress(const name : shortstring) : pointer;
|
|
|
|
- class function methodname(address : pointer) : shortstring;
|
|
|
|
- function fieldaddress(const name : shortstring) : pointer;
|
|
|
|
- procedure AfterConstruction;virtual;
|
|
|
|
- procedure BeforeDestruction;virtual;
|
|
|
|
- procedure DefaultHandlerStr(var message);virtual;
|
|
|
|
- end;
|
|
|
|
- TClass = Class Of TObject;
|
|
|
|
- PClass = ^TClass;
|
|
|
|
-\end{verbatim}
|
|
|
|
-Unhandled exceptions can be treated using a constant of the
|
|
|
|
-\var{TExceptProc} type:
|
|
|
|
-\begin{verbatim}
|
|
|
|
-TExceptProc = Procedure (Obj : TObject; Addr,Frame: Pointer);
|
|
|
|
-\end{verbatim}
|
|
|
|
-\var{Obj} is the exception object that was used to raise the exception,
|
|
|
|
-\var{Addr} and \var{Frame} contain the exact address and stack frame
|
|
|
|
-where the exception was raised.
|
|
|
|
-
|
|
|
|
-The \var{TVarRec} type is used to access the elements passed in a \var{Array
|
|
|
|
-of Const} argument to a function or procedure:
|
|
|
|
-\begin{verbatim}
|
|
|
|
-Type
|
|
|
|
- PVarRec = ^TVarRec;
|
|
|
|
- TVarRec = record
|
|
|
|
- case VType : Longint of
|
|
|
|
- vtInteger : (VInteger: Longint);
|
|
|
|
- vtBoolean : (VBoolean: Boolean);
|
|
|
|
- vtChar : (VChar: Char);
|
|
|
|
- vtExtended : (VExtended: PExtended);
|
|
|
|
- vtString : (VString: PShortString);
|
|
|
|
- vtPointer : (VPointer: Pointer);
|
|
|
|
- vtPChar : (VPChar: PChar);
|
|
|
|
- vtObject : (VObject: TObject);
|
|
|
|
- vtClass : (VClass: TClass);
|
|
|
|
- vtAnsiString : (VAnsiString: Pointer);
|
|
|
|
- vtWideString : (VWideString: Pointer);
|
|
|
|
- vtInt64 : (VInt64: PInt64);
|
|
|
|
- end;
|
|
|
|
-\end{verbatim}
|
|
|
|
-The heap manager uses the \var{TMemoryManager} type:
|
|
|
|
-\begin{verbatim}
|
|
|
|
- PMemoryManager = ^TMemoryManager;
|
|
|
|
- TMemoryManager = record
|
|
|
|
- Getmem : Function(Size:Longint):Pointer;
|
|
|
|
- Freemem : Function(var p:pointer):Longint;
|
|
|
|
- FreememSize : Function(var p:pointer;Size:Longint):Longint;
|
|
|
|
- AllocMem : Function(Size:longint):Pointer;
|
|
|
|
- ReAllocMem : Function(var p:pointer;Size:longint):Pointer;
|
|
|
|
- MemSize : function(p:pointer):Longint;
|
|
|
|
- MemAvail : Function:Longint;
|
|
|
|
- MaxAvail : Function:Longint;
|
|
|
|
- HeapSize : Function:Longint;
|
|
|
|
- end;
|
|
|
|
-\end{verbatim}
|
|
|
|
-More information on using this record can be found in \progref.
|
|
|
|
-
|
|
|
|
-\subsection{Constants}
|
|
|
|
-The following constants define the maximum values that can be used with
|
|
|
|
-various types:
|
|
|
|
-\begin{verbatim}
|
|
|
|
- MaxSIntValue = High(ValSInt);
|
|
|
|
- MaxUIntValue = High(ValUInt);
|
|
|
|
- maxint = maxsmallint;
|
|
|
|
- maxLongint = $7fffffff;
|
|
|
|
- maxSmallint = 32767;
|
|
|
|
-\end{verbatim}
|
|
|
|
-The following constants for file-handling are defined in the system unit:
|
|
|
|
-\begin{verbatim}
|
|
|
|
-Const
|
|
|
|
- fmclosed = $D7B0;
|
|
|
|
- fminput = $D7B1;
|
|
|
|
- fmoutput = $D7B2;
|
|
|
|
- fminout = $D7B3;
|
|
|
|
- fmappend = $D7B4;
|
|
|
|
- filemode : byte = 2;
|
|
|
|
-\end{verbatim}
|
|
|
|
-
|
|
|
|
-The \var{filemode} variable is used when a non-text file is opened using
|
|
|
|
-\var{Reset}. It indicates how the file will be opened. \var{filemode} can have one of
|
|
|
|
-the following values:
|
|
|
|
-\begin{description}
|
|
|
|
-\item[0] The file is opened for reading.
|
|
|
|
-\item[1] The file is opened for writing.
|
|
|
|
-\item[2] The file is opened for reading and writing.
|
|
|
|
-\end{description}
|
|
|
|
-The default value is 2. Other values are possible but are operating system specific.
|
|
|
|
-
|
|
|
|
-Further, the following non processor specific general-purpose constants
|
|
|
|
-are also defined:
|
|
|
|
-\begin{verbatim}
|
|
|
|
-const
|
|
|
|
- erroraddr : pointer = nil;
|
|
|
|
- errorcode : word = 0;
|
|
|
|
- { max level in dumping on error }
|
|
|
|
- max_frame_dump : word = 20;
|
|
|
|
-\end{verbatim}
|
|
|
|
-\begin{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.
|
|
|
|
-\end{remark}
|
|
|
|
-The following constants are defined to access VMT entries:
|
|
|
|
-\begin{verbatim}
|
|
|
|
- vmtInstanceSize = 0;
|
|
|
|
- vmtParent = 8;
|
|
|
|
- vmtClassName = 12;
|
|
|
|
- vmtDynamicTable = 16;
|
|
|
|
- vmtMethodTable = 20;
|
|
|
|
- vmtFieldTable = 24;
|
|
|
|
- vmtTypeInfo = 28;
|
|
|
|
- vmtInitTable = 32;
|
|
|
|
- vmtAutoTable = 36;
|
|
|
|
- vmtIntfTable = 40;
|
|
|
|
- vmtMsgStrPtr = 44;
|
|
|
|
- vmtMethodStart = 48;
|
|
|
|
- vmtDestroy = vmtMethodStart;
|
|
|
|
- vmtNewInstance = vmtMethodStart+4;
|
|
|
|
- vmtFreeInstance = vmtMethodStart+8;
|
|
|
|
- vmtSafeCallException = vmtMethodStart+12;
|
|
|
|
- vmtDefaultHandler = vmtMethodStart+16;
|
|
|
|
- vmtAfterConstruction = vmtMethodStart+20;
|
|
|
|
- vmtBeforeDestruction = vmtMethodStart+24;
|
|
|
|
- vmtDefaultHandlerStr = vmtMethodStart+28;
|
|
|
|
-\end{verbatim}
|
|
|
|
-The constant names should be used, and never their values, because
|
|
|
|
-the VMT table can change, breaking code that uses direct values.
|
|
|
|
-
|
|
|
|
-The following constants will be used for the planned \var{variant} support:
|
|
|
|
-\begin{verbatim}
|
|
|
|
- varEmpty = $0000;
|
|
|
|
- varNull = $0001;
|
|
|
|
- varSmallint = $0002;
|
|
|
|
- varInteger = $0003;
|
|
|
|
- varSingle = $0004;
|
|
|
|
- varDouble = $0005;
|
|
|
|
- varCurrency = $0006;
|
|
|
|
- varDate = $0007;
|
|
|
|
- varOleStr = $0008;
|
|
|
|
- varDispatch = $0009;
|
|
|
|
- varError = $000A;
|
|
|
|
- varBoolean = $000B;
|
|
|
|
- varVariant = $000C;
|
|
|
|
- varUnknown = $000D;
|
|
|
|
- varByte = $0011;
|
|
|
|
- varString = $0100;
|
|
|
|
- varAny = $0101;
|
|
|
|
- varTypeMask = $0FFF;
|
|
|
|
- varArray = $2000;
|
|
|
|
- varByRef = $4000;
|
|
|
|
-\end{verbatim}
|
|
|
|
-The following constants are used in the \var{TVarRec} record:
|
|
|
|
-\begin{verbatim}
|
|
|
|
-vtInteger = 0;
|
|
|
|
-vtBoolean = 1;
|
|
|
|
-vtChar = 2;
|
|
|
|
-vtExtended = 3;
|
|
|
|
-vtString = 4;
|
|
|
|
-vtPointer = 5;
|
|
|
|
-vtPChar = 6;
|
|
|
|
-vtObject = 7;
|
|
|
|
-vtClass = 8;
|
|
|
|
-vtWideChar = 9;
|
|
|
|
-vtPWideChar = 10;
|
|
|
|
-vtAnsiString = 11;
|
|
|
|
-vtCurrency = 12;
|
|
|
|
-vtVariant = 13;
|
|
|
|
-vtInterface = 14;
|
|
|
|
-vtWideString = 15;
|
|
|
|
-vtInt64 = 16;
|
|
|
|
-vtQWord = 17;
|
|
|
|
-\end{verbatim}
|
|
|
|
-The \var{ExceptProc} is called when an unhandled exception occurs:
|
|
|
|
-\begin{verbatim}
|
|
|
|
-Const
|
|
|
|
- ExceptProc : TExceptProc = Nil;
|
|
|
|
-\end{verbatim}
|
|
|
|
-It is set in the \file{objpas} unit, but it can be set by the programmer
|
|
|
|
-to change the default exception handling.
|
|
|
|
-
|
|
|
|
-The following constants are defined to describe the operating system's file
|
|
|
|
-system:
|
|
|
|
-\begin{verbatim}
|
|
|
|
-LineEnding = #10;
|
|
|
|
-LFNSupport = true;
|
|
|
|
-DirectorySeparator = '/';
|
|
|
|
-DriveSeparator = ':';
|
|
|
|
-PathSeparator = ':';
|
|
|
|
-FileNameCaseSensitive : Boolean = True;
|
|
|
|
-\end{verbatim}
|
|
|
|
-The shown values are for \unix platforms, but will be different on other
|
|
|
|
-platforms.
|
|
|
|
-The meaning of the constants is the following:
|
|
|
|
-\begin{description}
|
|
|
|
-\item[LineEnding] End of line marker. This constant is used when writing end
|
|
|
|
-of lines to text files.
|
|
|
|
-\item[LFNSupport] This is \var{True} if the system supports long file names,
|
|
|
|
-i.e. filenames that are not restricted to 8.3 characters.
|
|
|
|
-\item[DirectorySeparator] The character that is used as a directory
|
|
|
|
-separator, i.e. it appears between various parts of a path to a file.
|
|
|
|
-\item[DriveSeparator] On systems that support drive letters, this character
|
|
|
|
-separates the drive indication from the rest of a filename.
|
|
|
|
-\item[PathSeparator] This character can be found between elements in a
|
|
|
|
-series of paths (such as the contents of the \var{PATH} environment
|
|
|
|
-variable.
|
|
|
|
-\item[FileNameCaseSensitive] Indicates whether filenames are case sensitive.
|
|
|
|
-\end{description}
|
|
|
|
-When programming cross-platform, use these constants instead of hard-coded
|
|
|
|
-characters. This will enhance portability of an application.
|
|
|
|
-
|
|
|
|
-\subsection{Variables}
|
|
|
|
-The following variables are defined and initialized in the system unit:
|
|
|
|
-\begin{verbatim}
|
|
|
|
-var
|
|
|
|
- output,input,stderr : text;
|
|
|
|
- exitproc : pointer;
|
|
|
|
- exitcode : word;
|
|
|
|
- stackbottom : Cardinal;
|
|
|
|
-\end{verbatim}
|
|
|
|
-The variables \var{ExitProc}, \var{exitcode} are used in the \fpc exit
|
|
|
|
-scheme. It works similarly to the one in Turbo Pascal:
|
|
|
|
-
|
|
|
|
-When a program halts (be it through the call of the \var{Halt} function or
|
|
|
|
-\var{Exit} or through a run-time error), the exit mechanism checks the value
|
|
|
|
-of \var{ExitProc}. If this one is non-\var{Nil}, it is set to \var{Nil}, and
|
|
|
|
-the procedure is called. If the exit procedure exits, the value of ExitProc
|
|
|
|
-is checked again. If it is non-\var{Nil} then the above steps are repeated.
|
|
|
|
-So when an exit procedure must be installed, the old value of \var{ExitProc}
|
|
|
|
-should be saved (it may be non-\var{Nil}, since other units could have set
|
|
|
|
-it). In the exit procedure the value of \var{ExitProc} should be restored to
|
|
|
|
-the previous value, such that if it was non-\var{Nil} the exit-procedure can be
|
|
|
|
-called.
|
|
|
|
-
|
|
|
|
-\FPCexample{ex98}
|
|
|
|
-
|
|
|
|
-The \var{ErrorAddr} and \var{ExitCode} can be used to check for
|
|
|
|
-error-conditions. If \var{ErrorAddr} is non-\var{Nil}, a run-time error has
|
|
|
|
-occurred. If so, \var{ExitCode} contains the error code. If \var{ErrorAddr} is
|
|
|
|
-\var{Nil}, then {ExitCode} contains the argument to \var{Halt} or 0 if the
|
|
|
|
-program terminated normally.
|
|
|
|
-
|
|
|
|
-\var{ExitCode} is always passed to the operating system as the exit-code of
|
|
|
|
-the current process.
|
|
|
|
-
|
|
|
|
-\begin{remark}
|
|
|
|
-The maximum error code under \linux and \unix like operating systems is 127.
|
|
|
|
-\end{remark}
|
|
|
|
-
|
|
|
|
-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.
|
|
|
|
-
|
|
|
|
-The randomize function uses a seed stored in the \var{RandSeed} variable:
|
|
|
|
-\begin{verbatim}
|
|
|
|
- RandSeed : Cardinal;
|
|
|
|
-\end{verbatim}
|
|
|
|
-This variable is initialized in the initialization code of the system unit.
|
|
|
|
-
|
|
|
|
-Other variables indicate the state of the application.
|
|
|
|
-\begin{verbatim}
|
|
|
|
- IsLibrary : boolean;
|
|
|
|
- IsMultiThread : boolean;
|
|
|
|
-\end{verbatim}
|
|
|
|
-The \var{IsLibrary} variable is set to true if this module is a
|
|
|
|
-shared library instead of an application. The \var{IsMultiThread}
|
|
|
|
-variable is set to True if the application has spawned other
|
|
|
|
-threads, otherwise, and by default, it is set to False.
|
|
|
|
-
|
|
|
|
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
-% Functions and Procedures by category
|
|
|
|
-\section{Function list by category}
|
|
|
|
-What follows is a listing of the available functions, grouped by category.
|
|
|
|
-For each function there is a reference to the page where the
|
|
|
|
-function can be found:
|
|
|
|
-\subsection{File handling}
|
|
|
|
-Functions concerning input and output from and to file.
|
|
|
|
-\begin{funclist}
|
|
|
|
-\procref{Append}{Open a file in append mode}
|
|
|
|
-\procref{Assign}{Assign a name to a file}
|
|
|
|
-\procref{Blockread}{Read data from a file into memory}
|
|
|
|
-\procref{Blockwrite}{Write data from memory to a file}
|
|
|
|
-\procref{Close}{Close a file}
|
|
|
|
-\funcref{Eof}{Check for end of file}
|
|
|
|
-\funcref{Eoln}{Check for end of line}
|
|
|
|
-\procref{Erase}{Delete file from disk}
|
|
|
|
-\funcref{Filepos}{Position in file}
|
|
|
|
-\funcref{Filesize}{Size of file}
|
|
|
|
-\procref{Flush}{Write file buffers to disk}
|
|
|
|
-\funcref{IOresult}{Return result of last file IO operation}
|
|
|
|
-\procref{Read}{Read from file into variable}
|
|
|
|
-\procref{Readln}{Read from file into variable and goto next line}
|
|
|
|
-\procref{Rename}{Rename file on disk}
|
|
|
|
-\procref{Reset}{Open file for reading}
|
|
|
|
-\procref{Rewrite}{Open file for writing}
|
|
|
|
-\procref{Seek}{Set file position}
|
|
|
|
-\funcref{SeekEof}{Set file position to end of file}
|
|
|
|
-\funcref{SeekEoln}{Set file position to end of line}
|
|
|
|
-\procref{SetTextBuf}{Set size of file buffer}
|
|
|
|
-\procref{Truncate}{Truncate the file at position}
|
|
|
|
-\procref{Write}{Write variable to file}
|
|
|
|
-\procref{WriteLn}{Write variable to file and append newline}
|
|
|
|
-\end{funclist}
|
|
|
|
-
|
|
|
|
-\subsection{Memory management}
|
|
|
|
-Functions concerning memory issues.
|
|
|
|
-\begin{funclist}
|
|
|
|
-\funcref{Addr}{Return address of variable}
|
|
|
|
-\funcref{Assigned}{Check if a pointer is valid}
|
|
|
|
-\funcref{CompareByte}{Compare 2 memory buffers byte per byte}
|
|
|
|
-\funcref{CompareChar}{Compare 2 memory buffers byte per byte}
|
|
|
|
-\funcref{CompareDWord}{Compare 2 memory buffers byte per byte}
|
|
|
|
-\funcref{CompareWord}{Compare 2 memory buffers byte per byte}
|
|
|
|
-\funcref{CSeg}{Return code segment}
|
|
|
|
-\procref{Dispose}{Free dynamically allocated memory}
|
|
|
|
-\funcref{DSeg}{Return data segment}
|
|
|
|
-\procref{FillByte}{Fill memory region with 8-bit pattern}
|
|
|
|
-\procref{Fillchar}{Fill memory region with certain character}
|
|
|
|
-\procref{FillDWord}{Fill memory region with 32-bit pattern}
|
|
|
|
-\procref{Fillword}{Fill memory region with 16-bit pattern}
|
|
|
|
-\procref{Freemem}{Release allocated memory}
|
|
|
|
-\procref{Getmem}{Allocate new memory}
|
|
|
|
-\procref{GetMemoryManager}{Return current memory manager}
|
|
|
|
-\funcref{High}{Return highest index of open array or enumerated}
|
|
|
|
-\funcref{IsMemoryManagerSet}{Is the memory manager set}
|
|
|
|
-\funcref{Low}{Return lowest index of open array or enumerated}
|
|
|
|
-\procref{Mark}{Mark current memory position}
|
|
|
|
-\funcref{Maxavail}{Return size of largest free memory block}
|
|
|
|
-\funcref{Memavail}{Return total available memory}
|
|
|
|
-\procref{Move}{Move data from one location in memory to another}
|
|
|
|
-\procrefl{MoveChar0}{MoveCharNull}{Move data till first zero character}
|
|
|
|
-\procref{New}{Dynamically allocate memory for variable}
|
|
|
|
-\funcref{Ofs}{Return offset of variable}
|
|
|
|
-\funcref{Ptr}{Combine segment and offset to pointer}
|
|
|
|
-\funcref{ReAllocMem}{Resize a memory block on the heap}
|
|
|
|
-\procref{Release}{Release memory above mark point}
|
|
|
|
-\funcref{Seg}{Return segment}
|
|
|
|
-\procref{SetMemoryManager}{Set a memory manager}
|
|
|
|
-\funcref{Sptr}{Return current stack pointer}
|
|
|
|
-\funcref{SSeg}{Return stack segment register value}
|
|
|
|
-\end{funclist}
|
|
|
|
-
|
|
|
|
-\subsection{Mathematical routines}
|
|
|
|
-Functions connected to calculating and coverting numbers.
|
|
|
|
-\begin{funclist}
|
|
|
|
-\funcref{Abs}{Calculate absolute value}
|
|
|
|
-\funcref{Arctan}{Calculate inverse tangent}
|
|
|
|
-\funcref{Cos}{Calculate cosine of angle}
|
|
|
|
-\procref{Dec}{Decrease value of variable}
|
|
|
|
-\funcref{Exp}{Exponentiate}
|
|
|
|
-\funcref{Frac}{Return fractional part of floating point value}
|
|
|
|
-\funcref{Hi}{Return high byte/word of value}
|
|
|
|
-\procref{Inc}{Increase value of variable}
|
|
|
|
-\funcref{Int}{Calculate integer part of floating point value}
|
|
|
|
-\funcref{Ln}{Calculate logarithm}
|
|
|
|
-\funcref{Lo}{Return low byte/word of value}
|
|
|
|
-\funcref{Odd}{Is a value odd or even ? }
|
|
|
|
-\funcref{Pi}{Return the value of pi}
|
|
|
|
-\funcref{Power}{Raise float to integer power}
|
|
|
|
-\funcref{Random}{Generate random number}
|
|
|
|
-\procref{Randomize}{Initialize random number generator}
|
|
|
|
-\funcref{Round}{Round floating point value to nearest integer number}
|
|
|
|
-\funcref{Sin}{Calculate sine of angle}
|
|
|
|
-\funcref{Sqr}{Calculate the square of a value}
|
|
|
|
-\funcref{Sqrt}{Calculate the square root of a value}
|
|
|
|
-\funcref{Swap}{Swap high and low bytes/words of a variable}
|
|
|
|
-\funcref{Trunc}{Truncate a floating point value}
|
|
|
|
-\end{funclist}
|
|
|
|
-
|
|
|
|
-\subsection{String handling}
|
|
|
|
-All things connected to string handling.
|
|
|
|
-\begin{funclist}
|
|
|
|
-\funcref{BinStr}{Construct binary representation of integer}
|
|
|
|
-\funcref{Chr}{Convert ASCII code to character}
|
|
|
|
-\funcref{Concat}{Concatenate two strings}
|
|
|
|
-\funcref{Copy}{Copy part of a string}
|
|
|
|
-\procref{Delete}{Delete part of a string}
|
|
|
|
-\funcref{HexStr}{Construct hexadecimal representation of integer}
|
|
|
|
-\procref{Insert}{Insert one string in another}
|
|
|
|
-\funcref{Length}{Return length of string}
|
|
|
|
-\funcref{Lowercase}{Convert string to all-lowercase}
|
|
|
|
-\funcref{OctStr}{Construct octal representation of integer}
|
|
|
|
-\funcref{Pos}{Calculate position of one string in another}
|
|
|
|
-\procref{SetLength}{Set length of a string}
|
|
|
|
-\procref{SetString}{Set contents and length of a string}
|
|
|
|
-\procref{Str}{Convert number to string representation}
|
|
|
|
-\funcref{StringOfChar}{Create string consisting of a number of characters}
|
|
|
|
-\funcref{Upcase}{Convert string to all-uppercase}
|
|
|
|
-\procref{Val}{Convert string to number}
|
|
|
|
-\end{funclist}
|
|
|
|
-
|
|
|
|
-\subsection{Operating System functions}
|
|
|
|
-Functions that are connected to the operating system.
|
|
|
|
-\begin{funclist}
|
|
|
|
-\procref{Chdir}{Change working directory}
|
|
|
|
-\procref{Getdir}{Return current working directory}
|
|
|
|
-\procref{Halt}{Halt program execution}
|
|
|
|
-\funcref{Paramcount}{Number of parameters with which program was called}
|
|
|
|
-\funcref{Paramstr}{Retrieve parameters with which program was called}
|
|
|
|
-\procref{Mkdir}{Make a directory}
|
|
|
|
-\procref{Rmdir}{Remove a directory}
|
|
|
|
-\procref{Runerror}{Abort program execution with error condition}
|
|
|
|
-\end{funclist}
|
|
|
|
-
|
|
|
|
-\subsection{Miscellaneous functions}
|
|
|
|
-Functions that do not belong in one of the other categories.
|
|
|
|
-\begin{funclist}
|
|
|
|
-\procref{Assert}{Conditionally abort program with error}
|
|
|
|
-\procref{Break}{Abort current loop}
|
|
|
|
-\procref{Continue}{Next cycle in current loop}
|
|
|
|
-\procref{Exclude}{Exclude an element from a set}
|
|
|
|
-\procref{Exit}{Exit current function or procedure}
|
|
|
|
-\procref{Include}{Include an element into a set}
|
|
|
|
-\procref{LongJmp}{Jump to execution point}
|
|
|
|
-\funcref{Ord}{Return ordinal value of enumerated type}
|
|
|
|
-\funcref{Pred}{Return previous value of ordinal type}
|
|
|
|
-\funcref{SetJmp}{Mark execution point for jump}
|
|
|
|
-\funcref{SizeOf}{Return size of variable or type}
|
|
|
|
-\funcref{Succ}{Return next value of ordinal type}
|
|
|
|
-\end{funclist}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
-% Functions and Procedures
|
|
|
|
-\section{Functions and Procedures}
|
|
|
|
-
|
|
|
|
-\begin{function}{Abs}
|
|
|
|
-\Declaration
|
|
|
|
-Function Abs (X : Every numerical type) : Every numerical type;
|
|
|
|
-\Description
|
|
|
|
-\var{Abs} returns the absolute value of a variable. The result of the
|
|
|
|
-function has the same type as its argument, which can be any numerical
|
|
|
|
-type.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Round}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex1}
|
|
|
|
-
|
|
|
|
-\begin{function}{Addr}
|
|
|
|
-\Declaration
|
|
|
|
-Function Addr (X : Any type) : Pointer;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Addr} returns a pointer to its argument, which can be any type, or a
|
|
|
|
-function or procedure name. The returned pointer isn't typed.
|
|
|
|
-The same result can be obtained by the \var{@} operator, which can return a
|
|
|
|
-typed pointer (\progref).
|
|
|
|
-\Errors
|
|
|
|
-None
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{SizeOf}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex2}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Append}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Append (Var F : Text);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Append} opens an existing file in append mode. Any data written to
|
|
|
|
-\var{F} will be appended to the file. Only text files can be opened in
|
|
|
|
-append mode. After a call to \var{Append}, the file \var{F} becomes
|
|
|
|
-write-only.
|
|
|
|
-
|
|
|
|
-File sharing is not taken into account when calling \var{Append}.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-If the file doesn't exist when appending, a run-time error will be generated.
|
|
|
|
-This behaviour has changed on Windows and Linux platforms, where in versions
|
|
|
|
-prior to 1.0.6, the file would be created in append mode.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Rewrite},\seep{Close}, \seep{Reset}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex3}
|
|
|
|
-
|
|
|
|
-\begin{function}{Arctan}
|
|
|
|
-\Declaration
|
|
|
|
-Function Arctan (X : Real) : Real;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Arctan} returns the Arctangent of \var{X}, which can be any Real type.
|
|
|
|
-The resulting angle is in radial units.
|
|
|
|
-\Errors
|
|
|
|
-None
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Sin}, \seef{Cos}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex4}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Assert}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Assert(expr : Boolean [; const msg: string]);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-With assertions on, \var{Assert} tests if \var{expr} is
|
|
|
|
-false, and if so, aborts the application with a Runtime error
|
|
|
|
-227 and an optional error message in \var{msg}.
|
|
|
|
-If \var{expr} is true, program execution continues normally.
|
|
|
|
-
|
|
|
|
-If assertions are not enabled at compile time, this routine does
|
|
|
|
-nothing, and no code is generated for the \var{Assert} call.
|
|
|
|
-
|
|
|
|
-Enabling and disabling assertions at compile time is done via
|
|
|
|
-the \var{\$C} or \var{\$ASSERTIONS} compiler switches. These are
|
|
|
|
-global switches.
|
|
|
|
-
|
|
|
|
-The default behavior of the assert call can be changed by
|
|
|
|
-setting a new handler in the \var{AssertErrorProc} variable.
|
|
|
|
-Sysutils overrides the default handler to raise a \var{EAssertionFailed}
|
|
|
|
-exception.
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Halt}, \seep{Runerror}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Assign}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Assign (Var F; Name : String);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Assign} assigns a name to \var{F}, which can be any file type.
|
|
|
|
-This call doesn't open the file, it just assigns a name to a file variable,
|
|
|
|
-and marks the file as closed.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Reset}, \seep{Rewrite}, \seep{Append}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex5}
|
|
|
|
-
|
|
|
|
-\begin{function}{Assigned}
|
|
|
|
-\Declaration
|
|
|
|
-Function Assigned (P : Pointer) : Boolean;
|
|
|
|
-\Description
|
|
|
|
-\var{Assigned} returns \var{True} if \var{P} is non-nil
|
|
|
|
-and retuns \var{False} of \var{P} is nil.
|
|
|
|
-The main use of Assigned is that Procedural variables, method variables and
|
|
|
|
-class-type variables also can be passed to \var{Assigned}.
|
|
|
|
-\Errors
|
|
|
|
-None
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{New}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex96}
|
|
|
|
-
|
|
|
|
-\begin{function}{BinStr}
|
|
|
|
-\Declaration
|
|
|
|
-Function BinStr (Value : longint; cnt : byte) : String;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{BinStr} returns a string with the binary representation
|
|
|
|
-of \var{Value}. The string has at most \var{cnt} characters.
|
|
|
|
-(i.e. only the \var{cnt} rightmost bits are taken into account)
|
|
|
|
-To have a complete representation of any longint-type value, 32
|
|
|
|
-bits are needed, i.e. \var{cnt=32}
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Str},\seep{Val},\seef{HexStr}, \seef{OctStr}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex82}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Blockread}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Blockread (Var F : File; Var Buffer; Var Count : Longint [; var
|
|
|
|
-Result : Longint]);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Blockread} reads \var{count} or less records from file \var{F}. A
|
|
|
|
-record is a block of bytes with size specified by the \seep{Rewrite} or
|
|
|
|
-\seep{Reset} statement.
|
|
|
|
-
|
|
|
|
-The result is placed in \var{Buffer}, which must contain enough room for
|
|
|
|
-\var{Count} records. The function cannot read partial records.
|
|
|
|
-If \var{Result} is specified, it contains the number of records actually
|
|
|
|
-read. If \var{Result} isn't specified, and less than \var{Count} records were
|
|
|
|
-read, a run-time error is generated. This behavior can be controlled by the
|
|
|
|
-\var{\{\$i\}} switch.
|
|
|
|
-\Errors
|
|
|
|
-Depending on the state of the \var{\{\$I\}} switch, a runtime error can be
|
|
|
|
-generated if there is an error. In the \var{\{\$I-\}} state, use \var{IOResult}
|
|
|
|
-to check for errors.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Blockwrite}, \seep{Close}, \seep{Reset}, \seep{Assign}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex6}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Blockwrite}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Blockwrite (Var F : File; Var Buffer; Var Count : Longint);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{BlockWrite} writes \var{count} records from \var{buffer} to the file
|
|
|
|
- \var{F}.A record is a block of bytes with size specified by the \seep{Rewrite} or
|
|
|
|
-\seep{Reset} statement.
|
|
|
|
-
|
|
|
|
-If the records couldn't be written to disk, a run-time error is generated.
|
|
|
|
-This behavior can be controlled by the \var{\{\$i\}} switch.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-Depending on the state of the \var{\{\$I\}} switch, a runtime error can be
|
|
|
|
-generated if there is an error. In the \var{\{\$I-\}} state, use \var{IOResult}
|
|
|
|
-to check for errors.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Blockread},\seep{Close}, \seep{Rewrite}, \seep{Assign}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-For the example, see \seep{Blockread}.
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Break}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Break;
|
|
|
|
-\Description
|
|
|
|
-\var{Break} jumps to the statement following the end of the current
|
|
|
|
-repetitive statement. The code between the \var{Break} call and
|
|
|
|
-the end of the repetitive statement is skipped.
|
|
|
|
-The condition of the repetitive statement is NOT evaluated.
|
|
|
|
-
|
|
|
|
-This can be used with \var{For}, var{repeat} and \var{While} statements.
|
|
|
|
-
|
|
|
|
-Note that while this is a procedure, \var{Break} is a reserved word
|
|
|
|
-and hence cannot be redefined.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Continue}, \seep{Exit}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex87}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Chdir}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Chdir (const S : string);
|
|
|
|
-\Description
|
|
|
|
-\var{Chdir} changes the working directory of the process to \var{S}.
|
|
|
|
-\Errors
|
|
|
|
-\Errors
|
|
|
|
-Depending on the state of the \var{\{\$I\}} switch, a runtime error can be
|
|
|
|
-generated if there is an error. In the \var{\{\$I-\}} state, use \var{IOResult}
|
|
|
|
-to check for errors.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Mkdir}, \seep{Rmdir}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex7}
|
|
|
|
-
|
|
|
|
-\begin{function}{Chr}
|
|
|
|
-\Declaration
|
|
|
|
-Function Chr (X : byte) : Char;
|
|
|
|
-\Description
|
|
|
|
-\var{Chr} returns the character which has ASCII value \var{X}.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Ord}, \seep{Str}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex8}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Close}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Close (Var F : Anyfiletype);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Close} flushes the buffer of the file \var{F} and closes \var{F}.
|
|
|
|
-After a call to \var{Close}, data can no longer be read from or written to
|
|
|
|
-\var{F}.
|
|
|
|
-To reopen a file closed with \var{Close}, it isn't necessary to assign the
|
|
|
|
-file again. A call to \seep{Reset} or \seep{Rewrite} is sufficient.
|
|
|
|
-\Errors
|
|
|
|
-Depending on the state of the \var{\{\$I\}} switch, a runtime error can be
|
|
|
|
-generated if there is an error. In the \var{\{\$I-\}} state, use \var{IOResult}
|
|
|
|
-to check for errors.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Assign}, \seep{Reset}, \seep{Rewrite}, \seep{Flush}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex9}
|
|
|
|
-
|
|
|
|
-\begin{function}{CompareByte}
|
|
|
|
-\Declaration
|
|
|
|
-function CompareByte(var buf1,buf2;len:longint):longint;
|
|
|
|
-\Description
|
|
|
|
-\var{CompareByte} compares two memory regions \var{buf1},\var{buf2} on a
|
|
|
|
-byte-per-byte basis for a total of \var{len} bytes.
|
|
|
|
-
|
|
|
|
-The function returns one of the following values:
|
|
|
|
-\begin{description}
|
|
|
|
-\item[less than 0] if \var{buf1} and \var{buf2} contain different bytes
|
|
|
|
-in the first \var{len} bytes, and the first such byte is smaller in \var{buf1}
|
|
|
|
-than the byte at the same position in \var{buf2}.
|
|
|
|
-\item[0] if the first \var{len} bytes in \var{buf1} and \var{buf2} are
|
|
|
|
-equal.
|
|
|
|
-\item [greater than 0] if \var{buf1} and \var{buf2} contain different bytes
|
|
|
|
-in the first \var{len} bytes, and the first such byte is larger in \var{buf1}
|
|
|
|
-than the byte at the same position in \var{buf2}.
|
|
|
|
-\end{description}
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{CompareChar},\seef{CompareWord},\seef{CompareDWord}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex99}
|
|
|
|
-
|
|
|
|
-\begin{function}{CompareChar}
|
|
|
|
-\Declaration
|
|
|
|
-function CompareChar(var buf1,buf2;len:longint):longint;
|
|
|
|
-function CompareChar0(var buf1,buf2;len:longint):longint;
|
|
|
|
-\Description
|
|
|
|
-\var{CompareChar} compares two memory regions \var{buf1},\var{buf2} on a
|
|
|
|
-character-per-character basis for a total of \var{len} characters.
|
|
|
|
-
|
|
|
|
-The \var{CompareChar0} variant compares \var{len} bytes, or until
|
|
|
|
-a zero character is found.
|
|
|
|
-
|
|
|
|
-The function returns one of the following values:
|
|
|
|
-\begin{description}
|
|
|
|
-\item[-1] if \var{buf1} and \var{buf2} contain different characters
|
|
|
|
-in the first \var{len} positions, and the first such character is smaller in \var{buf1}
|
|
|
|
-than the character at the same position in \var{buf2}.
|
|
|
|
-\item[0] if the first \var{len} characters in \var{buf1} and \var{buf2} are
|
|
|
|
-equal.
|
|
|
|
-\item [1] if \var{buf1} and \var{buf2} contain different characters
|
|
|
|
-in the first \var{len} positions, and the first such character is larger in
|
|
|
|
-\var{buf1} than the character at the same position in \var{buf2}.
|
|
|
|
-\end{description}
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{CompareByte},\seef{CompareWord},\seef{CompareDWord}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex100}
|
|
|
|
-
|
|
|
|
-\begin{function}{CompareDWord}
|
|
|
|
-\Declaration
|
|
|
|
-function CompareDWord(var buf1,buf2;len:longint):longint;
|
|
|
|
-\Description
|
|
|
|
-\var{CompareDWord} compares two memory regions \var{buf1},\var{buf2} on a
|
|
|
|
-DWord-per-DWord basis for a total of \var{len} DWords. (A DWord is 4 bytes).
|
|
|
|
-
|
|
|
|
-The function returns one of the following values:
|
|
|
|
-\begin{description}
|
|
|
|
-\item[-1] if \var{buf1} and \var{buf2} contain different DWords
|
|
|
|
-in the first \var{len} DWords, and the first such DWord is smaller in \var{buf1}
|
|
|
|
-than the DWord at the same position in \var{buf2}.
|
|
|
|
-\item[0] if the first \var{len} DWords in \var{buf1} and \var{buf2} are
|
|
|
|
-equal.
|
|
|
|
-\item [1] if \var{buf1} and \var{buf2} contain different DWords
|
|
|
|
-in the first \var{len} DWords, and the first such DWord is larger in \var{buf1}
|
|
|
|
-than the DWord at the same position in \var{buf2}.
|
|
|
|
-\end{description}
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{CompareChar},\seef{CompareByte},\seef{CompareWord},
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex101}
|
|
|
|
-
|
|
|
|
-\begin{function}{CompareWord}
|
|
|
|
-\Declaration
|
|
|
|
-function CompareWord(var buf1,buf2;len:longint):longint;
|
|
|
|
-\Description
|
|
|
|
-\var{CompareWord} compares two memory regions \var{buf1},\var{buf2} on a
|
|
|
|
-Word-per-Word basis for a total of \var{len} Words. (A Word is 2 bytes).
|
|
|
|
-
|
|
|
|
-The function returns one of the following values:
|
|
|
|
-\begin{description}
|
|
|
|
-\item[-1] if \var{buf1} and \var{buf2} contain different Words
|
|
|
|
-in the first \var{len} Words, and the first such Word is smaller in \var{buf1}
|
|
|
|
-than the Word at the same position in \var{buf2}.
|
|
|
|
-\item[0] if the first \var{len} Words in \var{buf1} and \var{buf2} are
|
|
|
|
-equal.
|
|
|
|
-\item [1] if \var{buf1} and \var{buf2} contain different Words
|
|
|
|
-in the first \var{len} Words, and the first such Word is larger in \var{buf1}
|
|
|
|
-than the Word at the same position in \var{buf2}.
|
|
|
|
-\end{description}
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{CompareChar},\seef{CompareByte},\seef{CompareWord},
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex102}
|
|
|
|
-
|
|
|
|
-\begin{function}{Concat}
|
|
|
|
-\Declaration
|
|
|
|
-Function Concat (S1,S2 [,S3, ... ,Sn]) : String;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Concat} concatenates the strings \var{S1},\var{S2} etc. to one long
|
|
|
|
-string. The resulting string is truncated at a length of 255 bytes.
|
|
|
|
-The same operation can be performed with the \var{+} operation.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Copy}, \seep{Delete}, \seep{Insert}, \seef{Pos}, \seef{Length}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex10}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Continue}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Continue;
|
|
|
|
-\Description
|
|
|
|
-\var{Continue} jumps to the end of the current repetitive statement.
|
|
|
|
-The code between the \var{Continue} call and the end of the repetitive
|
|
|
|
-statement is skipped. The condition of the repetitive statement is then
|
|
|
|
-checked again.
|
|
|
|
-
|
|
|
|
-This can be used with \var{For}, var{repeat} and \var{While} statements.
|
|
|
|
-
|
|
|
|
-Note that while this is a procedure, \var{Continue} is a reserved word
|
|
|
|
-and hence cannot be redefined.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Break}, \seep{Exit}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex86}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-\begin{function}{Copy}
|
|
|
|
-\Declaration
|
|
|
|
-Function Copy (Const S : String;Index : Integer;Count : Integer) : String;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Copy} returns a string which is a copy if the \var{Count} characters
|
|
|
|
-in \var{S}, starting at position \var{Index}. If \var{Count} is larger than
|
|
|
|
-the length of the string \var{S}, the result is truncated.
|
|
|
|
-If \var{Index} is larger than the length of the string \var{S}, then an
|
|
|
|
-empty string is returned.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Delete}, \seep{Insert}, \seef{Pos}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex11}
|
|
|
|
-
|
|
|
|
-\begin{function}{Cos}
|
|
|
|
-\Declaration
|
|
|
|
-Function Cos (X : Real) : Real;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Cos} returns the cosine of \var{X}, where X is an angle, in radians.
|
|
|
|
-
|
|
|
|
-If the absolute value of the argument is larger than \var{2\^{}63}, then the
|
|
|
|
-result is undefined.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Arctan}, \seef{Sin}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex12}
|
|
|
|
-
|
|
|
|
-\begin{function}{CSeg}
|
|
|
|
-\Declaration
|
|
|
|
-Function CSeg : Word;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{CSeg} returns the Code segment register. In \fpc, it returns always a
|
|
|
|
-zero, since \fpc is a 32 bit compiler.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{DSeg}, \seef{Seg}, \seef{Ofs}, \seef{Ptr}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex13}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Dec}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Dec (Var X : Any ordinal type[; Decrement : Any ordinal type]);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Dec} decreases the value of \var{X} with \var{Decrement}.
|
|
|
|
-If \var{Decrement} isn't specified, then 1 is taken as a default.
|
|
|
|
-\Errors
|
|
|
|
-A range check can occur, or an underflow error, if an attempt it made
|
|
|
|
-to decrease \var{X} below its minimum value.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Inc}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex14}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Delete}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Delete (var S : string;Index : Integer;Count : Integer);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Delete} removes \var{Count} characters from string \var{S}, starting
|
|
|
|
-at position \var{Index}. All characters after the delected characters are
|
|
|
|
-shifted \var{Count} positions to the left, and the length of the string is adjusted.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Copy},\seef{Pos},\seep{Insert}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex15}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Dispose}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Dispose (P : pointer);\\
|
|
|
|
-Procedure Dispose (P : Typed Pointer; Des : Procedure);
|
|
|
|
-\Description
|
|
|
|
-The first form \var{Dispose} releases the memory allocated with a call to
|
|
|
|
-\seep{New}. The pointer \var{P} must be typed. The released memory is
|
|
|
|
-returned to the heap.
|
|
|
|
-
|
|
|
|
-The second form of \var{Dispose} accepts as a first parameter a pointer
|
|
|
|
-to an object type, and as a second parameter the name of a destructor
|
|
|
|
-of this object. The destructor will be called, and the memory allocated
|
|
|
|
-for the object will be freed.
|
|
|
|
-\Errors
|
|
|
|
-An runtime error will occur if the pointer doesn't point to a location in the
|
|
|
|
-heap.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{New}, \seep{Getmem}, \seep{Freemem}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex16}
|
|
|
|
-
|
|
|
|
-\begin{function}{DSeg}
|
|
|
|
-\Declaration
|
|
|
|
-Function DSeg : Word;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{DSeg} returns the data segment register. In \fpc, it returns always a
|
|
|
|
-zero, since \fpc is a 32 bit compiler.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{CSeg}, \seef{Seg}, \seef{Ofs}, \seef{Ptr}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex17}
|
|
|
|
-
|
|
|
|
-\begin{function}{Eof}
|
|
|
|
-\Declaration
|
|
|
|
-Function Eof [(F : Any file type)] : Boolean;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Eof} returns \var{True} if the file-pointer has reached the end of the
|
|
|
|
-file, or if the file is empty. In all other cases \var{Eof} returns
|
|
|
|
-\var{False}.
|
|
|
|
-If no file \var{F} is specified, standard input is assumed.
|
|
|
|
-\Errors
|
|
|
|
-Depending on the state of the \var{\{\$I\}} switch, a runtime error can be
|
|
|
|
-generated if there is an error. In the \var{\{\$I-\}} state, use \var{IOResult}
|
|
|
|
-to check for errors.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Eoln}, \seep{Assign}, \seep{Reset}, \seep{Rewrite}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex18}
|
|
|
|
-
|
|
|
|
-\begin{function}{Eoln}
|
|
|
|
-\Declaration
|
|
|
|
-Function Eoln [(F : Text)] : Boolean;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Eof} returns \var{True} if the file pointer has reached the end of a
|
|
|
|
-line, which is demarcated by a line-feed character (ASCII value 10), or if
|
|
|
|
-the end of the file is reached.
|
|
|
|
-In all other cases \var{Eof} returns \var{False}.
|
|
|
|
-If no file \var{F} is specified, standard input is assumed.
|
|
|
|
-It can only be used on files of type \var{Text}.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Eof}, \seep{Assign}, \seep{Reset}, \seep{Rewrite}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex19}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Erase}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Erase (Var F : Any file type);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Erase} removes an unopened file from disk. The file should be
|
|
|
|
-assigned with \var{Assign}, but not opened with \var{Reset} or \var{Rewrite}
|
|
|
|
-\Errors
|
|
|
|
-Depending on the state of the \var{\{\$I\}} switch, a runtime error can be
|
|
|
|
-generated if there is an error. In the \var{\{\$I-\}} state, use \var{IOResult}
|
|
|
|
-to check for errors.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Assign}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex20}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Exclude}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Exclude (Var S : Any set type; E : Set element);
|
|
|
|
-\Description
|
|
|
|
-\var{Exclude} removes \var{E} from the set \var{S} if it is
|
|
|
|
-included inthe set. E should be of the same type as the base type
|
|
|
|
-of the set \var{S}.
|
|
|
|
-
|
|
|
|
-Thus, the two following statements do the same thing:
|
|
|
|
-\begin{verbatim}
|
|
|
|
-S:=S-[E];
|
|
|
|
-Exclude(S,E);
|
|
|
|
-\end{verbatim}
|
|
|
|
-\Errors
|
|
|
|
-If the type of the element \var{E} is not equal to the base type of the
|
|
|
|
-set \var{S}, the compiler will generate an error.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Include}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex111}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Exit}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Exit ([Var X : return type )];
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Exit} exits the current subroutine, and returns control to the calling
|
|
|
|
-routine. If invoked in the main program routine, exit stops the program.
|
|
|
|
-The optional argument \var{X} allows to specify a return value, in the case
|
|
|
|
-\var{Exit} is invoked in a function. The function result will then be
|
|
|
|
-equal to \var{X}.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Halt}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex21}
|
|
|
|
-
|
|
|
|
-\begin{function}{Exp}
|
|
|
|
-\Declaration
|
|
|
|
-Function Exp (Var X : Real) : Real;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Exp} returns the exponent of \var{X}, i.e. the number \var{e} to the
|
|
|
|
-power \var{X}.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Ln}, \seef{Power}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex22}
|
|
|
|
-
|
|
|
|
-\begin{function}{Filepos}
|
|
|
|
-\Declaration
|
|
|
|
-Function Filepos (Var F : Any file type) : Longint;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Filepos} returns the current record position of the file-pointer in file
|
|
|
|
-\var{F}. It cannot be invoked with a file of type \var{Text}. A compiler error
|
|
|
|
-will be generated if this is attempted.
|
|
|
|
-\Errors
|
|
|
|
-Depending on the state of the \var{\{\$I\}} switch, a runtime error can be
|
|
|
|
-generated if there is an error. In the \var{\{\$I-\}} state, use \var{IOResult}
|
|
|
|
-to check for errors.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Filesize}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex23}
|
|
|
|
-
|
|
|
|
-\begin{function}{Filesize}
|
|
|
|
-\Declaration
|
|
|
|
-Function Filesize (Var F : Any file type) : Longint;
|
|
|
|
-\Description
|
|
|
|
-\var{Filesize} returns the total number of records in file \var{F}.
|
|
|
|
-It cannot be invoked with a file of type \var{Text}. (under \linux and \unix, this
|
|
|
|
-also means that it cannot be invoked on pipes).
|
|
|
|
-If \var{F} is empty, 0 is returned.
|
|
|
|
-\Errors
|
|
|
|
-Depending on the state of the \var{\{\$I\}} switch, a runtime error can be
|
|
|
|
-generated if there is an error. In the \var{\{\$I-\}} state, use \var{IOResult}
|
|
|
|
-to check for errors.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Filepos}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex24}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{FillByte}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure FillByte(var X;Count:longint;Value:byte);
|
|
|
|
-\Description
|
|
|
|
-\var{FillByte} fills the memory starting at \var{X} with \var{Count} bytes
|
|
|
|
-with value equal to \var{Value}.
|
|
|
|
-
|
|
|
|
-This is useful for quickly zeroing out a memory location. When the size of
|
|
|
|
-the memory location to be filled out is a multiple of 2 bytes, it is better
|
|
|
|
- to use \seep{Fillword}, and if it is a multiple of 4 bytes it is better
|
|
|
|
-to use \seep{FillDWord}, these routines are optimized for their respective sizes.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-No checking on the size of \var{X} is done.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Fillchar}, \seep{FillDWord}, \seep{Fillword}, \seep{Move}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex102}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Fillchar}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Fillchar (Var X;Count : Longint;Value : char or byte);;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Fillchar} fills the memory starting at \var{X} with \var{Count} bytes
|
|
|
|
-or characters with value equal to \var{Value}.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-No checking on the size of \var{X} is done.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Fillword}, \seep{Move}, \seep{FillByte}, \seep{FillDWord}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex25}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{FillDWord}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure FillDWord (Var X;Count : Longint;Value : DWord);;
|
|
|
|
-\Description
|
|
|
|
-\var{Fillword} fills the memory starting at \var{X} with \var{Count} DWords
|
|
|
|
-with value equal to \var{Value}. A DWord is 4 bytes in size.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-No checking on the size of \var{X} is done.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{FillByte}, \seep{Fillchar}, \seep{Fillword}, \seep{Move}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex103}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Fillword}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Fillword (Var X;Count : Longint;Value : Word);;
|
|
|
|
-\Description
|
|
|
|
-\var{Fillword} fills the memory starting at \var{X} with \var{Count} words
|
|
|
|
-with value equal to \var{Value}. A word is 2 bytes in size.
|
|
|
|
-\Errors
|
|
|
|
-No checking on the size of \var{X} is done.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Fillchar}, \seep{Move}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex76}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Flush}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Flush (Var F : Text);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Flush} empties the internal buffer of an opened file \var{F} and writes the
|
|
|
|
-contents to disk. The file is \textit{not} closed as a result of this call.
|
|
|
|
-\Errors
|
|
|
|
-Depending on the state of the \var{\{\$I\}} switch, a runtime error can be
|
|
|
|
-generated if there is an error. In the \var{\{\$I-\}} state, use \var{IOResult}
|
|
|
|
-to check for errors.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Close}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex26}
|
|
|
|
-
|
|
|
|
-\begin{function}{Frac}
|
|
|
|
-\Declaration
|
|
|
|
-Function Frac (X : Real) : Real;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Frac} returns the non-integer part of \var{X}.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Round}, \seef{Int}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex27}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Freemem}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Freemem (Var P : pointer; Count : Longint);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Freemem} releases the memory occupied by the pointer \var{P}, of size
|
|
|
|
-\var{Count} (in bytes), and returns it to the heap. \var{P} should point to the memory
|
|
|
|
-allocated to a dynamic variable.
|
|
|
|
-\Errors
|
|
|
|
-An error will occur when \var{P} doesn't point to the heap.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Getmem}, \seep{New}, \seep{Dispose}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex28}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Getdir}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Getdir (drivenr : byte;var dir : string);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Getdir} returns in \var{dir} the current directory on the drive
|
|
|
|
-\var{drivenr}, where {drivenr} is 1 for the first floppy drive, 3 for the
|
|
|
|
-first hard disk etc. A value of 0 returns the directory on the current disk.
|
|
|
|
-On \linux and \unix systems, \var{drivenr} is ignored, as there is only one
|
|
|
|
-directory tree.
|
|
|
|
-\Errors
|
|
|
|
-An error is returned under \dos, if the drive requested isn't ready.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Chdir}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex29}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Getmem}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Getmem (var p : pointer;size : Longint);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Getmem} reserves \var{Size} bytes memory on the heap, and returns a
|
|
|
|
-pointer to this memory in \var{p}. If no more memory is available, nil is
|
|
|
|
-returned.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Freemem}, \seep{Dispose}, \seep{New}
|
|
|
|
-\end{procedure}
|
|
|
|
-For an example, see \seep{Freemem}.
|
|
|
|
-
|
|
|
|
-\begin{procedure}{GetMemoryManager}
|
|
|
|
-\Declaration
|
|
|
|
-procedure GetMemoryManager(var MemMgr: TMemoryManager);
|
|
|
|
-\Description
|
|
|
|
-\var{GetMemoryManager} stores the current Memory Manager record in
|
|
|
|
-\var{MemMgr}.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{SetMemoryManager}, \seef{IsMemoryManagerSet}.
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-For an example, see \progref.
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Halt}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Halt [(Errnum : byte)];
|
|
|
|
-\Description
|
|
|
|
-\var{Halt} stops program execution and returns control to the calling
|
|
|
|
-program. The optional argument \var{Errnum} specifies an exit value. If
|
|
|
|
-omitted, zero is returned.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Exit}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex30}
|
|
|
|
-
|
|
|
|
-\begin{function}{HexStr}
|
|
|
|
-\Declaration
|
|
|
|
-Function HexStr (Value : longint; cnt : byte) : String;
|
|
|
|
-Function HexStr (Value : int64; cnt : byte) : String;
|
|
|
|
-\Description
|
|
|
|
-\var{HexStr} returns a string with the hexadecimal representation
|
|
|
|
-of \var{Value}. The string has exactly \var{cnt} charaters.
|
|
|
|
- (i.e. only the \var{cnt} rightmost nibbles are taken into account)
|
|
|
|
-To have a complete representation of a Longint-type value, 8
|
|
|
|
-nibbles are needed, i.e. \var{cnt=8}.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Str}, \seep{Val}, \seef{BinStr}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex81}
|
|
|
|
-
|
|
|
|
-\begin{function}{Hi}
|
|
|
|
-\Declaration
|
|
|
|
-Function Hi (X : Ordinal type) : Word or byte;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Hi} returns the high byte or word from \var{X}, depending on the size
|
|
|
|
-of X. If the size of X is 4, then the high word is returned. If the size is
|
|
|
|
-2 then the high byte is returned.
|
|
|
|
-\var{Hi} cannot be invoked on types of size 1, such as byte or char.
|
|
|
|
-\Errors
|
|
|
|
-None
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Lo}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex31}
|
|
|
|
-
|
|
|
|
-\begin{function}{High}
|
|
|
|
-\Declaration
|
|
|
|
-Function High (Type identifier or variable reference) : Ordinal;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
- The return value of \var{High} depends on it's argument:
|
|
|
|
-\begin{enumerate}
|
|
|
|
-\item If the argument is an ordinal type, \var{High} returns the highest
|
|
|
|
- value in the range of the given ordinal type.
|
|
|
|
-\item If the argument is an array type or an array type variable then
|
|
|
|
-\var{High} returns the highest possible value of it's index.
|
|
|
|
-\item If the argument is an open array identifier in a function or
|
|
|
|
-procedure, then \var{High} returns the highest index of the array, as if the
|
|
|
|
-array has a zero-based index.
|
|
|
|
-\end{enumerate}
|
|
|
|
-The return type is always the same type as the type of the argument
|
|
|
|
-(This can lead to some nasty surprises !).
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Low}, \seef{Ord}, \seef{Pred}, \seef{Succ}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex80}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Inc}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Inc (Var X : Any ordinal type[; Increment : Any ordinal type]);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Inc} increases the value of \var{X} with \var{Increment}.
|
|
|
|
-If \var{Increment} isn't specified, then 1 is taken as a default.
|
|
|
|
-\Errors
|
|
|
|
-If range checking is on, then A range check can occur, or an overflow
|
|
|
|
-error, when an attempt is made to increase \var{X} over its maximum value.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Dec}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex32}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Include}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Include (Var S : Any set type; E : Set element);
|
|
|
|
-\Description
|
|
|
|
-\var{Include} includes \var{E} in the set \var{S} if it is
|
|
|
|
-not yet part of the set. E should be of the same type as the base type
|
|
|
|
-of the set \var{S}.
|
|
|
|
-
|
|
|
|
-Thus, the two following statements do the same thing:
|
|
|
|
-\begin{verbatim}
|
|
|
|
-S:=S+[E];
|
|
|
|
-Include(S,E);
|
|
|
|
-\end{verbatim}
|
|
|
|
-\Errors
|
|
|
|
-If the type of the element \var{E} is not equal to the base type of the
|
|
|
|
-set \var{S}, the compiler will generate an error.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Exclude}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-For an example, see \seep{Exclude}
|
|
|
|
-
|
|
|
|
-\begin{function}{IndexByte}
|
|
|
|
-\Declaration
|
|
|
|
-function IndexByte(var buf;len:longint;b:byte):longint;
|
|
|
|
-\Description
|
|
|
|
-\var{IndexByte} searches the memory at \var{buf} for maximally \var{len}
|
|
|
|
-positions for the byte \var{b} and returns it's position if it found one.
|
|
|
|
-If \var{b} is not found then -1 is returned.
|
|
|
|
-
|
|
|
|
-The position is zero-based.
|
|
|
|
-\Errors
|
|
|
|
-\var{Buf} and \var{Len} are not checked to see if they are valid values.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{IndexChar}, \seef{IndexDWord}, \seef{IndexWord}, \seef{CompareByte}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex105}
|
|
|
|
-
|
|
|
|
-\begin{function}{IndexChar}
|
|
|
|
-\Declaration
|
|
|
|
-function IndexChar(var buf;len:longint;b:char):longint;
|
|
|
|
-\Declaration
|
|
|
|
-function IndexChar0(var buf;len:longint;b:char):longint;
|
|
|
|
-\Description
|
|
|
|
-\var{IndexChar} searches the memory at \var{buf} for maximally \var{len}
|
|
|
|
-positions for the character \var{b} and returns it's position if it found one.
|
|
|
|
-If \var{b} is not found then -1 is returned.
|
|
|
|
-
|
|
|
|
-The position is zero-based. The \var{IndexChar0} variant stops looking if
|
|
|
|
-a null character is found, and returns -1 in that case.
|
|
|
|
-\Errors
|
|
|
|
-\var{Buf} and \var{Len} are not checked to see if they are valid values.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{IndexByte}, \seef{IndexDWord}, \seef{IndexWord}, \seef{CompareChar}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex108}
|
|
|
|
-
|
|
|
|
-\begin{function}{IndexDWord}
|
|
|
|
-\Declaration
|
|
|
|
-function IndexDWord(var buf;len:longint;DW:DWord):longint;
|
|
|
|
-\Description
|
|
|
|
-\var{IndexChar} searches the memory at \var{buf} for maximally \var{len}
|
|
|
|
-positions for the DWord \var{DW} and returns it's position if it found one.
|
|
|
|
-If \var{DW} is not found then -1 is returned.
|
|
|
|
-
|
|
|
|
-The position is zero-based.
|
|
|
|
-\Errors
|
|
|
|
-\var{Buf} and \var{Len} are not checked to see if they are valid values.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{IndexByte}, \seef{IndexChar}, \seef{IndexWord}, \seef{CompareDWord}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex106}
|
|
|
|
-
|
|
|
|
-\begin{function}{IndexWord}
|
|
|
|
-\Declaration
|
|
|
|
-function IndexWord(var buf;len:longint;W:word):longint;
|
|
|
|
-\Description
|
|
|
|
-\var{IndexChar} searches the memory at \var{buf} for maximally \var{len}
|
|
|
|
-positions for the Word \var{W} and returns it's position if it found one.
|
|
|
|
-If \var{W} is not found then -1 is returned.
|
|
|
|
-\Errors
|
|
|
|
-\var{Buf} and \var{Len} are not checked to see if they are valid values.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{IndexByte}, \seef{IndexDWord}, \seef{IndexChar}, \seef{CompareWord}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex107}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Insert}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Insert (Const Source : String;var S : String;Index : Integer);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Insert} inserts string \var{Source} in string \var{S}, at position
|
|
|
|
-\var{Index}, shifting all characters after \var{Index} to the right. The
|
|
|
|
-resulting string is truncated at 255 characters, if needed. (i.e. for
|
|
|
|
-shortstrings)
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Delete}, \seef{Copy}, \seef{Pos}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex33}
|
|
|
|
-
|
|
|
|
-\begin{function}{IsMemoryManagerSet}
|
|
|
|
-\Declaration
|
|
|
|
-function IsMemoryManagerSet: Boolean;
|
|
|
|
-\Description
|
|
|
|
-\var{IsMemoryManagerSet} will return \var{True} if the memory manager has
|
|
|
|
-been set to another value than the system heap manager, it will return
|
|
|
|
-\var{False} otherwise.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{SetMemoryManager}, \seep{GetMemoryManager}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\begin{function}{Int}
|
|
|
|
-\Declaration
|
|
|
|
-Function Int (X : Real) : Real;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Int} returns the integer part of any Real \var{X}, as a Real.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Frac}, \seef{Round}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex34}
|
|
|
|
-
|
|
|
|
-\begin{function}{IOresult}
|
|
|
|
-\Declaration
|
|
|
|
-Function IOresult : Word;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-IOresult contains the result of any input/output call, when the
|
|
|
|
-\var{\{\$i-\}} compiler directive is active, disabling IO checking.
|
|
|
|
-When the flag is read, it is reset to zero.
|
|
|
|
-If \var{IOresult} is zero, the operation completed successfully. If
|
|
|
|
-non-zero, an error occurred. The following errors can occur:
|
|
|
|
-
|
|
|
|
-\dos errors :
|
|
|
|
-\begin{description}
|
|
|
|
-\item [2\ ] File not found.
|
|
|
|
-\item [3\ ] Path not found.
|
|
|
|
-\item [4\ ] Too many open files.
|
|
|
|
-\item [5\ ] Access denied.
|
|
|
|
-\item [6\ ] Invalid file handle.
|
|
|
|
-\item [12\ ] Invalid file-access mode.
|
|
|
|
-\item [15\ ] Invalid disk number.
|
|
|
|
-\item [16\ ] Cannot remove current directory.
|
|
|
|
-\item [17\ ] Cannot rename across volumes.
|
|
|
|
-\end{description}
|
|
|
|
-I/O errors :
|
|
|
|
-\begin{description}
|
|
|
|
-\item [100\ ] Error when reading from disk.
|
|
|
|
-\item [101\ ] Error when writing to disk.
|
|
|
|
-\item [102\ ] File not assigned.
|
|
|
|
-\item [103\ ] File not open.
|
|
|
|
-\item [104\ ] File not opened for input.
|
|
|
|
-\item [105\ ] File not opened for output.
|
|
|
|
-\item [106\ ] Invalid number.
|
|
|
|
-\end{description}
|
|
|
|
-Fatal errors :
|
|
|
|
-\begin{description}
|
|
|
|
-\item [150\ ] Disk is write protected.
|
|
|
|
-\item [151\ ] Unknown device.
|
|
|
|
-\item [152\ ] Drive not ready.
|
|
|
|
-\item [153\ ] Unknown command.
|
|
|
|
-\item [154\ ] CRC check failed.
|
|
|
|
-\item [155\ ] Invalid drive specified..
|
|
|
|
-\item [156\ ] Seek error on disk.
|
|
|
|
-\item [157\ ] Invalid media type.
|
|
|
|
-\item [158\ ] Sector not found.
|
|
|
|
-\item [159\ ] Printer out of paper.
|
|
|
|
-\item [160\ ] Error when writing to device.
|
|
|
|
-\item [161\ ] Error when reading from device.
|
|
|
|
-\item [162\ ] Hardware failure.
|
|
|
|
-\end{description}
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-All I/O functions.
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex35}
|
|
|
|
-
|
|
|
|
-\begin{function}{Length}
|
|
|
|
-\Declaration
|
|
|
|
-Function Length (S : String) : Integer;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Length} returns the length of the string \var{S}, which is limited
|
|
|
|
-to 255 for shortstrings. If the strings \var{S} is empty, 0 is returned.
|
|
|
|
-
|
|
|
|
-{\em Note:} The length of the string \var{S} is stored in \var{S[0]} for
|
|
|
|
-shortstrings only. The \var{Length} fuction should always be used on
|
|
|
|
-ansistrings and widestrings.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Pos}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex36}
|
|
|
|
-
|
|
|
|
-\begin{function}{Ln}
|
|
|
|
-\Declaration
|
|
|
|
-Function Ln (X : Real) : Real;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-
|
|
|
|
-\var{Ln} returns the natural logarithm of the Real parameter \var{X}.
|
|
|
|
-\var{X} must be positive.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-An run-time error will occur when \var{X} is negative.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Exp}, \seef{Power}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex37}
|
|
|
|
-
|
|
|
|
-\begin{function}{Lo}
|
|
|
|
-\Declaration
|
|
|
|
-Function Lo (O : Word or Longint) : Byte or Word;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Lo} returns the low byte of its argument if this is of type
|
|
|
|
-\var{Integer} or
|
|
|
|
-\var{Word}. It returns the low word of its argument if this is of type
|
|
|
|
-\var{Longint} or \var{Cardinal}.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Ord}, \seef{Chr}, \seef{Hi}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex38}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{LongJmp}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure LongJmp (Var env : Jmp\_Buf; Value : Longint);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-
|
|
|
|
-\var{LongJmp} jumps to the adress in the \var{env} \var{jmp\_buf},
|
|
|
|
-and restores the registers that were stored in it at the corresponding
|
|
|
|
-\seef{SetJmp} call.
|
|
|
|
-In effect, program flow will continue at the \var{SetJmp} call, which will
|
|
|
|
-return \var{value} instead of 0. If a \var{value} equal to zero is passed,
|
|
|
|
-it will be converted to 1 before passing it on. The call will not return, so it must be
|
|
|
|
-used with extreme care.
|
|
|
|
-This can be used for error recovery, for instance when a segmentation fault
|
|
|
|
-occurred.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{SetJmp}
|
|
|
|
-\end{procedure}
|
|
|
|
-For an example, see \seef{SetJmp}
|
|
|
|
-
|
|
|
|
-\begin{function}{Low}
|
|
|
|
-\Declaration
|
|
|
|
-Function Low (Type identifier or variable reference) : Longint;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
- The return value of \var{Low} depends on it's argument:
|
|
|
|
-\begin{enumerate}
|
|
|
|
-\item If the argument is an ordinal type, \var{Low} returns the lowest
|
|
|
|
-value in the range of the given ordinal type.
|
|
|
|
-\item If the argument is an array type or an array type variable then
|
|
|
|
-\var{Low} returns the lowest possible value of it's index.
|
|
|
|
-\end{enumerate}
|
|
|
|
-The return type is always the same type as the type of the argument
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{High}, \seef{Ord}, \seef{Pred}, \seef{Succ}
|
|
|
|
-\end{function}
|
|
|
|
-for an example, see \seef{High}.
|
|
|
|
-\begin{function}{Lowercase}
|
|
|
|
-\Declaration
|
|
|
|
-Function Lowercase (C : Char or String) : Char or String;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Lowercase} returns the lowercase version of its argument \var{C}.
|
|
|
|
-If its argument is a string, then the complete string is converted to
|
|
|
|
-lowercase. The type of the returned value is the same as the type of the
|
|
|
|
-argument.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Upcase}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex73}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Mark}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Mark (Var P : Pointer);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-This routine is here for compatibility with Turbo Pascal, but
|
|
|
|
-it is not implemented and currently does nothing.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Getmem}, \seep{Freemem}, \seep{New}, \seep{Dispose}, \seef{Maxavail}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\begin{function}{Maxavail}
|
|
|
|
-\Declaration
|
|
|
|
-Function Maxavail : Longint;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Maxavail} returns the size, in bytes, of the biggest free memory block in
|
|
|
|
-the heap.
|
|
|
|
-\begin{remark}
|
|
|
|
-The heap grows dynamically if more memory is needed than is available.
|
|
|
|
-\end{remark}
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Release}, \seef{Memavail},\seep{Freemem}, \seep{Getmem}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex40}
|
|
|
|
-
|
|
|
|
-\begin{function}{Memavail}
|
|
|
|
-\Declaration
|
|
|
|
-Function Memavail : Longint;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Memavail} returns the size, in bytes, of the free heap memory.
|
|
|
|
-\begin{remark}
|
|
|
|
-The heap grows dynamically if more memory is needed than is available. The
|
|
|
|
-heap size is not equal to the size of the memory available to the
|
|
|
|
-operating system, it is internal to the programs created by \fpc.
|
|
|
|
-\end{remark}
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Maxavail},\seep{Freemem}, \seep{Getmem}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex41}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Mkdir}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Mkdir (const S : string);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Mkdir} creates a new directory \var{S}.
|
|
|
|
-\Errors
|
|
|
|
-Depending on the state of the \var{\{\$I\}} switch, a runtime error can be
|
|
|
|
-generated if there is an error. In the \var{\{\$I-\}} state, use \var{IOResult}
|
|
|
|
-to check for errors.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Chdir}, \seep{Rmdir}
|
|
|
|
-\end{procedure}
|
|
|
|
-For an example, see \seep{Rmdir}.
|
|
|
|
-\begin{procedure}{Move}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Move (var Source,Dest;Count : Longint);
|
|
|
|
-\Description
|
|
|
|
-\var{Move} moves \var{Count} bytes from \var{Source} to \var{Dest}.
|
|
|
|
-\Errors
|
|
|
|
-If either \var{Dest} or \var{Source} is outside the accessible memory for
|
|
|
|
-the process, then a run-time error will be generated.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Fillword}, \seep{Fillchar}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex42}
|
|
|
|
-
|
|
|
|
-\begin{procedurel}{MoveChar0}{MoveCharNull}
|
|
|
|
-\Declaration
|
|
|
|
-procedure MoveChar0(var Src,Dest;Count:longint);
|
|
|
|
-\Description
|
|
|
|
-\var{MoveChar0} moves \var{Count} bytes from \var{Src} to \var{Dest}, and
|
|
|
|
-stops moving if a zero character is found.
|
|
|
|
-\Errors
|
|
|
|
-No checking is done to see if \var{Count} stays within the memory allocated
|
|
|
|
-to the process.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Move}
|
|
|
|
-\end{procedurel}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex109}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{New}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure New (Var P : Pointer[, Constructor]);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{New} allocates a new instance of the type pointed to by \var{P}, and
|
|
|
|
-puts the address in \var{P}.
|
|
|
|
-If P is an object, then it is possible to
|
|
|
|
-specify the name of the constructor with which the instance will be created.
|
|
|
|
-\Errors
|
|
|
|
-If not enough memory is available, \var{Nil} will be returned.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Dispose}, \seep{Freemem}, \seep{Getmem}, \seef{Memavail},
|
|
|
|
-\seef{Maxavail}
|
|
|
|
-\end{procedure}
|
|
|
|
-For an example, see \seep{Dispose}.
|
|
|
|
-\begin{function}{Odd}
|
|
|
|
-\Declaration
|
|
|
|
-Function Odd (X : Longint) : Boolean;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Odd} returns \var{True} if \var{X} is odd, or \var{False} otherwise.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Abs}, \seef{Ord}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex43}
|
|
|
|
-
|
|
|
|
-\begin{function}{OctStr}
|
|
|
|
-\Declaration
|
|
|
|
-Function OctStr (Value : longint; cnt : byte) : String;
|
|
|
|
-Function OctStr (Value : int64; cnt : byte) : String;
|
|
|
|
-\Description
|
|
|
|
-\var{OctStr} returns a string with the octal representation
|
|
|
|
-of \var{Value}. The string has exactly \var{cnt} charaters.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Str}, \seep{Val}, \seef{BinStr}, \seef{HexStr}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex112}
|
|
|
|
-
|
|
|
|
-\begin{function}{Ofs}
|
|
|
|
-\Declaration
|
|
|
|
-Function Ofs (Var X) : Longint;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Ofs} returns the offset of the address of a variable.
|
|
|
|
-This function is only supported for compatibility. In \fpc, it
|
|
|
|
-returns always the complete address of the variable, since \fpc is a 32 bit
|
|
|
|
-compiler.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{DSeg}, \seef{CSeg}, \seef{Seg}, \seef{Ptr}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex44}
|
|
|
|
-
|
|
|
|
-\begin{function}{Ord}
|
|
|
|
-\Declaration
|
|
|
|
-Function Ord (X : Any ordinal type) : Longint;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Ord} returns the Ordinal value of a ordinal-type variable \var{X}.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Chr}, \seef{Succ}, \seef{Pred}, \seef{High}, \seef{Low}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex45}
|
|
|
|
-
|
|
|
|
-\begin{function}{Paramcount}
|
|
|
|
-\Declaration
|
|
|
|
-Function Paramcount : Longint;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Paramcount} returns the number of command-line arguments. If no
|
|
|
|
-arguments were given to the running program, \var{0} is returned.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Paramstr}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex46}
|
|
|
|
-
|
|
|
|
-\begin{function}{Paramstr}
|
|
|
|
-\Declaration
|
|
|
|
-Function Paramstr (L : Longint) : String;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Paramstr} returns the \var{L}-th command-line argument. \var{L} must
|
|
|
|
-be between \var{0} and \var{Paramcount}, these values included.
|
|
|
|
-The zeroth argument is the path and file name with which the program was
|
|
|
|
-started.
|
|
|
|
-
|
|
|
|
-The command-line parameters will be truncated to a length of 255,
|
|
|
|
-even though the operating system may support bigger command-lines.
|
|
|
|
-The \var{Objpas} unit (used in \var{objfpc} or \var{delphi} mode) define versions
|
|
|
|
-of \var{Paramstr} which return the full-length command-line arguments.
|
|
|
|
-
|
|
|
|
-When the complete command-line must be accessed, the \var{argv} pointer
|
|
|
|
-should be used to retrieve the real values of the command-line parameters.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Paramcount}
|
|
|
|
-\end{function}
|
|
|
|
-For an example, see \seef{Paramcount}.
|
|
|
|
-\begin{function}{Pi}
|
|
|
|
-\Declaration
|
|
|
|
-Function Pi : Real;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Pi} returns the value of Pi (3.1415926535897932385).
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Cos}, \seef{Sin}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex47}
|
|
|
|
-
|
|
|
|
-\begin{function}{Pos}
|
|
|
|
-\Declaration
|
|
|
|
-Function Pos (Const Substr : String;Const S : String) : Integer;
|
|
|
|
-\Description
|
|
|
|
-\var{Pos} returns the index of \var{Substr} in \var{S}, if \var{S} contains
|
|
|
|
-\var{Substr}. In case \var{Substr} isn't found, \var{0} is returned.
|
|
|
|
-The search is case-sensitive.
|
|
|
|
-\Errors
|
|
|
|
-None
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Length}, \seef{Copy}, \seep{Delete}, \seep{Insert}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex48}
|
|
|
|
-
|
|
|
|
-\begin{function}{Power}
|
|
|
|
-\Declaration
|
|
|
|
-Function Power (base,expon : Real) : Real;
|
|
|
|
-\Description
|
|
|
|
-
|
|
|
|
-\var{Power} returns the value of \var{base} to the power \var{expon}.
|
|
|
|
-\var{Base} and \var{expon} can be of type Longint, in which case the
|
|
|
|
-result will also be a Longint.
|
|
|
|
-
|
|
|
|
-The function actually returns \var{Exp(expon*Ln(base))}
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Exp}, \seef{Ln}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex78}
|
|
|
|
-
|
|
|
|
-\begin{function}{Pred}
|
|
|
|
-\Declaration
|
|
|
|
-Function Pred (X : Any ordinal type) : Same type;
|
|
|
|
-\Description
|
|
|
|
- \var{Pred} returns the element that precedes the element that was passed
|
|
|
|
-to it. If it is applied to the first value of the ordinal type, and the
|
|
|
|
-program was compiled with range checking on (\var{\{\$R+\}}, then a run-time
|
|
|
|
-error will be generated.
|
|
|
|
-\Errors
|
|
|
|
-Run-time error 201 is generated when the result is out of
|
|
|
|
-range.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Ord}, \seef{Pred}, \seef{High}, \seef{Low}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-for an example, see \seef{Ord}
|
|
|
|
-
|
|
|
|
-\begin{function}{Ptr}
|
|
|
|
-\Declaration
|
|
|
|
-Function Ptr (Sel,Off : Longint) : Pointer;
|
|
|
|
-\Description
|
|
|
|
-\var{Ptr} returns a pointer, pointing to the address specified by
|
|
|
|
-segment \var{Sel} and offset \var{Off}.
|
|
|
|
-
|
|
|
|
- \begin{remark}
|
|
|
|
-\begin{enumerate}
|
|
|
|
-\item In the 32-bit flat-memory model supported by \fpc, this
|
|
|
|
-function is obsolete.
|
|
|
|
-\item The returned address is simply the offset.
|
|
|
|
-\end{enumerate}
|
|
|
|
-\end{remark}
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Addr}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex59}
|
|
|
|
-
|
|
|
|
-\begin{function}{Random}
|
|
|
|
-\Declaration
|
|
|
|
-Function Random [(L : Longint)] : Longint or Real;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Random} returns a random number larger or equal to \var{0} and
|
|
|
|
-strictly less than \var{L}.
|
|
|
|
-If the argument \var{L} is omitted, a Real number between 0 and 1 is returned.
|
|
|
|
-(0 included, 1 excluded)
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Randomize}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex49}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Randomize}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Randomize ;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Randomize} initializes the random number generator of \fpc, by giving
|
|
|
|
-a value to \var{Randseed}, calculated with the system clock.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Random}
|
|
|
|
-\end{procedure}
|
|
|
|
-For an example, see \seef{Random}.
|
|
|
|
-\begin{procedure}{Read}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Read ([Var F : Any file type], V1 [, V2, ... , Vn]);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Read} reads one or more values from a file \var{F}, and stores the
|
|
|
|
-result in \var{V1}, \var{V2}, etc.; If no file \var{F} is specified, then
|
|
|
|
-standard input is read.
|
|
|
|
-If \var{F} is of type \var{Text}, then the variables \var{V1, V2} etc. must be
|
|
|
|
-of type \var{Char}, \var{Integer}, \var{Real}, \var{String} or \var{PChar}.
|
|
|
|
-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
|
|
|
|
-argument.
|
|
|
|
-\Errors
|
|
|
|
-If no data is available, a run-time error is generated. This behavior can
|
|
|
|
-be controlled with the \var{\{\$i\}} compiler switch.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Readln}, \seep{Blockread}, \seep{Write}, \seep{Blockwrite}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex50}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Readln}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Readln [Var F : Text], V1 [, V2, ... , Vn]);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Read} reads one or more values from a file \var{F}, and stores the
|
|
|
|
-result in \var{V1}, \var{V2}, etc. After that it goes to the next line in
|
|
|
|
-the file. The end of the line is marked by the \var{LineEnding}
|
|
|
|
-character sequence (which is platform dependent). The end-of-line marker is
|
|
|
|
-not considered part of the line and is ignored.
|
|
|
|
-
|
|
|
|
-If no file \var{F} is specified, then standard input is read.
|
|
|
|
-The variables \var{V1, V2} etc. must be of type \var{Char}, \var{Integer},
|
|
|
|
-\var{Real}, \var{String} or \var{PChar}.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-If no data is available, a run-time error is generated. This behavior can
|
|
|
|
-be controlled with the \var{\{\$i\}} compiler switch.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Read}, \seep{Blockread}, \seep{Write}, \seep{Blockwrite}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-For an example, see \seep{Read}.
|
|
|
|
-
|
|
|
|
-\begin{functionl}{Real2Double}{RealToDouble}
|
|
|
|
-\Declaration
|
|
|
|
-Function Real2Double(r : real48) : double;
|
|
|
|
-\Description
|
|
|
|
-The \var{Real2Double} function converts a \tp style real (6 bytes long) to
|
|
|
|
-a native \fpc double type. It can be used e.g. to read old binary TP files with
|
|
|
|
-FPC and convert them to Free Pacal binary files.
|
|
|
|
-
|
|
|
|
-Note that the assignment operator has been overloaded so a \var{Real48} type
|
|
|
|
-can be assigned directly to a double or extended.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\end{functionl}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex110}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Release}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Release (Var P : pointer);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-This routine is here for compatibility with Turbo Pascal, but
|
|
|
|
-it is not implemented and currently does nothing.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Mark}, \seef{Memavail}, \seef{Maxavail}, \seep{Getmem}, \seep{Freemem}
|
|
|
|
-\seep{New}, \seep{Dispose}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Rename}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Rename (Var F : Any Filetype; Const S : String);
|
|
|
|
-\Description
|
|
|
|
-\var{Rename} changes the name of the assigned file \var{F} to \var{S}.
|
|
|
|
-\var{F}
|
|
|
|
-must be assigned, but not opened.
|
|
|
|
-\Errors
|
|
|
|
-Depending on the state of the \var{\{\$I\}} switch, a runtime error can be
|
|
|
|
-generated if there is an error. In the \var{\{\$I-\}} state, use \var{IOResult}
|
|
|
|
-to check for errors.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Erase}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex77}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Reset}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Reset (Var F : Any File Type[; L : Longint]);
|
|
|
|
-\Description
|
|
|
|
-\var{Reset} opens a file \var{F} for reading. \var{F} can be any file type.
|
|
|
|
-If \var{F} is a text file, or refers to standard I/O (e.g : '') then it is
|
|
|
|
-opened read-only, otherwise it is opened using the mode specified in
|
|
|
|
-\var{filemode}.
|
|
|
|
-
|
|
|
|
-If \var{F} is an untyped file, the record size can be specified in
|
|
|
|
-the optional parameter \var{L}. A default value of 128 is used.
|
|
|
|
-
|
|
|
|
-File sharing is not taken into account when calling \var{Reset}.
|
|
|
|
-\Errors
|
|
|
|
-Depending on the state of the \var{\{\$I\}} switch, a runtime error can be
|
|
|
|
-generated if there is an error. In the \var{\{\$I-\}} state, use \var{IOResult}
|
|
|
|
-to check for errors.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Rewrite}, \seep{Assign}, \seep{Close}, \seep{Append}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex51}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Rewrite}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Rewrite (Var F : Any File Type[; L : Longint]);
|
|
|
|
-\Description
|
|
|
|
-\var{Rewrite} opens a file \var{F} for writing. \var{F} can be any file type.
|
|
|
|
-If \var{F} is an untyped or typed file, then it is opened for reading and
|
|
|
|
-writing. If \var{F} is an untyped file, the record size can be specified in
|
|
|
|
-the optional parameter \var{L}. Default a value of 128 is used.
|
|
|
|
-if \var{Rewrite} finds a file with the same name as \var{F}, this file is
|
|
|
|
-truncated to length \var{0}. If it doesn't find such a file, a new file is
|
|
|
|
-created.
|
|
|
|
-
|
|
|
|
-Contrary to \tp, \fpc opens the file with mode \var{fmoutput}. If it should
|
|
|
|
-be opened in \var{fminout} mode, an extra call to \seep{Reset} is needed.
|
|
|
|
-
|
|
|
|
-File sharing is not taken into account when calling \var{Rewrite}.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-Depending on the state of the \var{\{\$I\}} switch, a runtime error can be
|
|
|
|
-generated if there is an error. In the \var{\{\$I-\}} state, use \var{IOResult}
|
|
|
|
-to check for errors.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Reset}, \seep{Assign}, \seep{Close}, \seep{Flush}, \seep{Append}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex52}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Rmdir}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Rmdir (const S : string);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Rmdir} removes the directory \var{S}.
|
|
|
|
-\Errors
|
|
|
|
-\Errors
|
|
|
|
-Depending on the state of the \var{\{\$I\}} switch, a runtime error can be
|
|
|
|
-generated if there is an error. In the \var{\{\$I-\}} state, use \var{IOResult}
|
|
|
|
-to check for errors.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Chdir}, \seep{Mkdir}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex53}
|
|
|
|
-
|
|
|
|
-\begin{function}{Round}
|
|
|
|
-\Declaration
|
|
|
|
-Function Round (X : Real) : Longint;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Round} rounds \var{X} to the closest integer, which may be bigger or
|
|
|
|
-smaller than \var{X}.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Frac}, \seef{Int}, \seef{Trunc}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex54}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Runerror}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Runerror (ErrorCode : Word);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Runerror} stops the execution of the program, and generates a
|
|
|
|
-run-time error \var{ErrorCode}.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Exit}, \seep{Halt}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex55}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Seek}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Seek (Var F; Count : Longint);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Seek} sets the file-pointer for file \var{F} to record Nr. \var{Count}.
|
|
|
|
-The first record in a file has \var{Count=0}. F can be any file type, except
|
|
|
|
-\var{Text}. If \var{F} is an untyped file, with no record size specified in
|
|
|
|
-\seep{Reset} or \seep{Rewrite}, 128 is assumed.
|
|
|
|
-\Errors
|
|
|
|
-Depending on the state of the \var{\{\$I\}} switch, a runtime error can be
|
|
|
|
-generated if there is an error. In the \var{\{\$I-\}} state, use \var{IOResult}
|
|
|
|
-to check for errors.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Eof}, \seef{SeekEof}, \seef{SeekEoln}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex56}
|
|
|
|
-
|
|
|
|
-\begin{function}{SeekEof}
|
|
|
|
-\Declaration
|
|
|
|
-Function SeekEof [(Var F : text)] : Boolean;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{SeekEof} returns \var{True} is the file-pointer is at the end of the
|
|
|
|
-file. It ignores all whitespace.
|
|
|
|
-Calling this function has the effect that the file-position is advanced
|
|
|
|
-until the first non-whitespace character or the end-of-file marker is
|
|
|
|
-reached.
|
|
|
|
-If the end-of-file marker is reached, \var{True} is returned. Otherwise,
|
|
|
|
-False is returned.
|
|
|
|
-If the parameter \var{F} is omitted, standard \var{Input} is assumed.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-A run-time error is generated if the file \var{F} isn't opened.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Eof}, \seef{SeekEoln}, \seep{Seek}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex57}
|
|
|
|
-
|
|
|
|
-\begin{function}{SeekEoln}
|
|
|
|
-\Declaration
|
|
|
|
-Function SeekEoln [(Var F : text)] : Boolean;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{SeekEoln} returns \var{True} is the file-pointer is at the end of the
|
|
|
|
-current line. It ignores all whitespace.
|
|
|
|
-Calling this function has the effect that the file-position is advanced
|
|
|
|
-until the first non-whitespace character or the end-of-line marker is
|
|
|
|
-reached.
|
|
|
|
-If the end-of-line marker is reached, \var{True} is returned. Otherwise,
|
|
|
|
-False is returned.
|
|
|
|
-The end-of-line marker is defined as \var{\#10}, the LineFeed character.
|
|
|
|
-If the parameter \var{F} is omitted, standard \var{Input} is assumed.
|
|
|
|
-\Errors
|
|
|
|
-A run-time error is generated if the file \var{F} isn't opened.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Eof}, \seef{SeekEof}, \seep{Seek}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex58}
|
|
|
|
-
|
|
|
|
-\begin{function}{Seg}
|
|
|
|
-\Declaration
|
|
|
|
-Function Seg (Var X) : Longint;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Seg} returns the segment of the address of a variable.
|
|
|
|
-This function is only supported for compatibility. In \fpc, it
|
|
|
|
-returns always 0, since \fpc is a 32 bit compiler, segments have no meaning.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{DSeg}, \seef{CSeg}, \seef{Ofs}, \seef{Ptr}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex60}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{SetMemoryManager}
|
|
|
|
-\Declaration
|
|
|
|
-procedure SetMemoryManager(const MemMgr: TMemoryManager);
|
|
|
|
-\Description
|
|
|
|
-\var{SetMemoryManager} sets the current memory manager record to
|
|
|
|
-\var{MemMgr}.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{GetMemoryManager}, \seef{IsMemoryManagerSet}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-For an example, see \progref.
|
|
|
|
-
|
|
|
|
-\begin{function}{SetJmp}
|
|
|
|
-\Declaration
|
|
|
|
-Function SetJmp (Var Env : Jmp\_Buf) : Longint;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-
|
|
|
|
-\var{SetJmp} fills \var{env} with the necessary data for a jump back to the
|
|
|
|
-point where it was called. It returns zero if called in this way.
|
|
|
|
-If the function returns nonzero, then it means that a call to \seep{LongJmp}
|
|
|
|
-with \var{env} as an argument was made somewhere in the program.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{LongJmp}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex79}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-\begin{procedure}{SetLength}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure SetLength(var S : String; Len : Longint);
|
|
|
|
-\Description
|
|
|
|
-\var{SetLength} sets the length of the string \var{S} to \var{Len}. \var{S}
|
|
|
|
-can be an ansistring, a short string or a widestring.
|
|
|
|
-For \var{ShortStrings}, \var{Len} can maximally be 255. For \var{AnsiStrings}
|
|
|
|
-it can have any value. For \var{AnsiString} strings, \var{SetLength} {\em
|
|
|
|
-must} be used to set the length of the string.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Length}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-\FPCexample{ex85}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{SetString}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure SetString(var S : String; Buf : PChar; Len : Longint);
|
|
|
|
-\Description
|
|
|
|
-\var{SetString} sets the length of the string \var{S} to \var{Len} and
|
|
|
|
-if \var{Buf} is non-nil, copies \var{Len} characters from \var{Buf}
|
|
|
|
-into \var{S}. \var{S} can be an ansistring, a short string or a widestring.
|
|
|
|
-For \var{ShortStrings}, \var{Len} can maximally be 255.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{SetLength}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-\begin{procedure}{SetTextBuf}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure SetTextBuf (Var f : Text; Var Buf[; Size : Word]);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{SetTextBuf} assigns an I/O buffer to a text file. The new buffer is
|
|
|
|
-located at \var{Buf} and is \var{Size} bytes long. If \var{Size} is omitted,
|
|
|
|
-then \var{SizeOf(Buf)} is assumed.
|
|
|
|
-The standard buffer of any text file is 128 bytes long. For heavy I/O
|
|
|
|
-operations this may prove too slow. The \var{SetTextBuf} procedure allows
|
|
|
|
-to set a bigger buffer for the IO of the application, thus reducing the number of
|
|
|
|
-system calls, and thus reducing the load on the system resources.
|
|
|
|
-The maximum size of the newly assigned buffer is 65355 bytes.
|
|
|
|
-\begin{remark}
|
|
|
|
-\begin{itemize}
|
|
|
|
-\item Never assign a new buffer to an opened file. A
|
|
|
|
-new buffer can be assigned immediately after a call to \seep{Rewrite}, \seep{Reset} or
|
|
|
|
-\var{Append}, but not after the file was read from/written to. This may cause
|
|
|
|
-loss of data. If a new buffer must be assigned after read/write
|
|
|
|
-operations have been performed, the file should be flushed first.
|
|
|
|
-This will ensure that the current buffer is emptied.
|
|
|
|
-\item Take care that the assigned buffer is always valid. If a local variable is
|
|
|
|
-assigned as a buffer, then after the program exits the local program block,
|
|
|
|
-the buffer will no longer be valid, and stack problems may occur.
|
|
|
|
-\end{itemize}
|
|
|
|
-\end{remark}
|
|
|
|
-\Errors
|
|
|
|
-No checking on \var{Size} is done.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Assign}, \seep{Reset}, \seep{Rewrite}, \seep{Append}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex61}
|
|
|
|
-
|
|
|
|
-\begin{function}{Sin}
|
|
|
|
-\Declaration
|
|
|
|
-Function Sin (X : Real) : Real;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Sin} returns the sine of its argument \var{X}, where \var{X} is an
|
|
|
|
-angle in radians.
|
|
|
|
-
|
|
|
|
-If the absolute value of the argument is larger than \var{2\^{}63}, then the
|
|
|
|
-result is undefined.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Cos}, \seef{Pi}, \seef{Exp}, \seef{Ln}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex62}
|
|
|
|
-
|
|
|
|
-\begin{function}{SizeOf}
|
|
|
|
-\Declaration
|
|
|
|
-Function SizeOf (X : Any Type) : Longint;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{SizeOf} returns the size, in bytes, of any variable or type-identifier.
|
|
|
|
-\begin{remark}
|
|
|
|
-This isn't really a RTL function. Its result is calculated at
|
|
|
|
-compile-time, and hard-coded in the executable.
|
|
|
|
-\end{remark}
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Addr}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex63}
|
|
|
|
-
|
|
|
|
-\begin{function}{Sptr}
|
|
|
|
-\Declaration
|
|
|
|
-Function Sptr : Pointer;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Sptr} returns the current stack pointer.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{SSeg}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex64}
|
|
|
|
-
|
|
|
|
-\begin{function}{Sqr}
|
|
|
|
-\Declaration
|
|
|
|
-Function Sqr (X : Real) : Real;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Sqr} returns the square of its argument \var{X}.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Sqrt}, \seef{Ln}, \seef{Exp}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex65}
|
|
|
|
-
|
|
|
|
-\begin{function}{Sqrt}
|
|
|
|
-\Declaration
|
|
|
|
-Function Sqrt (X : Real) : Real;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Sqrt} returns the square root of its argument \var{X}, which must be
|
|
|
|
-positive.
|
|
|
|
-\Errors
|
|
|
|
-If \var{X} is negative, then a run-time error is generated.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Sqr}, \seef{Ln}, \seef{Exp}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex66}
|
|
|
|
-
|
|
|
|
-\begin{function}{SSeg}
|
|
|
|
-\Declaration
|
|
|
|
-Function SSeg : Longint;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
- \var{SSeg} returns the Stack Segment. This function is only
|
|
|
|
- supported for compatibility reasons, as \var{Sptr} returns the
|
|
|
|
-correct contents of the stackpointer.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Sptr}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex67}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Str}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Str (Var X[:NumPlaces[:Decimals]]; Var S : String);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Str} returns a string which represents the value of X. X can be any
|
|
|
|
-numerical type.
|
|
|
|
-The optional \var{NumPLaces} and \var{Decimals} specifiers control the
|
|
|
|
-formatting of the string.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Val}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex68}
|
|
|
|
-
|
|
|
|
-\begin{function}{StringOfChar}
|
|
|
|
-\Declaration
|
|
|
|
-Function StringOfChar(c : char;l : Integer) : String;
|
|
|
|
-\Description
|
|
|
|
-\var{StringOfChar} creates a new String of length \var{l} and fills
|
|
|
|
-it with the character \var{c}.
|
|
|
|
-
|
|
|
|
-It is equivalent to the following calls:
|
|
|
|
-\begin{verbatim}
|
|
|
|
-SetLength(StringOfChar,l);
|
|
|
|
-FillChar(Pointer(StringOfChar)^,Length(StringOfChar),c);
|
|
|
|
-\end{verbatim}
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{SetLength}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex97}
|
|
|
|
-
|
|
|
|
-\begin{function}{Succ}
|
|
|
|
-\Declaration
|
|
|
|
-Function Succ (X : Any ordinal type) : Same type;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
- \var{Succ} returns the element that succeeds the element that was passed
|
|
|
|
-to it. If it is applied to the last value of the ordinal type, and the
|
|
|
|
-program was compiled with range checking on (\var{\{\$R+\}}), then a run-time
|
|
|
|
-error will be generated.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-Run-time error 201 is generated when the result is out of
|
|
|
|
-range.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Ord}, \seef{Pred}, \seef{High}, \seef{Low}
|
|
|
|
-\end{function}
|
|
|
|
-for an example, see \seef{Ord}.
|
|
|
|
-\begin{function}{Swap}
|
|
|
|
-\Declaration
|
|
|
|
-Function Swap (X) : Type of X;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Swap} swaps the high and low order bytes of \var{X} if \var{X} is of
|
|
|
|
-type \var{Word} or \var{Integer}, or swaps the high and low order words of
|
|
|
|
-\var{X} if \var{X} is of type \var{Longint} or \var{Cardinal}.
|
|
|
|
-The return type is the type of \var{X}
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Lo}, \seef{Hi}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex69}
|
|
|
|
-
|
|
|
|
-\begin{function}{Trunc}
|
|
|
|
-\Declaration
|
|
|
|
-Function Trunc (X : Real) : Longint;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Trunc} returns the integer part of \var{X},
|
|
|
|
-which is always smaller than (or equal to) \var{X} in absolute value.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Frac}, \seef{Int}, \seef{Round}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex70}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Truncate}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Truncate (Var F : file);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Truncate} truncates the (opened) file \var{F} at the current file
|
|
|
|
-position.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-Depending on the state of the \var{\{\$I\}} switch, a runtime error can be
|
|
|
|
-generated if there is an error. In the \var{\{\$I-\}} state, use \var{IOResult}
|
|
|
|
-to check for errors.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Append}, \seef{Filepos},
|
|
|
|
-\seep{Seek}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex71}
|
|
|
|
-
|
|
|
|
-\begin{function}{Upcase}
|
|
|
|
-\Declaration
|
|
|
|
-Function Upcase (C : Char or string) : Char or String;
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Upcase} returns the uppercase version of its argument \var{C}.
|
|
|
|
-If its argument is a string, then the complete string is converted to
|
|
|
|
-uppercase. The type of the returned value is the same as the type of the
|
|
|
|
-argument.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Lowercase}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex72}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Val}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Val (const S : string;var V;var Code : word);
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Val} converts the value represented in the string \var{S} to a numerical
|
|
|
|
-value, and stores this value in the variable \var{V}, which
|
|
|
|
-can be of type \var{Longint}, \var{Real} and \var{Byte}.
|
|
|
|
-If the conversion isn't succesfull, then the parameter \var{Code} contains
|
|
|
|
-the index of the character in \var{S} which prevented the conversion.
|
|
|
|
-The string \var{S} is allowed to contain spaces in the beginning.
|
|
|
|
-
|
|
|
|
-The string \var{S} can contain a number in decimal, hexadecimal, binary
|
|
|
|
-or octal format, as described in the language reference.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-If the conversion doesn't succeed, the value of \var{Code} indicates the
|
|
|
|
-position where the conversion went wrong.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Str}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex74}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{Write}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Write ([Var F : Any filetype;] V1 [; V2; ... , Vn)];
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{Write} writes the contents of the variables \var{V1}, \var{V2} etc. to
|
|
|
|
-the file \var{F}. \var{F} can be a typed file, or a \var{Text} file.
|
|
|
|
-If \var{F} is a typed file, then the variables \var{V1}, \var{V2} etc. must
|
|
|
|
-be of the same type as the type in the declaration of \var{F}. Untyped files
|
|
|
|
-are not allowed.
|
|
|
|
-If the parameter \var{F} is omitted, standard output is assumed.
|
|
|
|
-If \var{F} is of type \var{Text}, then the necessary conversions are done
|
|
|
|
-such that the output of the variables is in human-readable format.
|
|
|
|
-This conversion is done for all numerical types. Strings are printed exactly
|
|
|
|
-as they are in memory, as well as \var{PChar} types.
|
|
|
|
-The format of the numerical conversions can be influenced through
|
|
|
|
-the following modifiers:
|
|
|
|
-\var{ OutputVariable : NumChars [: Decimals ] }
|
|
|
|
-This will print the value of \var{OutputVariable} with a minimum of
|
|
|
|
-\var{NumChars} characters, from which \var{Decimals} are reserved for the
|
|
|
|
-decimals. If the number cannot be represented with \var{NumChars} characters,
|
|
|
|
-\var{NumChars} will be increased, until the representation fits. If the
|
|
|
|
-representation requires less than \var{NumChars} characters then the output
|
|
|
|
-is filled up with spaces, to the left of the generated string, thus
|
|
|
|
-resulting in a right-aligned representation.
|
|
|
|
-If no formatting is specified, then the number is written using its natural
|
|
|
|
-length, with nothing in front of it if it's positive, and a minus sign if
|
|
|
|
-it's negative.
|
|
|
|
-Real numbers are, by default, written in scientific notation.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-If an error occurs, a run-time error is generated. This behavior can be
|
|
|
|
-controlled with the \var{\{\$i\}} switch.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{WriteLn}, \seep{Read}, \seep{Readln}, \seep{Blockwrite}
|
|
|
|
-\end{procedure}
|
|
|
|
-\begin{procedure}{WriteLn}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure WriteLn [([Var F : Text;] [V1 [; V2; ... , Vn)]];
|
|
|
|
-
|
|
|
|
-\Description
|
|
|
|
-\var{WriteLn} does the same as \seep{Write} for text files, and emits a
|
|
|
|
-Carriage Return - LineFeed character pair after that.
|
|
|
|
-If the parameter \var{F} is omitted, standard output is assumed.
|
|
|
|
-If no variables are specified, a Carriage Return - LineFeed character pair
|
|
|
|
-is emitted, resulting in a new line in the file \var{F}.
|
|
|
|
-\begin{remark}
|
|
|
|
-Under \linux and \unix, the Carriage Return character is omitted, as
|
|
|
|
-customary in Unix environments.
|
|
|
|
-\end{remark}
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-If an error occurs, a run-time error is generated. This behavior can be
|
|
|
|
-controlled with the \var{\{\$i\}} switch.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Write}, \seep{Read}, \seep{Readln}, \seep{Blockwrite}
|
|
|
|
-\end{procedure}
|
|
|
|
-\FPCexample{ex75}
|
|
|
|
-
|
|
|
|
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
-% The objpas unit
|
|
|
|
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
-\chapter{The OBJPAS unit}
|
|
|
|
-The \file{objpas} unit is meant for compatibility with Object Pascal as
|
|
|
|
-implemented by Delphi. The unit is loaded automatically by the \fpc compiler
|
|
|
|
-whenever the \var{Delphi} or \var{objfpc} more is entered, either through
|
|
|
|
-the command line switches \var{-Sd} or \var{-Sh} or with the \var{\{\$MODE
|
|
|
|
-DELPHI\}} or \var{\{\$MODE OBJFPC\}} directives.
|
|
|
|
-
|
|
|
|
-It redefines some basic pascal types, introduces some functions for
|
|
|
|
-compatibility with Delphi's system unit, and introduces some methods for the
|
|
|
|
-management of the resource string tables.
|
|
|
|
-
|
|
|
|
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
-% Tytpes
|
|
|
|
-\section{Types}
|
|
|
|
-The \file{objpas} unit redefines two integer types, for compatibity with
|
|
|
|
-Delphi:
|
|
|
|
-\begin{verbatim}
|
|
|
|
-type
|
|
|
|
- smallint = system.integer;
|
|
|
|
- integer = system.longint;
|
|
|
|
-\end{verbatim}
|
|
|
|
-The resource string tables can be managed with a callback function which the
|
|
|
|
-user must provide: \var{TResourceIterator}.
|
|
|
|
-\begin{verbatim}
|
|
|
|
-Type
|
|
|
|
- TResourceIterator =
|
|
|
|
- Function (Name,Value : AnsiString;Hash : Longint):AnsiString;
|
|
|
|
-\end{verbatim}
|
|
|
|
-
|
|
|
|
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
-% Functions and procedures
|
|
|
|
-\section{Functions and Procedures}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{AssignFile}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure AssignFile(Var f: FileType;Name: Character type);
|
|
|
|
-\Description
|
|
|
|
-\var{AssignFile} is completely equivalent to the system unit's \seep{Assign}
|
|
|
|
-function: It assigns \var{Name} to a function of any type (\var{FileType}
|
|
|
|
-can be \var{Text} or a typed or untyped \var{File} variable). \var{Name} can
|
|
|
|
-be a string, a single character or a \var{PChar}.
|
|
|
|
-
|
|
|
|
-It is most likely introduced to avoid confusion between the regular
|
|
|
|
-\seep{Assign} function and the \var{Assign} method of \var{TPersistent}
|
|
|
|
-in the Delphi VCL.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{CloseFile}, \seep{Assign}, \seep{Reset}, \seep{Rewrite}, \seep{Append}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex88}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{CloseFile}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure CloseFile(Var F: FileType);
|
|
|
|
-\Description
|
|
|
|
-\var{CloseFile} flushes and closes a file \var{F} of any file type.
|
|
|
|
-\var{F} can be \var{Text} or a typed or untyped \var{File} variable.
|
|
|
|
-After a call to \var{CloseFile}, any attempt to write to the file \var{F}
|
|
|
|
-will result in an error.
|
|
|
|
-
|
|
|
|
-It is most likely introduced to avoid confusion between the regular
|
|
|
|
-\seep{Close} function and the \var{Close} method of \var{TForm}
|
|
|
|
-in the Delphi VCL.
|
|
|
|
-
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Close}, \seep{AssignFile}, \seep{Reset}, \seep{Rewrite}, \seep{Append}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-for an example, see \seep{AssignFile}.
|
|
|
|
-
|
|
|
|
-\begin{procedurel}{Freemem}{objpasfreemem}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure FreeMem(Var p:pointer[;Size:Longint]);
|
|
|
|
-\Description
|
|
|
|
-\var{FreeMem} releases the memory reserved by a call to
|
|
|
|
-\seepl{GetMem}{objpasgetmem}. The (optional) \var{Size} parameter is
|
|
|
|
-ignored, since the object pascal version of \var{GetMem} stores the amount
|
|
|
|
-of memory that was requested.
|
|
|
|
-
|
|
|
|
-Be sure not to release memory that was not obtained with the \var{Getmem}
|
|
|
|
-call in \file{Objpas}. Normally, this should not happen, since objpas
|
|
|
|
-changes the default memory manager to it's own memory manager.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Freemem}, \seepl{GetMem}{objpasgetmem}, \seep{Getmem}
|
|
|
|
-\end{procedurel}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex89}
|
|
|
|
-
|
|
|
|
-\begin{procedurel}{Getmem}{objpasgetmem}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure Getmem(Var P:pointer;Size:Longint);
|
|
|
|
-\Description
|
|
|
|
-\var{GetMem} reserves \var{Size} bytes of memory on the heap and returns
|
|
|
|
-a pointer to it in \var{P}. \var{Size} is stored at offset -4 of the
|
|
|
|
-result, and is used to release the memory again. \var{P} can be a typed or
|
|
|
|
-untyped pointer.
|
|
|
|
-
|
|
|
|
-Be sure to release this memory with the \seepl{FreeMem}{objpasfreemem} call
|
|
|
|
-defined in the \file{objpas} unit.
|
|
|
|
-\Errors
|
|
|
|
-In case no more memory is available, and no more memory could be obtained
|
|
|
|
-from the system a run-time error is triggered.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seepl{FreeMem}{objpasfreemem}, \seep{Getmem}.
|
|
|
|
-\end{procedurel}
|
|
|
|
-
|
|
|
|
-For an example, see \seepl{FreeMem}{objpasfreemem}.
|
|
|
|
-
|
|
|
|
-\begin{function}{GetResourceStringCurrentValue}
|
|
|
|
-\Declaration
|
|
|
|
-Function GetResourceStringCurrentValue(TableIndex,StringIndex : Longint) : AnsiString;
|
|
|
|
-\Description
|
|
|
|
-\var{GetResourceStringCurrentValue} returns the current value of the
|
|
|
|
-resourcestring in table \var{TableIndex} with index \var{StringIndex}.
|
|
|
|
-
|
|
|
|
-The current value depends on the system of internationalization that was
|
|
|
|
-used, and which language is selected when the program is executed.
|
|
|
|
-\Errors
|
|
|
|
-If either \var{TableIndex} or \var{StringIndex} are out of range, then
|
|
|
|
-a empty string is returned.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{SetResourceStrings},
|
|
|
|
-\seef{GetResourceStringDefaultValue},
|
|
|
|
-\seef{GetResourceStringHash},
|
|
|
|
-\seef{GetResourceStringName},
|
|
|
|
-\seef{ResourceStringTableCount},
|
|
|
|
-\seef{ResourceStringCount}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex90}
|
|
|
|
-
|
|
|
|
-\begin{function}{GetResourceStringDefaultValue}
|
|
|
|
-\Declaration
|
|
|
|
-Function GetResourceStringDefaultValue(TableIndex,StringIndex : Longint) : AnsiString
|
|
|
|
-\Description
|
|
|
|
-\var{GetResourceStringDefaultValue} returns the default value of the
|
|
|
|
-resourcestring in table \var{TableIndex} with index \var{StringIndex}.
|
|
|
|
-
|
|
|
|
-The default value is the value of the string that appears in the source code
|
|
|
|
-of the programmer, and is compiled into the program.
|
|
|
|
-\Errors
|
|
|
|
-If either \var{TableIndex} or \var{StringIndex} are out of range, then
|
|
|
|
-a empty string is returned.
|
|
|
|
-\Errors
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{SetResourceStrings},
|
|
|
|
-\seef{GetResourceStringCurrentValue},
|
|
|
|
-\seef{GetResourceStringHash},
|
|
|
|
-\seef{GetResourceStringName},
|
|
|
|
-\seef{ResourceStringTableCount},
|
|
|
|
-\seef{ResourceStringCount}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex91}
|
|
|
|
-
|
|
|
|
-\begin{function}{GetResourceStringHash}
|
|
|
|
-\Declaration
|
|
|
|
-Function GetResourceStringHash(TableIndex,StringIndex : Longint) : Longint;
|
|
|
|
-\Description
|
|
|
|
-\var{GetResourceStringHash} returns the hash value associated with the
|
|
|
|
-resource string in table \var{TableIndex}, with index \var{StringIndex}.
|
|
|
|
-
|
|
|
|
-The hash value is calculated from the default value of the resource string
|
|
|
|
-in a manner that gives the same result as the GNU \file{gettext} mechanism.
|
|
|
|
-It is stored in the resourcestring tables, so retrieval is faster than
|
|
|
|
-actually calculating the hash for each string.
|
|
|
|
-\Errors
|
|
|
|
-If either \var{TableIndex} or \var{StringIndex} is zero, 0 is returned.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Hash}
|
|
|
|
-\seep{SetResourceStrings},
|
|
|
|
-\seef{GetResourceStringDefaultValue},
|
|
|
|
-\seef{GetResourceStringHash},
|
|
|
|
-\seef{GetResourceStringName},
|
|
|
|
-\seef{ResourceStringTableCount},
|
|
|
|
-\seef{ResourceStringCount}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-For an example, see \seef{Hash}.
|
|
|
|
-
|
|
|
|
-\begin{function}{GetResourceStringName}
|
|
|
|
-\Declaration
|
|
|
|
-Function GetResourceStringName(TableIndex,StringIndex : Longint) : Ansistring;
|
|
|
|
-\Description
|
|
|
|
-\var{GetResourceStringName} returns the name of the resourcestring in table
|
|
|
|
-\var{TableIndex} with index \var{StringIndex}. The name of the string is
|
|
|
|
-always the unit name in which the string was declared, followed by a period
|
|
|
|
-and the name of the constant, all in lowercase.
|
|
|
|
-
|
|
|
|
-If a unit \file{MyUnit} declares a resourcestring \var{MyTitle} then the
|
|
|
|
-name returned will be \var{myunit.mytitle}. A resourcestring in the program file
|
|
|
|
-will have the name of the program prepended.
|
|
|
|
-
|
|
|
|
-The name returned by this function is also the name that is stored in the
|
|
|
|
-resourcestring file generated by the compiler.
|
|
|
|
-
|
|
|
|
-Strictly speaking, this information isn't necessary for the functioning
|
|
|
|
-of the program, it is provided only as a means to easier translation of
|
|
|
|
-strings.
|
|
|
|
-\Errors
|
|
|
|
-If either \var{TableIndex} or \var{StringIndex} is zero, an empty string
|
|
|
|
-is returned.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{SetResourceStrings},
|
|
|
|
-\seef{GetResourceStringDefaultValue},
|
|
|
|
-\seef{GetResourceStringHash},
|
|
|
|
-\seef{GetResourceStringName},
|
|
|
|
-\seef{ResourceStringTableCount},
|
|
|
|
-\seef{ResourceStringCount}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex92}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-\begin{function}{Hash}
|
|
|
|
-\Declaration
|
|
|
|
-Function Hash(S : AnsiString) : longint;
|
|
|
|
-\Description
|
|
|
|
-\var{Hash} calculates the hash value of the string \var{S} in a manner that
|
|
|
|
-is compatible with the GNU gettext hash value for the string. It is the same
|
|
|
|
-value that is stored in the Resource string tables, and which can be
|
|
|
|
-retrieved with the \seef{GetResourceStringHash} function call.
|
|
|
|
-\Errors
|
|
|
|
- None. In case the calculated hash value should be 0, the returned result
|
|
|
|
-will be -1.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{GetResourceStringHash},
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex93}
|
|
|
|
-
|
|
|
|
-\begin{functionl}{Paramstr}{objpasparamstr}
|
|
|
|
-\Declaration
|
|
|
|
-Function ParamStr(Param : Integer) : Ansistring;
|
|
|
|
-\Description
|
|
|
|
-\var{ParamStr} returns the \var{Param}-th command-line parameter as an
|
|
|
|
-AnsiString. The system unit \seef{Paramstr} function limits the result to
|
|
|
|
-255 characters.
|
|
|
|
-
|
|
|
|
-The zeroeth command-line parameter contains the path of the executable,
|
|
|
|
-except on \linux, where it is the command as typed on the command-line.
|
|
|
|
-\Errors
|
|
|
|
-In case \var{Param} is an invalid value, an empty string is returned.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{Paramstr}
|
|
|
|
-\end{functionl}
|
|
|
|
-
|
|
|
|
-For an example, see \seef{Paramstr}.
|
|
|
|
-
|
|
|
|
-\begin{function}{ReAllocMem}
|
|
|
|
-\Declaration
|
|
|
|
-function ReAllocMem(var p:pointer;Size:Longint):pointer;
|
|
|
|
-\Description
|
|
|
|
-\var{ReAllocMem} resizes the memory pointed to by \var{P} so it has size
|
|
|
|
-\var{Size}. The value of \var{P} may change during this operation.
|
|
|
|
-The contents of the memory pointed to by \var{P} (if any) will be copied to
|
|
|
|
-the new location, but may be truncated if the newly allocated memory block
|
|
|
|
-is smaller in size. If a larger block is allocated, only the used memory is
|
|
|
|
-initialized, extra memory will not be zeroed out.
|
|
|
|
-
|
|
|
|
-Note that \var{P} may be nil, in that case the behaviour of \var{ReAllocMem}
|
|
|
|
-is equivalent to \seep{Getmem}.
|
|
|
|
-\Errors
|
|
|
|
-If no memory is available then a run-time error will occur.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{Getmem}, \seep{Freemem}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{ResetResourceTables}
|
|
|
|
-\Declaration
|
|
|
|
-Procedure ResetResourceTables;
|
|
|
|
-\Description
|
|
|
|
-\var{ResetResourceTables} resets all resource strings to their default
|
|
|
|
-(i.e. as in the source code) values.
|
|
|
|
-
|
|
|
|
-Normally, this should never be called from a user's program. It is called
|
|
|
|
-in the initialization code of the \file{objpas} unit. However, if the
|
|
|
|
-resourcetables get messed up for some reason, this procedure will fix them
|
|
|
|
-again.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{SetResourceStrings},
|
|
|
|
-\seef{GetResourceStringDefaultValue},
|
|
|
|
-\seef{GetResourceStringHash},
|
|
|
|
-\seef{GetResourceStringName},
|
|
|
|
-\seef{ResourceStringTableCount},
|
|
|
|
-\seef{ResourceStringCount}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\begin{function}{ResourceStringCount}
|
|
|
|
-\Declaration
|
|
|
|
-Function ResourceStringCount(TableIndex : longint) : longint;
|
|
|
|
-\Description
|
|
|
|
-\var{ResourceStringCount} returns the number of resourcestrings in
|
|
|
|
-the table with index \var{TableIndex}. The strings in a particular table
|
|
|
|
-are numbered from \var{0} to \var{ResourceStringCount-1}, i.e. they're zero
|
|
|
|
-based.
|
|
|
|
-\Errors
|
|
|
|
-If an invalid \var{TableIndex} is given, \var{-1} is returned.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{SetResourceStrings},
|
|
|
|
-\seef{GetResourceStringCurrentValue},
|
|
|
|
-\seef{GetResourceStringDefaultValue},
|
|
|
|
-\seef{GetResourceStringHash},
|
|
|
|
-\seef{GetResourceStringName},
|
|
|
|
-\seef{ResourceStringTableCount},
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-For an example, see \seef{GetResourceStringDefaultValue}
|
|
|
|
-
|
|
|
|
-\begin{function}{ResourceStringTableCount}
|
|
|
|
-\Declaration
|
|
|
|
-Function ResourceStringTableCount : Longint;
|
|
|
|
-\Description
|
|
|
|
-\var{ResourceStringTableCount} returns the number of resource string tables;
|
|
|
|
-this may be zero if no resource strings are used in a program.
|
|
|
|
-
|
|
|
|
-The tables are numbered from 0 to \var{ResourceStringTableCount-1}, i.e.
|
|
|
|
-they're zero based.
|
|
|
|
-\Errors
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{SetResourceStrings},
|
|
|
|
-\seef{GetResourceStringDefaultValue},
|
|
|
|
-\seef{GetResourceStringHash},
|
|
|
|
-\seef{GetResourceStringName},
|
|
|
|
-\seef{ResourceStringCount}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-For an example, see \seef{GetResourceStringDefaultValue}
|
|
|
|
-
|
|
|
|
-\begin{procedure}{SetResourceStrings}
|
|
|
|
-\Declaration
|
|
|
|
-TResourceIterator = Function (Name,Value : AnsiString;Hash : Longint):AnsiString;
|
|
|
|
-
|
|
|
|
-Procedure SetResourceStrings (SetFunction : TResourceIterator);
|
|
|
|
-\Description
|
|
|
|
-\var{SetResourceStrings} calls \var{SetFunction} for all resourcestrings
|
|
|
|
-in the resourcestring tables and sets the resourcestring's current value
|
|
|
|
-to the value returned by \var{SetFunction}.
|
|
|
|
-
|
|
|
|
-The \var{Name},\var{Value} and \var{Hash} parameters passed to the iterator
|
|
|
|
-function are the values stored in the tables.
|
|
|
|
-\Errors
|
|
|
|
-None.
|
|
|
|
-\SeeAlso
|
|
|
|
-\seef{GetResourceStringCurrentValue},
|
|
|
|
-\seef{GetResourceStringDefaultValue},
|
|
|
|
-\seef{GetResourceStringHash},
|
|
|
|
-\seef{GetResourceStringName},
|
|
|
|
-\seef{ResourceStringTableCount},
|
|
|
|
-\seef{ResourceStringCount}
|
|
|
|
-\end{procedure}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex95}
|
|
|
|
-
|
|
|
|
-\begin{function}{SetResourceStringValue}
|
|
|
|
-\Declaration
|
|
|
|
-Function SetResourceStringValue(TableIndex,StringIndex : longint; Value : Ansistring) : Boolean;
|
|
|
|
-\Description
|
|
|
|
-\var{SetResourceStringValue} assigns \var{Value} to the resource string in
|
|
|
|
-table \var{TableIndex} with index \var{StringIndex}.
|
|
|
|
-\Errors
|
|
|
|
-\SeeAlso
|
|
|
|
-\seep{SetResourceStrings},
|
|
|
|
-\seef{GetResourceStringCurrentValue},
|
|
|
|
-\seef{GetResourceStringDefaultValue},
|
|
|
|
-\seef{GetResourceStringHash},
|
|
|
|
-\seef{GetResourceStringName},
|
|
|
|
-\seef{ResourceStringTableCount},
|
|
|
|
-\seef{ResourceStringCount}
|
|
|
|
-\end{function}
|
|
|
|
-
|
|
|
|
-\FPCexample{ex94}
|
|
|
|
-
|
|
|
|
|
|
|
|
%
|
|
%
|
|
% The index.
|
|
% The index.
|