Browse Source

* moved getmem/freemem/memavail/maxavail to heaph.inc

peter 27 years ago
parent
commit
53dcf00218
2 changed files with 45 additions and 38 deletions
  1. 24 10
      rtl/inc/heaph.inc
  2. 21 28
      rtl/inc/systemh.inc

+ 24 - 10
rtl/inc/heaph.inc

@@ -3,6 +3,8 @@
     This file is part of the Free Pascal run time library.
     This file is part of the Free Pascal run time library.
     Copyright (c) 1993,97 by the Free Pascal development team
     Copyright (c) 1993,97 by the Free Pascal development team
 
 
+    Heap manager interface section
+
     See the file COPYING.FPC, included in this distribution,
     See the file COPYING.FPC, included in this distribution,
     for details about the copyright.
     for details about the copyright.
 
 
@@ -12,14 +14,29 @@
 
 
  **********************************************************************}
  **********************************************************************}
 
 
+const
+  heapblocks : boolean=false;
+var
+  heaporg,heapptr,heapend,heaperror,freelist : pointer;
 
 
-Procedure release(var p : pointer);
+{ Basic (TP7) functions }
+Procedure getmem(Var p:pointer;Size:Longint);
+Procedure freemem(Var p:pointer;Size:Longint);
+Function  memavail:Longint;
+Function  maxavail:Longint;
 Procedure mark(var p : pointer);
 Procedure mark(var p : pointer);
+Procedure release(var p : pointer);
+
+{ Fpc Functions }
+Function  heapsize : longint;
 Procedure markheap(var oldfreelist,oldheapptr : pointer);
 Procedure markheap(var oldfreelist,oldheapptr : pointer);
 Procedure releaseheap(oldfreelist,oldheapptr : pointer);
 Procedure releaseheap(oldfreelist,oldheapptr : pointer);
-Function  cal_memavail : longint;
-Function  heapsize : longint;
+
 {$ifdef TEMPHEAP}
 {$ifdef TEMPHEAP}
+{ Temp Heap Functions }
+  const
+    allow_special : boolean =true;
+
   Procedure split_heap;
   Procedure split_heap;
   Procedure switch_to_base_heap;
   Procedure switch_to_base_heap;
   Procedure switch_to_temp_heap;
   Procedure switch_to_temp_heap;
@@ -28,15 +45,12 @@ Function  heapsize : longint;
   Procedure gettempmem(var p : pointer;size : longint);
   Procedure gettempmem(var p : pointer;size : longint);
 {$endif TEMPHEAP}
 {$endif TEMPHEAP}
 
 
-const
-  allow_special : boolean =true;
-  heapblocks    : boolean=false;
-var
-  heaporg,heapptr,heapend,heaperror,freelist : pointer;
-
 {
 {
   $Log$
   $Log$
-  Revision 1.5  1998-07-02 14:11:30  michael
+  Revision 1.6  1998-09-08 15:03:27  peter
+    * moved getmem/freemem/memavail/maxavail to heaph.inc
+
+  Revision 1.5  1998/07/02 14:11:30  michael
   Reinstated the heapsize function.
   Reinstated the heapsize function.
 
 
   Revision 1.3  1998/05/12 10:42:45  peter
   Revision 1.3  1998/05/12 10:42:45  peter

+ 21 - 28
rtl/inc/systemh.inc

@@ -3,6 +3,8 @@
     This file is part of the Free Pascal Run time library.
     This file is part of the Free Pascal Run time library.
     Copyright (c) 1993,97 by the Free Pascal development team
     Copyright (c) 1993,97 by the Free Pascal development team
 
 
+    This File contains the OS independent declarations of the system unit
+
     See the File COPYING.FPC, included in this distribution,
     See the File COPYING.FPC, included in this distribution,
     for details about the copyright.
     for details about the copyright.
 
 
@@ -12,15 +14,11 @@
 
 
  **********************************************************************}
  **********************************************************************}
 
 
