Browse Source

+ Fixed several bug reports

michael 20 years ago
parent
commit
43663a01f5
8 changed files with 28 additions and 502 deletions
  1. 2 2
      docs/Makefile
  2. 1 1
      docs/classes.xml
  3. 3 1
      docs/dos.xml
  4. 2 2
      docs/fpc.sty
  5. 15 32
      docs/prog.tex
  6. 2 1
      docs/ref.tex
  7. 0 461
      docs/system.xml
  8. 3 2
      docs/sysutils.xml

+ 2 - 2
docs/Makefile

@@ -1444,9 +1444,9 @@ PREAMBLETYPE = report
 ifndef CROSSCOMPILE
 ifndef CROSSCOMPILE
 ifndef FPDOC
 ifndef FPDOC
 ifneq ($(wildcard ../utils/fpdoc/fpdoc),)
 ifneq ($(wildcard ../utils/fpdoc/fpdoc),)
-FPDOC=../utils/fpdoc/fpdoc
+FPDOC=../utils/fpdoc/fpdoc --warn-no-node --hide-protected
 else
 else
-FPDOC=fpdoc
+FPDOC=fpdoc --warn-no-node
 endif
 endif
 endif
 endif
 endif
 endif

+ 1 - 1
docs/classes.xml

@@ -4051,7 +4051,7 @@ exception when the <var>Read</var> is used.
 </element>
 </element>
 
 
 <element name="TStream.Write">  <!-- Function -->
 <element name="TStream.Write">  <!-- Function -->
-<short>Writes data from the stream to the buffer and returns the number of
+<short>Writes data from a buffer to the stream and returns the number of
 bytes written.</short>
 bytes written.</short>
 <descr>
 <descr>
 <p>
 <p>

+ 3 - 1
docs/dos.xml

@@ -650,7 +650,9 @@ The length is limited to 255 characters.
 <descr>
 <descr>
 <p>
 <p>
 <var>Exec</var> executes the program in <var>Path</var>, with the options given by
 <var>Exec</var> executes the program in <var>Path</var>, with the options given by
-<var>ComLine</var>.
+<var>ComLine</var>. The program name should <em>not</em> appear again in
+<var>ComLine</var>, it is specified in <var>Path</var>. Comline contains only the 
+parameters that are passed to the program.
 </p>
 </p>
 <p>
 <p>
 After the program has terminated, the procedure returns. The Exit value of
 After the program has terminated, the procedure returns. The Exit value of

+ 2 - 2
docs/fpc.sty

@@ -64,7 +64,7 @@
   \gdef\@thanks{}\gdef\@author{}\gdef\@title{}}
   \gdef\@thanks{}\gdef\@author{}\gdef\@title{}}
   % end of \maketitle
   % end of \maketitle
 % For the \procedure and \function commands, we don't want heading numbers.
 % For the \procedure and \function commands, we don't want heading numbers.