-{*****************************************************************************
-   This File contains the OS independent declarations of the system unit
-
-   Possible defines:
-   -----------------
+{
+   Supported conditionnals:
+   ------------------------
    RTLLITE         Create a somewhat smaller RTL
    RTLLITE         Create a somewhat smaller RTL
-
-*****************************************************************************}
-
+}
 
 
 {****************************************************************************
 {****************************************************************************
                    Support for multiple compiler versions
                    Support for multiple compiler versions
@@ -48,6 +46,7 @@ Type
 
 
 { at least declare Turbo Pascal real types }
 { at least declare Turbo Pascal real types }
 {$ifdef i386}
 {$ifdef i386}
+   StrLenInt = LongInt;
   {$ifndef VER0_99_5}
   {$ifndef VER0_99_5}
     {$ifndef VER0_99_6}
     {$ifndef VER0_99_6}
       {$define DEFAULT_EXTENDED}
       {$define DEFAULT_EXTENDED}
@@ -73,9 +72,6 @@ Type
    {$endif}
    {$endif}
 {$endif}
 {$endif}
 
 
-{$ifdef i386}
-   StrLenInt = LongInt;
-{$endif}
 { some type aliases }
 { some type aliases }
   dword    = cardinal;
   dword    = cardinal;
   longword = cardinal;
   longword = cardinal;
@@ -90,7 +86,7 @@ Type
 const
 const
 { max. values for longint and int}
 { max. values for longint and int}
   maxLongint = $7fffffff;
   maxLongint = $7fffffff;
-  maxint = 32767;
+  maxint     = 32767;
 
 
 { Compatibility With  TP }
 { Compatibility With  TP }
 {$ifdef i386}
 {$ifdef i386}
@@ -105,7 +101,7 @@ const
 { max level in dumping on error }
 { max level in dumping on error }
   Max_Frame_Dump : Word = 8;
   Max_Frame_Dump : Word = 8;
 { Exit Procedure handling consts and types  }
 { Exit Procedure handling consts and types  }
-  ExitProc : pointer=nil;
+  ExitProc : pointer = nil;
   Erroraddr: pointer = nil;
   Erroraddr: pointer = nil;
   Errorcode: Word    = 0;
   Errorcode: Word    = 0;
 
 
@@ -117,7 +113,8 @@ const
   fmAppend = $D7B4;
   fmAppend = $D7B4;
   Filemode : byte = 2;
   Filemode : byte = 2;
 
 
-Type TErrorProc = Procedure (ErrNo : Longint; Address : Pointer);
+Type
+  TErrorProc = Procedure (ErrNo : Longint; Address : Pointer);
 
 
 var
 var
 { Standard In- and Output }
 { Standard In- and Output }
@@ -145,7 +142,7 @@ Procedure FillWord(Var x;count:Longint;Value:Word);
 {$endif RTLLITE}
 {$endif RTLLITE}
 
 
 {****************************************************************************
 {****************************************************************************
-                                                           Math Routines
+                          Math Routines
 ****************************************************************************}
 ****************************************************************************}
 
 
 {$ifndef RTLLITE}
 {$ifndef RTLLITE}
@@ -161,7 +158,6 @@ Function  Swap (X:Word):Word;
 Function  Swap (X:Integer):Integer;
 Function  Swap (X:Integer):Integer;
 Function  Swap (X:Cardinal):Cardinal;
 Function  Swap (X:Cardinal):Cardinal;
 Function  Swap (X:Longint):Longint;
 Function  Swap (X:Longint):Longint;
-
 {$ifdef VER0_99_5}
 {$ifdef VER0_99_5}
 Procedure Inc(Var i:cardinal);
 Procedure Inc(Var i:cardinal);
 Procedure Inc(Var i:Longint);
 Procedure Inc(Var i:Longint);
@@ -196,8 +192,8 @@ Procedure Inc(Var c:Char;a:Longint);
 Procedure Dec(Var p:PChar;a:Longint);
 Procedure Dec(Var p:PChar;a:Longint);
 Procedure Inc(Var p:PChar;a:Longint);
 Procedure Inc(Var p:PChar;a:Longint);
 {$endif VER0_99_5}
 {$endif VER0_99_5}
-
 {$endif RTLLITE}
 {$endif RTLLITE}
+
 Function Chr(b:byte):Char;
 Function Chr(b:byte):Char;
 Function Length(s:string):byte;
 Function Length(s:string):byte;
 
 
@@ -208,19 +204,14 @@ Procedure Randomize;
 Function abs(l:Longint):Longint;
 Function abs(l:Longint):Longint;
 Function sqr(l:Longint):Longint;
 Function sqr(l:Longint):Longint;
 Function odd(l:Longint):Boolean;
 Function odd(l:Longint):Boolean;
-{ float mathe routines }
-{$I mathh.inc}
 
 
+{ float math routines }
+{$I mathh.inc}
 
 
 {****************************************************************************
 {****************************************************************************
-                                                         Memory management
+                         Addr/Pointer Handling
 ****************************************************************************}
 ****************************************************************************}
 
 
-Procedure getmem(Var p:pointer;Size:Longint);
-Procedure freemem(Var p:pointer;Size:Longint);
-Function  memavail:Longint;
-Function  maxavail:Longint;
-
 {$ifndef RTLLITE}
 {$ifndef RTLLITE}
 Function  ptr(sel,off:Longint):pointer;
 Function  ptr(sel,off:Longint):pointer;
 Function  Addr (Var X):pointer;
 Function  Addr (Var X):pointer;
@@ -230,13 +221,12 @@ Function  Sseg:Word;
 {$endif RTLLITE}
 {$endif RTLLITE}
 
 
 {****************************************************************************
 {****************************************************************************
-                                                          PChar Handling
+                      PChar and String Handling
 ****************************************************************************}
 ****************************************************************************}
 
 
 function strpas(p:pchar):string;
 function strpas(p:pchar):string;
 function strlen(p:pchar):longint;
 function strlen(p:pchar):longint;
 
 
-
 Function  Copy(const s:string;index:StrLenInt;count:StrLenInt):string;
 Function  Copy(const s:string;index:StrLenInt;count:StrLenInt):string;
 Procedure Delete(Var s:string;index:StrLenInt;count:StrLenInt);
 Procedure Delete(Var s:string;index:StrLenInt;count:StrLenInt);
 Procedure Insert(const source:string;Var s:string;index:StrLenInt);
 Procedure Insert(const source:string;Var s:string;index:StrLenInt);
@@ -440,7 +430,10 @@ Procedure halt;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.26  1998-09-04 18:16:14  peter
+  Revision 1.27  1998-09-08 15:03:28  peter
+    * moved getmem/freemem/memavail/maxavail to heaph.inc
+
+  Revision 1.26  1998/09/04 18:16:14  peter
     * uniform filerec/textrec (with recsize:longint and name:0..255)
     * uniform filerec/textrec (with recsize:longint and name:0..255)
 
 
   Revision 1.25  1998/09/01 17:36:22  peter
   Revision 1.25  1998/09/01 17:36:22  peter