-\setcounter{secnumdepth}{1}
+\setcounter{secnumdepth}{2}
 % redefine the subsection command to leave less space,
 % redefine the subsection command to leave less space,
 %and to use sans serif
 %and to use sans serif
 \renewcommand\subsection{\@startsection%
 \renewcommand\subsection{\@startsection%
@@ -227,7 +227,7 @@
   \usepackage[pdftex,bookmarks=true,colorlinks=true,linkcolor=blue]{hyperref}
   \usepackage[pdftex,bookmarks=true,colorlinks=true,linkcolor=blue]{hyperref}
   \usepackage{times}
   \usepackage{times}
   \usepackage[T1]{fontenc}
   \usepackage[T1]{fontenc}
-  \setcounter{secnumdepth}{1}
+  \setcounter{secnumdepth}{2}
   \setcounter{tocdepth}{3}
   \setcounter{tocdepth}{3}
   \pdfcompresslevel=9
   \pdfcompresslevel=9
   \pdfpagewidth=210mm
   \pdfpagewidth=210mm

+ 15 - 32
docs/prog.tex

@@ -181,6 +181,18 @@ This can be used mainly for debugging purposes. The \file{system} unit sets the
 and simply exits. The \file{sysutils} unit catches the run-time error 227
 and simply exits. The \file{sysutils} unit catches the run-time error 227
 and raises an \var{EAssertionFailed} exception.
 and raises an \var{EAssertionFailed} exception.
 
 
+\subsection{\var{\protect\$CHECKPOINTER} : Check pointer values}
+The \var{\{\$CHECKPOINTER\}} directive turns heap pointer checking on (value
+\var{ON}} or off (value \var{OFF}). When heap pointer checking is on and the
+code is compiled with the \var{-gh} (heaptrace) option on, then a check is
+inserted when dereferencing a pointer. The check will verify that the
+pointer contains a valid value, i.e. points to a location that is reachable
+by the program: the stack or a location in the heap. If not, a run-time error
+216 or 204 is raised.
+
+If the code is compiled without \var{-gl} switch, then this directive has no
+effect. Note that this considerably slows down the code.
+
 \subsection{\var{\protect\$DEFINE} : Define a symbol}
 \subsection{\var{\protect\$DEFINE} : Define a symbol}
 
 
 The directive
 The directive
@@ -2838,7 +2850,7 @@ When a routine is declared within the scope of a procedure or
 function, it is said to be nested. In this case, an additional
 function, it is said to be nested. In this case, an additional
 invisible parameter is passed to the nested routine. This
 invisible parameter is passed to the nested routine. This
 additional parameter is the frame pointer address of the
 additional parameter is the frame pointer address of the
-calling routine. This permits the nested routine to access
+parent routine. This permits the nested routine to access
 the local variables and parameters of the calling routine.
 the local variables and parameters of the calling routine.
 
 
 The resulting stack frame after the entry code of a simple nested procedure
 The resulting stack frame after the entry code of a simple nested procedure
@@ -4147,40 +4159,11 @@ The algorithm for allocating memory is as follows:
 or of bigger size, if so it is allocated and the routine exits.
 or of bigger size, if so it is allocated and the routine exits.
 \item If not found in the \var{freelist} the heap is grown to allocate the
 \item If not found in the \var{freelist} the heap is grown to allocate the
 specified memory, and the routine exits.
 specified memory, and the routine exits.
-\item If the heap cannot be grown internally anymore and if \var{heaperror} is set
-accordingly, it calls the heap error handler. If there is no heap error handler
-installed, the runtime library generates a runtime error 203.
+\item If the heap cannot be grown internally anymore, the runtime library 
+generates a runtime error 203.
 \end{enumerate}
 \end{enumerate}
 
 
 
 
-% Error handler routinr
-\subsection{The HeapError variable}
-
-The heap error permits developpers to install a heap error hook which
-is called each time an allocation cannot be completed by the default
-heap manager. \var{HeapError} is a pointer that points to a function
-with the following prototype:
-
-\begin{verbatim}
-  function HeapFunc(size : longint): integer;
-\end{verbatim}
-
-The \var{size} parameter indicates the size of the block which could
-not be allocated. Depending on the success, the error handler routine
-should return a value which indicates what the default heap manager
-should do thereafter (cf. \seet{Heaperrorresult}).
-
-\begin{FPCltable}{|c|l|}{Heap error result}{Heaperrorresult}
-\hline
- Value returned & Memory manager action \\ \hline
- 0		& Generates a runtime error 203 \\
- 1		& \var{GetMem},\var{ReallocMem} and \var{New} returns \var{nil} \\
- 2		& Try allocating the memory block once again \\
-\hline
-\end{FPCltable}
-
-
-
 % The heap grows
 % The heap grows
 \subsection{The heap grows}
 \subsection{The heap grows}
 By default, \var{HeapError} points to the \var{GrowHeap} function,
 By default, \var{HeapError} points to the \var{GrowHeap} function,

+ 2 - 1
docs/ref.tex

@@ -1242,7 +1242,8 @@ Type
   
   
 var   
 var   
   A,B : TA;
   A,B : TA;
-  I,J : Integer;
+  I : Integer;
+
 begin
 begin
   Setlength(A,10);
   Setlength(A,10);
   For I:=0 to 9 do
   For I:=0 to 9 do

+ 0 - 461
docs/system.xml

@@ -43,467 +43,6 @@ and procedures.
 </p>
 </p>
 </descr>
 </descr>
 
 
-<topic name="integertypes">
-<short>Integer Types</short>
-<descr>
-<p>
-The following integer types are defined in the System unit:
-</p>
-<code>
-Shortint = -128..127;
-SmallInt = -32768..32767;
-Longint  = $80000000..$7fffffff;
-byte     = 0..255;
-word     = 0..65535;
-dword    = longword;
-cardinal = longword;
-Integer  = smallint;
-</code>
-<p>
-The following types are used for the functions that need compiler magic
-such as <link id="Val"/> or <link id="Str"/>:
-</p>
-<code>
-StrLenInt = LongInt;
-ValSInt = Longint;
-ValUInt = Cardinal;
-ValReal = Extended;
-</code>
-<p>
-The <var>Real48</var> type is defined to emulate the old Turbo Pascal <var>Real</var> type:
-</p>
-<code>
-Real48 = Array[0..5] of byte;
-</code>
-<p>
-The assignment operator has been overloaded so this type can be assigned
-to the Free Pascal native <var>Double</var> and <var>Extended</var> types.
-<link id="Real2Double"/>.
-</p>
-<p>
-The following character types are defined for Delphi compatibility:
-</p>
-<code>
-TAnsiChar   = Char;
-AnsiChar    = TAnsiChar;
-</code>
-<p>
-And the following pointer types as well:
-</p>
-<code>
-  PChar = ^char;
-  pPChar = ^PChar;
-  PAnsiChar   = PChar;
-  PQWord      = ^QWord;
-  PInt64      = ^Int64;
-  pshortstring = ^shortstring;
-  plongstring  = ^longstring;
-  pansistring  = ^ansistring;
-  pwidestring  = ^widestring;
-  pextended    = ^extended;
-  ppointer     = ^pointer;
-</code>
-<p>
-For the <link id="SetJmp"/> and <link id="LongJmp"/> calls, the following jump bufer
-type is defined (for the I386 processor):
-</p>
-<code>
-  jmp_buf = record
-    ebx,esi,edi : Longint;
-    bp,sp,pc : Pointer;
-    end;
-  PJmp_buf = ^jmp_buf;
-</code>
-<p>
-The following records and pointers can be used to scan the
-entries in the string message handler tables:
-</p>
-<code>
-  tmsgstrtable = record
-     name : pshortstring;
-     method : pointer;
-  end;
-  pmsgstrtable = ^tmsgstrtable;
-
-  tstringmessagetable = record
-     count : dword;
-     msgstrtable : array[0..0] of tmsgstrtable;
-  end;
-  pstringmessagetable = ^tstringmessagetable;
-</code>
-<p>
-The base class for all classes is defined as:
-</p>
-<code>
-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;
-</code>
-<p>
-Unhandled exceptions can be treated using a constant of the
-<var>TExceptProc</var> type:
-</p>
-<code>
-TExceptProc = Procedure (Obj : TObject; Addr,Frame: Pointer);
-</code>
-<p>
-<var>Obj</var> is the exception object that was used to raise the exception,
-<var>Addr</var> and <var>Frame</var> contain the exact address and stack frame
-where the exception was raised.
-</p>
-<p>
-The <var>TVarRec</var> type is used to access the elements passed in a \var{Array
-of Const} argument to a function or procedure:
-</p>
-<code>
-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;
-</code>
-<p>
-The heap manager uses the <var>TMemoryManager</var> type:
-</p>
-<code>
-  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;
-    HeapSize    : Function:Longint;
-  end;
-</code>
-<p>
-More information on using this record can be found in \progref.
-</p>
-</descr>
-</topic>
-
-<topic name="Constants">
-<short>Constants</short>
-<descr>
-<p>
-The following constants define the maximum values that can be used with
-various types:
-</p>
-<code>
-  MaxSIntValue = High(ValSInt);
-  MaxUIntValue = High(ValUInt);
-  maxint   = maxsmallint;
-  maxLongint  = $7fffffff;
-  maxSmallint = 32767;
-</code>
-<p>
-The following constants for file-handling are defined in the system unit:
-</p>
-<code>
-Const
-  fmclosed = $D7B0;
-  fminput  = $D7B1;
-  fmoutput = $D7B2;
-  fminout  = $D7B3;
-  fmappend = $D7B4;
-  filemode : byte = 2;
-</code>
-<p>
-The <var>filemode</var> variable is used when a non-text file is opened using
-<var>Reset</var>. It indicates how the file will be opened. <var>filemode</var> can have one of
-the following values:
-</p>
-<dl>
-<dt>0</dt><dd> The file is opened for reading.
-</dd><dt>1</dt><dd> The file is opened for writing.
-</dd><dt>2</dt><dd> The file is opened for reading and writing.
-</dd>
-</dl>
-<p>
-The default value is 2. Other values are possible but are operating system specific.
-</p>
-<p>
-Further, the following non processor specific general-purpose constants
-are also defined:
-</p>
-<code>
-const
-  erroraddr : pointer = nil;
-  errorcode : word = 0;
- { max level in dumping on error }
-  max_frame_dump : word = 20;
-</code>
-<p>
-</p>
-<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.
-</remark>
-<p>
-The following constants are defined to access VMT entries:
-</p>
-<code>
-   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;
-</code>
-<p>
-The constant names should be used, and never their values, because
-the VMT table can change, breaking code that uses direct values.
-</p>
-<p>
-The following constants will be used for the planned <var>variant</var> support:
-</p>
-<code>
-  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;
-</code>
-<p>
-The following constants are used in the <var>TVarRec</var> record:
-</p>
-<code>
-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;
-</code>
-<p>
-The <var>ExceptProc</var> is called when an unhandled exception occurs:
-</p>
-<code>
-Const
-  ExceptProc : TExceptProc = Nil;
-</code>
-<p>
-It is set in the <file>objpas</file> unit, but it can be set by the programmer
-to change the default exception handling.
-</p>
-<p>
-The following constants are defined to describe the operating system's file
-system:
-</p>
-<code>
-LineEnding = #10;
-LFNSupport = true;
-DirectorySeparator = '/';
-DriveSeparator = ':';
-PathSeparator = ':';
-FileNameCaseSensitive : Boolean = True;
-</code>
-<p>
-The shown values are for unix platforms, but will be different on other
-platforms.
-The meaning of the constants is the following:
-</p>
-<dl>
-<dt>LineEnding</dt>
-<dd> End of line marker. This constant is used when writing end
-of lines to text files.
-</dd>
-<dt>LFNSupport</dt>
-<dd> This is <var>True</var> if the system supports long file names,
-i.e. filenames that are not restricted to 8.3 characters.
-</dd>
-<dt>DirectorySeparator</dt>
-<dd> The character that is used as a directory
-separator, i.e. it appears between various parts of a path to a file.
-</dd>
-<dt>DriveSeparator</dt>
-<dd> On systems that support drive letters, this character
-separates the drive indication from the rest of a filename.
-</dd>
-<dt>PathSeparator</dt>
-<dd> This character can be found between elements in a
-series of paths (such as the contents of the <var>PATH</var> environment
-variable.
-</dd>
-<dt>FileNameCaseSensitive</dt>
-<dd> Indicates whether filenames are case sensitive.
-</dd>
-</dl>
-<p>
-When programming cross-platform, use these constants instead of hard-coded
-characters. This will enhance portability of an application.
-</p>
-</descr>
-</topic>
-
-<topic name="variables">
-<short>Variables</short>
-<descr>
-<p>
-The following variables are defined and initialized in the system unit:
-</p>
-<code>
-var
-  output,input,stderr : text;
-  exitproc : pointer;
-  exitcode : word;
-  stackbottom : Cardinal;
-</code>
-<p>
-The variables <var>ExitProc</var>, <var>exitcode</var> are used in the Free Pascal exit
-scheme. It works similarly to the one in Turbo Pascal:
-</p>
-<p>
-When a program halts (be it through the call of the <var>Halt</var> function or
-<var>Exit</var> or through a run-time error), the exit mechanism checks the value
-of <var>ExitProc</var>. If this one is non-<var>Nil</var>, it is set to <var>Nil</var>, and
-the procedure is called. If the exit procedure exits, the value of ExitProc
-is checked again. If it is non-<var>Nil</var> then the above steps are repeated.
-So when an exit procedure must be installed, the old value of <var>ExitProc</var>
-should be saved (it may be non-<var>Nil</var>, since other units could have set
-it). In the exit procedure the value of <var>ExitProc</var> should be restored to
-the previous value, such that if it was non-<var>Nil</var> the exit-procedure can be
-called.
-</p>
-<p>
-The <var>ErrorAddr</var> and <var>ExitCode</var> can be used to check for
-error-conditions. If <var>ErrorAddr</var> is non-<var>Nil</var>, a run-time error has
-occurred. If so, <var>ExitCode</var> contains the error code. If <var>ErrorAddr</var> is
-<var>Nil</var>, then {ExitCode} contains the argument to <var>Halt</var> or 0 if the
-program terminated normally.
-</p>
-<p>
-<var>ExitCode</var> is always passed to the operating system as the exit-code of
-the current process.
-</p>
-<remark>
-The maximum error code under linux and unix like operating systems is 127.
-</remark>
-<p>
-Under <file>GO32</file>, the following constants are also defined :
-</p>
-<code>
-const
-   seg0040 = $0040;
-   segA000 = $A000;
-   segB000 = $B000;
-   segB800 = $B800;
-</code>
-<p>
-These constants allow easy access to the bios/screen segment via mem/absolute.
-</p>
-<p>
-The randomize function uses a seed stored in the <var>RandSeed</var> variable:
-</p>
-<code>
-  RandSeed    : Cardinal;
-</code>
-<p>
-This variable is initialized in the initialization code of the system unit.
-</p>
-<p>
-Other variables indicate the state of the application.
-</p>
-<code>
-  IsLibrary : boolean;
-  IsMultiThread : boolean;
-</code>
-<p>
-The <var>IsLibrary</var> variable is set to true if this module is a
-shared library instead of an application. The <var>IsMultiThread</var>
-variable is set to True if the application has spawned other
-threads, otherwise, and by default, it is set to False.
-</p>
-</descr>
-<example file="refex/ex98"/>
-</topic>
-
 <topic name="FileFunctions">
 <topic name="FileFunctions">
 <short>File handling functions</short>
 <short>File handling functions</short>
 <descr>
 <descr>

+ 3 - 2
docs/sysutils.xml

@@ -1084,8 +1084,9 @@ On error, <var>False</var> is returned.
 <element name="DoDirSeparators">
 <element name="DoDirSeparators">
 <short>Convert known directory separators to the current directory separator.</short>
 <short>Convert known directory separators to the current directory separator.</short>
 <descr>
 <descr>
-This function replaces all known directory separators
-to the directory separator character for the current system.
+This function replaces all known directory separators in <var>FileName</var>
+to the directory separator character for the current system. The list of
+known separators is specified in the <link id="DirSeparators"/> constant.
 </descr>
 </descr>
 <errors>
 <errors>
 None.
 None.