Browse Source

* pointer fixes

peter 26 years ago
parent
commit
38a2727fb2
8 changed files with 162 additions and 148 deletions
  1. 18 14
      rtl/inc/heap.inc
  2. 14 11
      rtl/inc/heaptrc.pp
  3. 10 7
      rtl/inc/objpas.inc
  4. 6 3
      rtl/linux/dos.pp
  5. 70 62
      rtl/linux/linux.pp
  6. 6 3
      rtl/linux/printer.pp
  7. 5 2
      rtl/linux/syslinux.pp
  8. 33 46
      rtl/objpas/typinfo.pp

+ 18 - 14
rtl/inc/heap.inc

@@ -594,8 +594,9 @@ begin
 { walk free list }
 { walk free list }
   repeat
   repeat
     again:=false;
     again:=false;
-    { search the freelist }
-    if assigned(freelist) then
+    { search the freelist, not for blocks that fit heapblocks }
+    if assigned(freelist) and
+       (not(heapblocks) or (size>max_size)) then
      begin
      begin
        last:=nil;
        last:=nil;
        hp:=freelist;
        hp:=freelist;
@@ -619,18 +620,18 @@ begin
                     freelist:=hp^.next;
                     freelist:=hp^.next;
                    { insert in chain }
                    { insert in chain }
                    s:=(hpsize-size) div 8;
                    s:=(hpsize-size) div 8;
-                   ppointer(hp+size)^:=blocks^[s];
-                   blocks^[s]:=hp+size;
+                   ppointer(pointer(hp)+size)^:=blocks^[s];
+                   blocks^[s]:=pointer(hp)+size;
                    inc(nblocks^[s]);
                    inc(nblocks^[s]);
                  end
                  end
                 else
                 else
                  begin
                  begin
-                   (hp+size)^.size:=hpsize-size;
-                   (hp+size)^.next:=hp^.next;
+                   pfreerecord(pointer(hp)+size)^.size:=hpsize-size;
+                   pfreerecord(pointer(hp)+size)^.next:=hp^.next;
                    if assigned(last) then
                    if assigned(last) then
-                    last^.next:=hp+size
+                    last^.next:=pointer(hp)+size
                    else
                    else
-                    freelist:=hp+size;
+                    freelist:=pointer(hp)+size;
                  end;
                  end;
               end
               end
              else
              else
@@ -829,7 +830,7 @@ begin
          { but now it can also connect the next block !!}
          { but now it can also connect the next block !!}
          if p+pfreerecord(p)^.size=pfreerecord(p)^.next then
          if p+pfreerecord(p)^.size=pfreerecord(p)^.next then
           begin
           begin
-            pfreerecord(p)^.size:=pfreerecord(p)^.size+pfreerecord(p)^.next^.size;
+            inc(pfreerecord(p)^.size,pfreerecord(p)^.next^.size);
 {$ifdef CHECKHEAP}
 {$ifdef CHECKHEAP}
             dec(freerecord_list_length);
             dec(freerecord_list_length);
 {$endif CHECKHEAP}
 {$endif CHECKHEAP}
@@ -841,7 +842,7 @@ begin
      hp:=freelist;
      hp:=freelist;
      while assigned(hp) do
      while assigned(hp) do
       begin
       begin
-        if p<hp+hp^.size then
+        if p<pointer(hp)+hp^.size then
          begin
          begin
 {$ifdef CHECKHEAP}
 {$ifdef CHECKHEAP}
            writeln('pointer to dispose at ',hexstr(longint(p),8),' has already been disposed');
            writeln('pointer to dispose at ',hexstr(longint(p),8),' has already been disposed');
@@ -849,11 +850,11 @@ begin
            HandleError(204);
            HandleError(204);
          end;
          end;
         { connecting two blocks ? }
         { connecting two blocks ? }
-        if hp+hp^.size=p then
+        if pointer(hp)+hp^.size=p then
          begin
          begin
            inc(hp^.size,size);
            inc(hp^.size,size);
            { connecting also to next block ? }
            { connecting also to next block ? }
-           if hp+hp^.size=hp^.next then
+           if pointer(hp)+hp^.size=hp^.next then
             begin
             begin
               inc(hp^.size,hp^.next^.size);
               inc(hp^.size,hp^.next^.size);
 {$ifdef CHECKHEAP}
 {$ifdef CHECKHEAP}
@@ -862,7 +863,7 @@ begin
               hp^.next:=hp^.next^.next;
               hp^.next:=hp^.next^.next;
             end
             end
            else
            else
-            if (hp^.next<>nil) and (hp+hp^.size>hp^.next) then
+            if (hp^.next<>nil) and (pointer(hp)+hp^.size>hp^.next) then
              begin
              begin
 {$ifdef CHECKHEAP}
 {$ifdef CHECKHEAP}
                writeln('pointer to dispose at ',hexstr(longint(p),8),' is too big !!');
                writeln('pointer to dispose at ',hexstr(longint(p),8),' is too big !!');
@@ -1098,7 +1099,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.13  1999-08-20 13:26:20  michael
+  Revision 1.14  1999-09-08 16:14:41  peter
+    * pointer fixes
+
+  Revision 1.13  1999/08/20 13:26:20  michael
   + reverted to previous heap
   + reverted to previous heap
 
 
   Revision 1.11  1999/05/31 20:36:34  peter
   Revision 1.11  1999/05/31 20:36:34  peter

+ 14 - 11
rtl/inc/heaptrc.pp

@@ -227,12 +227,12 @@ procedure call_stack(pp : pheap_mem_info;var ptext : text);
 var
 var
   i  : longint;
   i  : longint;
 begin
 begin
-  writeln(ptext,'Call trace for block 0x',hexstr(longint(pp+sizeof(theap_mem_info)),8),' size ',pp^.size);
+  writeln(ptext,'Call trace for block 0x',hexstr(longint(pointer(pp)+sizeof(theap_mem_info)),8),' size ',pp^.size);
   for i:=1 to tracesize do
   for i:=1 to tracesize do
    if pp^.calls[i]<>0 then
    if pp^.calls[i]<>0 then
      writeln(ptext,'  0x',hexstr(pp^.calls[i],8));
      writeln(ptext,'  0x',hexstr(pp^.calls[i],8));
   for i:=0 to (exact_info_size div 4)-1 do
   for i:=0 to (exact_info_size div 4)-1 do
-    writeln(ptext,'info ',i,'=',plongint(@pp^.extra_info+4*i)^);
+    writeln(ptext,'info ',i,'=',plongint(pointer(@pp^.extra_info)+4*i)^);
 end;
 end;
 
 
 procedure call_free_stack(pp : pheap_mem_info;var ptext : text);
 procedure call_free_stack(pp : pheap_mem_info;var ptext : text);
@@ -240,7 +240,7 @@ var
   i  : longint;
   i  : longint;
 
 
 begin
 begin
-  writeln(ptext,'Call trace for block 0x',hexstr(longint(pp+sizeof(theap_mem_info)),8),' size ',pp^.size);
+  writeln(ptext,'Call trace for block 0x',hexstr(longint(pointer(pp)+sizeof(theap_mem_info)),8),' size ',pp^.size);
   for i:=1 to tracesize div 2 do
   for i:=1 to tracesize div 2 do
    if pp^.calls[i]<>0 then
    if pp^.calls[i]<>0 then
      writeln(ptext,'  0x',hexstr(pp^.calls[i],8));
      writeln(ptext,'  0x',hexstr(pp^.calls[i],8));
@@ -249,13 +249,13 @@ begin
    if pp^.calls[i]<>0 then
    if pp^.calls[i]<>0 then
      writeln(ptext,'  0x',hexstr(pp^.calls[i],8));
      writeln(ptext,'  0x',hexstr(pp^.calls[i],8));
   for i:=0 to (exact_info_size div 4)-1 do
   for i:=0 to (exact_info_size div 4)-1 do
-    writeln(ptext,'info ',i,'=',plongint(@pp^.extra_info+4*i)^);
+    writeln(ptext,'info ',i,'=',plongint(pointer(@pp^.extra_info)+4*i)^);
 end;
 end;
 
 
 
 
 procedure dump_already_free(p : pheap_mem_info;var ptext : text);
 procedure dump_already_free(p : pheap_mem_info;var ptext : text);
 begin
 begin
-  Writeln(ptext,'Marked memory at ',HexStr(longint(p+sizeof(theap_mem_info)),8),' released');
+  Writeln(ptext,'Marked memory at ',HexStr(longint(pointer(p)+sizeof(theap_mem_info)),8),' released');
   call_free_stack(p,ptext);
   call_free_stack(p,ptext);
   Writeln(ptext,'freed again at');
   Writeln(ptext,'freed again at');
   dump_stack(ptext,get_caller_frame(get_frame));
   dump_stack(ptext,get_caller_frame(get_frame));
@@ -263,7 +263,7 @@ end;
 
 
 procedure dump_error(p : pheap_mem_info;var ptext : text);
 procedure dump_error(p : pheap_mem_info;var ptext : text);
 begin
 begin
-  Writeln(ptext,'Marked memory at ',HexStr(longint(p+sizeof(theap_mem_info)),8),' invalid');
+  Writeln(ptext,'Marked memory at ',HexStr(longint(pointer(p)+sizeof(theap_mem_info)),8),' invalid');
   Writeln(ptext,'Wrong signature $',hexstr(p^.sig,8)
   Writeln(ptext,'Wrong signature $',hexstr(p^.sig,8)
     ,' instead of ',hexstr(calculate_sig(p),8));
     ,' instead of ',hexstr(calculate_sig(p),8));
   dump_stack(ptext,get_caller_frame(get_frame));
   dump_stack(ptext,get_caller_frame(get_frame));
@@ -274,12 +274,12 @@ procedure dump_change_after(p : pheap_mem_info;var ptext : text);
  var pp : pchar;
  var pp : pchar;
      i : longint;
      i : longint;
 begin
 begin
-  Writeln(ptext,'Marked memory at ',HexStr(longint(p+sizeof(theap_mem_info)),8),' invalid');
+  Writeln(ptext,'Marked memory at ',HexStr(longint(pointer(p)+sizeof(theap_mem_info)),8),' invalid');
   Writeln(ptext,'Wrong release CRC $',hexstr(p^.release_sig,8)
   Writeln(ptext,'Wrong release CRC $',hexstr(p^.release_sig,8)
     ,' instead of ',hexstr(calculate_release_sig(p),8));
     ,' instead of ',hexstr(calculate_release_sig(p),8));
   Writeln(ptext,'This memory was changed after call to freemem !');
   Writeln(ptext,'This memory was changed after call to freemem !');
   call_free_stack(p,ptext);
   call_free_stack(p,ptext);
-  pp:=pchar(p)+sizeof(theap_mem_info)+extra_info_size;
+  pp:=pointer(p)+sizeof(theap_mem_info)+extra_info_size;
   for i:=0 to p^.size-1 do
   for i:=0 to p^.size-1 do
     if byte(pp[i])<>$F0 then
     if byte(pp[i])<>$F0 then
       Writeln(ptext,'offset',i,':$',hexstr(i,8),'"',pp[i],'"');
       Writeln(ptext,'offset',i,':$',hexstr(i,8),'"',pp[i],'"');
@@ -290,7 +290,7 @@ procedure dump_wrong_size(p : pheap_mem_info;size : longint;var ptext : text);
 var
 var
   i : longint;
   i : longint;
 begin
 begin
-  Writeln(ptext,'Marked memory at ',HexStr(longint(p+sizeof(theap_mem_info)),8),' invalid');
+  Writeln(ptext,'Marked memory at ',HexStr(longint(pointer(p)+sizeof(theap_mem_info)),8),' invalid');
   Writeln(ptext,'Wrong size : ',p^.size,' allocated ',size,' freed');
   Writeln(ptext,'Wrong size : ',p^.size,' allocated ',size,' freed');
   dump_stack(ptext,get_caller_frame(get_frame));
   dump_stack(ptext,get_caller_frame(get_frame));
   for i:=0 to (exact_info_size div 4)-1 do
   for i:=0 to (exact_info_size div 4)-1 do
@@ -340,7 +340,7 @@ begin
 { Do the real GetMem, but alloc also for the info block }
 { Do the real GetMem, but alloc also for the info block }
   bp:=size+sizeof(theap_mem_info)+extra_info_size;
   bp:=size+sizeof(theap_mem_info)+extra_info_size;
   if add_tail then
   if add_tail then
-    bp:=bp+sizeof(longint);
+    inc(bp,sizeof(longint));
   SysGetMem(p,bp);
   SysGetMem(p,bp);
 { Create the info block }
 { Create the info block }
   pheap_mem_info(p)^.sig:=$DEADBEEF;
   pheap_mem_info(p)^.sig:=$DEADBEEF;
@@ -758,7 +758,10 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.21  1999-08-18 12:03:16  peter
+  Revision 1.22  1999-09-08 16:14:41  peter
+    * pointer fixes
+
+  Revision 1.21  1999/08/18 12:03:16  peter
     * objfpc mode for 0.99.12
     * objfpc mode for 0.99.12
 
 
   Revision 1.20  1999/08/17 14:56:03  michael
   Revision 1.20  1999/08/17 14:56:03  michael

+ 10 - 7
rtl/inc/objpas.inc

@@ -81,7 +81,7 @@
         begin
         begin
            { type of self is class of tobject => it points to the vmt }
            { type of self is class of tobject => it points to the vmt }
            { the parent vmt is saved at offset vmtParent              }
            { the parent vmt is saved at offset vmtParent              }
-           classparent:=(pclass(self)+vmtParent)^;
+           classparent:=pclass(pointer(self)+vmtParent)^;
         end;
         end;
 
 
       class function TObject.NewInstance : tobject;
       class function TObject.NewInstance : tobject;
@@ -142,13 +142,13 @@
       class function TObject.ClassInfo : pointer;
       class function TObject.ClassInfo : pointer;
 
 
         begin
         begin
-           ClassInfo:=(PPointer(self)+vmtTypeInfo)^;
+           ClassInfo:=ppointer(Pointer(self)+vmtTypeInfo)^;
         end;
         end;
 
 
       class function TObject.ClassName : ShortString;
       class function TObject.ClassName : ShortString;
 
 
         begin
         begin
-           ClassName:=PShortString((PPointer(Self)+vmtClassName)^)^;
+           ClassName:=PShortString((Pointer(Self)+vmtClassName)^)^;
         end;
         end;
 
 
       class function TObject.ClassNameIs(const name : string) : boolean;
       class function TObject.ClassNameIs(const name : string) : boolean;
@@ -182,7 +182,7 @@
            pdword = ^dword;
            pdword = ^dword;
 
 
         begin
         begin
-           stringmessagetable:=pstringmessagetable((pdword(Self)+vmtMsgStrPtr)^);
+           stringmessagetable:=pstringmessagetable((pointer(Self)+vmtMsgStrPtr)^);
         end;
         end;
 
 
       procedure TObject.Dispatch(var message);
       procedure TObject.Dispatch(var message);
@@ -210,7 +210,7 @@
            while assigned(vmt) do
            while assigned(vmt) do
              begin
              begin
                 // See if we have messages at all in this class.
                 // See if we have messages at all in this class.
-                p:=pdword(vmt)+vmtDynamicTable;
+                p:=pointer(vmt)+vmtDynamicTable;
                 If Assigned(p) and (Pdword(p)^<>0) then
                 If Assigned(p) and (Pdword(p)^<>0) then
                   begin
                   begin
                   msgtable:=pmsgtable(pdword(P)^+4);
                   msgtable:=pmsgtable(pdword(P)^+4);
@@ -255,7 +255,7 @@
            vmt:=ClassType;
            vmt:=ClassType;
            while assigned(vmt) do
            while assigned(vmt) do
              begin
              begin
-                p:=(pdword(vmt)+vmtMsgStrPtr);
+                p:=(pointer(vmt)+vmtMsgStrPtr);
                 If (P<>Nil) and (PDWord(P)^<>0) then
                 If (P<>Nil) and (PDWord(P)^<>0) then
                   begin
                   begin
                   count:=pdword(pdword(p)^)^;
                   count:=pdword(pdword(p)^)^;
@@ -330,7 +330,10 @@
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.7  1999-07-11 14:10:48  michael
+  Revision 1.8  1999-09-08 16:14:41  peter
+    * pointer fixes
+
+  Revision 1.7  1999/07/11 14:10:48  michael
   + Adaptes Dispatch(STr) to cope with empty/non-existent message tables
   + Adaptes Dispatch(STr) to cope with empty/non-existent message tables
 
 
   Revision 1.6  1999/07/11 14:05:50  michael
   Revision 1.6  1999/07/11 14:05:50  michael

+ 6 - 3
rtl/linux/dos.pp

@@ -886,7 +886,7 @@ Begin
   while (p^<>nil) do
   while (p^<>nil) do
    begin
    begin
      inc(envcnt);
      inc(envcnt);
-     p:=p+4
+     inc(p);
    end;
    end;
   EnvCount := envcnt
   EnvCount := envcnt
 {$ENDIF}
 {$ENDIF}
@@ -913,7 +913,7 @@ Begin
   while (i<Index) and (p^<>nil) do
   while (i<Index) and (p^<>nil) do
    begin
    begin
      inc(i);
      inc(i);
-     p:=p+4;
+     inc(p);
    end;
    end;
   if p=nil then
   if p=nil then
    envstr:=''
    envstr:=''
@@ -1046,7 +1046,10 @@ End.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.12  1999-07-28 23:18:35  peter
+  Revision 1.13  1999-09-08 16:14:41  peter
+    * pointer fixes
+
+  Revision 1.12  1999/07/28 23:18:35  peter
     * closedir fixes, which now disposes the pdir itself
     * closedir fixes, which now disposes the pdir itself
 
 
   Revision 1.11  1999/07/24 11:18:11  peter
   Revision 1.11  1999/07/24 11:18:11  peter

+ 70 - 62
rtl/linux/linux.pp

@@ -725,12 +725,13 @@ var
 begin
 begin
   getmem(pp,4*4);
   getmem(pp,4*4);
   temp:='/bin/sh'#0'-c'#0+prog+#0;
   temp:='/bin/sh'#0'-c'#0+prog+#0;
-  pp^:=@temp[1];
-  p:=pp+4;
+  p:=pp;
+  p^:=@temp[1];
+  inc(p);
   p^:=@temp[9];
   p^:=@temp[9];
-  p:=p+4;
+  inc(p);
   p^:=@temp[12];
   p^:=@temp[12];
-  p:=p+4;
+  inc(p);
   p^:=Nil;
   p^:=Nil;
   CreateShellArgV:=pp;
   CreateShellArgV:=pp;
 end;
 end;
@@ -746,13 +747,14 @@ var
 begin
 begin
   getmem(pp,4*4);
   getmem(pp,4*4);
   temp:='/bin/sh'#0'-c'#0+prog+#0;
   temp:='/bin/sh'#0'-c'#0+prog+#0;
-  GetMem(PP[0],Length(Temp));
-  Move(@Temp[1],PP[0]^,Length(Temp));
-  p:=pp+SizeOf(Pointer);
+  p:=pp;
+  GetMem(p^,Length(Temp));
+  Move(@Temp[1],p^^,Length(Temp));
+  inc(p);
   p^:=@pp[0][8];
   p^:=@pp[0][8];
-  p:=p+SizeOf(Pointer);
+  inc(p);
   p^:=@pp[0][11];
   p^:=@pp[0][11];
-  p:=p+SizeOf(Pointer);
+  inc(p);
   p^:=Nil;
   p^:=Nil;
   CreateShellArgV:=pp;
   CreateShellArgV:=pp;
 end;
 end;
@@ -907,7 +909,6 @@ begin
   p:=StringToPPChar(ToDo);
   p:=StringToPPChar(ToDo);
   if (p=nil) or (p^=nil) then
   if (p=nil) or (p^=nil) then
    exit;
    exit;
-
   ExecVE(p^,p,EP);
   ExecVE(p^,p,EP);
 end;
 end;
 
 
@@ -1001,6 +1002,8 @@ begin
   Shell:=temp;{ Return exit status }
   Shell:=temp;{ Return exit status }
 end;
 end;
 
 
+
+
 Function Shell(const Command:AnsiString):Longint;
 Function Shell(const Command:AnsiString):Longint;
 {
 {
   AnsiString version of Shell
   AnsiString version of Shell
@@ -1476,7 +1479,6 @@ var
   sr : Syscallregs;
   sr : Syscallregs;
 begin
 begin
   if (cmd in [F_GetFd,F_GetFl,F_GetOwn]) then
   if (cmd in [F_GetFd,F_GetFl,F_GetOwn]) then
-
    begin
    begin
      sr.reg2:=Fd;
      sr.reg2:=Fd;
      sr.reg3:=cmd;
      sr.reg3:=cmd;
@@ -1765,7 +1767,6 @@ end;
 
 
 
 
 Function  FRename (OldName,NewName : Pchar) : Boolean;
 Function  FRename (OldName,NewName : Pchar) : Boolean;
-
 begin
 begin
   FRename:=Sys_rename(OldName,NewName)=0;
   FRename:=Sys_rename(OldName,NewName)=0;
   LinuxError:=Errno;
   LinuxError:=Errno;
@@ -1773,7 +1774,6 @@ end;
 
 
 
 
 Function  FRename (OldName,NewName : String) : Boolean;
 Function  FRename (OldName,NewName : String) : Boolean;
-
 begin
 begin
   OldName:=OldName+#0;
   OldName:=OldName+#0;
   NewName:=NewName+#0;
   NewName:=NewName+#0;
@@ -1826,10 +1826,10 @@ Function  Dup(oldfile:longint;var newfile:longint):Boolean;
 var
 var
   sr : Syscallregs;
   sr : Syscallregs;
 begin
 begin
- sr.reg2:=oldfile;
- newfile:=Syscall(Syscall_nr_dup,sr);
- linuxerror:=errno;
- Dup:=(LinuxError=0);
+  sr.reg2:=oldfile;
+  newfile:=Syscall(Syscall_nr_dup,sr);
+  linuxerror:=errno;
+  Dup:=(LinuxError=0);
 end;
 end;
 
 
 
 
@@ -1842,10 +1842,10 @@ Function Dup(var oldfile,newfile:text):Boolean;
   close_on_exit flag.
   close_on_exit flag.
 }
 }
 begin
 begin
- flush(oldfile);{ We cannot share buffers, so we flush them. }
- textrec(newfile):=textrec(oldfile);
- textrec(newfile).bufptr:=@(textrec(newfile).buffer);{ No shared buffer. }
- Dup:=Dup(textrec(oldfile).handle,textrec(newfile).handle);
+  flush(oldfile);{ We cannot share buffers, so we flush them. }
+  textrec(newfile):=textrec(oldfile);
+  textrec(newfile).bufptr:=@(textrec(newfile).buffer);{ No shared buffer. }
+  Dup:=Dup(textrec(oldfile).handle,textrec(newfile).handle);
 end;
 end;
 
 
 
 
@@ -1866,11 +1866,11 @@ Function Dup2(oldfile,newfile:longint):Boolean;
 var
 var
   sr : Syscallregs;
   sr : Syscallregs;
 begin
 begin
- sr.reg2:=oldfile;
- sr.reg3:=newfile;
- SysCall(Syscall_nr_dup2,sr);
- linuxerror:=errno;
- Dup2:=(LinuxError=0);
+  sr.reg2:=oldfile;
+  sr.reg3:=newfile;
+  SysCall(Syscall_nr_dup2,sr);
+  linuxerror:=errno;
+  Dup2:=(LinuxError=0);
 end;
 end;
 
 
 
 
@@ -2023,12 +2023,14 @@ end;
 Procedure OpenPipe(var F:Text);
 Procedure OpenPipe(var F:Text);
 begin
 begin
   case textrec(f).mode of
   case textrec(f).mode of
-   fmoutput : if textrec(f).userdata[1]<>P_OUT then
-               textrec(f).mode:=fmclosed;
-    fminput : if textrec(f).userdata[1]<>P_IN then
-               textrec(f).mode:=fmclosed;
-  else
-   textrec(f).mode:=fmclosed;
+    fmoutput :
+      if textrec(f).userdata[1]<>P_OUT then
+        textrec(f).mode:=fmclosed;
+    fminput :
+      if textrec(f).userdata[1]<>P_IN then
+        textrec(f).mode:=fmclosed;
+    else
+      textrec(f).mode:=fmclosed;
   end;
   end;
 end;
 end;
 
 
@@ -2036,13 +2038,15 @@ end;
 Procedure IOPipe(var F:text);
 Procedure IOPipe(var F:text);
 begin
 begin
   case textrec(f).mode of
   case textrec(f).mode of
-   fmoutput : begin
-                { first check if we need something to write, else we may
-                  get a SigPipe when Close() is called (PFV) }
-                if textrec(f).bufpos>0 then
-                 Sys_write(textrec(f).handle,pchar(textrec(f).bufptr),textrec(f).bufpos);
-              end;
-    fminput : textrec(f).bufend:=Sys_read(textrec(f).handle,pchar(textrec(f).bufptr),textrec(f).bufsize);
+    fmoutput :
+      begin
+        { first check if we need something to write, else we may
+          get a SigPipe when Close() is called (PFV) }
+        if textrec(f).bufpos>0 then
+          Sys_write(textrec(f).handle,pchar(textrec(f).bufptr),textrec(f).bufpos);
+      end;
+    fminput :
+      textrec(f).bufend:=Sys_read(textrec(f).handle,pchar(textrec(f).bufptr),textrec(f).bufsize);
   end;
   end;
   textrec(f).bufpos:=0;
   textrec(f).bufpos:=0;
 end;
 end;
@@ -2322,12 +2326,13 @@ begin
       end;
       end;
      getmem(pp,sizeof(pchar)*4);
      getmem(pp,sizeof(pchar)*4);
      temp:='/bin/sh'#0'-c'#0+prog+#0;
      temp:='/bin/sh'#0'-c'#0+prog+#0;
-     pp^:=@temp[1];
-     p:=pp+sizeof(pchar);
+     p:=pp;
+     p^:=@temp[1];
+     inc(p);
      p^:=@temp[9];
      p^:=@temp[9];
-     p:=p+sizeof(pchar);
+     inc(p);
      p^:=@temp[12];
      p^:=@temp[12];
-     p:=p+sizeof(pchar);
+     inc(p);
      p^:=Nil;
      p^:=Nil;
      Execve('/bin/sh',pp,envp);
      Execve('/bin/sh',pp,envp);
      halt(127);
      halt(127);
@@ -2380,7 +2385,6 @@ var
   pipo : text;
   pipo : text;
   pid  : longint;
   pid  : longint;
   pl   : ^Longint;
   pl   : ^Longint;
-
 begin
 begin
   LinuxError:=0;
   LinuxError:=0;
   AssignPipe(streamin,pipo);
   AssignPipe(streamin,pipo);
@@ -2417,20 +2421,21 @@ begin
    end
    end
   else
   else
    begin
    begin
-   { we're in the parent}
-   close(pipo);
-   close(pipi);
-   {Save the process ID - needed when closing }
-   pl:=@(textrec(StreamIn).userdata[2]);
-   pl^:=pid;
-   textrec(StreamIn).closefunc:=@PCloseText;
-   {Save the process ID - needed when closing }
-   pl:=@(textrec(StreamOut).userdata[2]);
-   pl^:=pid;
-   textrec(StreamOut).closefunc:=@PCloseText;
+     { we're in the parent}
+     close(pipo);
+     close(pipi);
+     {Save the process ID - needed when closing }
+     pl:=@(textrec(StreamIn).userdata[2]);
+     pl^:=pid;
+     textrec(StreamIn).closefunc:=@PCloseText;
+     {Save the process ID - needed when closing }
+     pl:=@(textrec(StreamOut).userdata[2]);
+     pl^:=pid;
+     textrec(StreamOut).closefunc:=@PCloseText;
    end;
    end;
 end;
 end;
 
 
+
 function AssignStream(var StreamIn, StreamOut, StreamErr: Text; const prog: String): LongInt;
 function AssignStream(var StreamIn, StreamOut, StreamErr: Text; const prog: String): LongInt;
 {
 {
   Starts the program in 'prog' and makes its input, output and error output the
   Starts the program in 'prog' and makes its input, output and error output the
@@ -2577,7 +2582,7 @@ Begin
         if strlcomp(@p[1],(ep^),length(p))=0 then
         if strlcomp(@p[1],(ep^),length(p))=0 then
          found:=true
          found:=true
         else
         else
-         ep:=ep+4;
+         inc(ep);
       end;
       end;
    end;
    end;
   if found then
   if found then
@@ -2989,10 +2994,10 @@ begin
   while(buf^<>#0) do
   while(buf^<>#0) do
    begin
    begin
      while (buf^ in [' ',#8,#10]) do
      while (buf^ in [' ',#8,#10]) do
-      buf:=buf+1;
+      inc(buf);
      inc(nr);
      inc(nr);
      while not (buf^ in [' ',#0,#8,#10]) do
      while not (buf^ in [' ',#0,#8,#10]) do
-      buf:=buf+1;
+      inc(buf);
    end;
    end;
   getmem(p,nr*4);
   getmem(p,nr*4);
   StringToPPChar:=p;
   StringToPPChar:=p;
@@ -3007,13 +3012,13 @@ begin
      while (buf^ in [' ',#8,#10]) do
      while (buf^ in [' ',#8,#10]) do
       begin
       begin
         buf^:=#0;
         buf^:=#0;
-        buf:=buf+1;
+        inc(buf);
       end;
       end;
      p^:=buf;
      p^:=buf;
-     p:=p+4;
+     inc(p);
      p^:=nil;
      p^:=nil;
      while not (buf^ in [' ',#0,#8,#10]) do
      while not (buf^ in [' ',#0,#8,#10]) do
-      buf:=buf+1;
+      inc(buf);
    end;
    end;
 end;
 end;
 
 
@@ -3737,7 +3742,10 @@ End.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.45  1999-08-11 22:02:25  peter
+  Revision 1.46  1999-09-08 16:14:41  peter
+    * pointer fixes
+
+  Revision 1.45  1999/08/11 22:02:25  peter
     * removed old integer versions of localtoepoch and epochtolocal, you
     * removed old integer versions of localtoepoch and epochtolocal, you
       need to use the word versions instead else you got an overloaded bug
       need to use the word versions instead else you got an overloaded bug
 
 

+ 6 - 3
rtl/linux/printer.pp

@@ -98,9 +98,9 @@ begin
       halt(127);
       halt(127);
      pp:=p;
      pp:=p;
      pp^:=@lpr[1];
      pp^:=@lpr[1];
-     pp:=pp+4;
+     inc(pp);
      pp^:=@f[1];
      pp^:=@f[1];
-     pp:=pp+4;
+     inc(pp);
      pp^:=nil;
      pp^:=nil;
      Execve(lpr,p,envp);
      Execve(lpr,p,envp);
      { In trouble here ! }
      { In trouble here ! }
@@ -254,7 +254,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.3  1998-11-16 10:21:29  peter
+  Revision 1.4  1999-09-08 16:14:43  peter
+    * pointer fixes
+
+  Revision 1.3  1998/11/16 10:21:29  peter
     * fixes for H+
     * fixes for H+
 
 
   Revision 1.2  1998/05/06 12:35:26  michael
   Revision 1.2  1998/05/06 12:35:26  michael

+ 5 - 2
rtl/linux/syslinux.pp

@@ -136,7 +136,7 @@ Begin
   i:=0;
   i:=0;
   while (i<l) and (pp^<>nil) do
   while (i<l) and (pp^<>nil) do
    begin
    begin
-     pp:=pp+4;
+     inc(pp);
      inc(i);
      inc(i);
    end;
    end;
   if pp^<>nil then
   if pp^<>nil then
@@ -724,7 +724,10 @@ End.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.25  1999-07-28 23:18:36  peter
+  Revision 1.26  1999-09-08 16:14:43  peter
+    * pointer fixes
+
+  Revision 1.25  1999/07/28 23:18:36  peter
     * closedir fixes, which now disposes the pdir itself
     * closedir fixes, which now disposes the pdir itself
 
 
   Revision 1.24  1999/05/17 21:52:42  florian
   Revision 1.24  1999/05/17 21:52:42  florian

+ 33 - 46
rtl/objpas/typinfo.pp

@@ -255,7 +255,7 @@ uses sysutils;
       .LINoPush:
       .LINoPush:
          push %esi
          push %esi
          call %edi
          call %edi
-         // 
+         //
       end;
       end;
 
 
     function CallExtendedProc(s : Pointer;Address : Pointer;Value : Extended; INdex,IVAlue : Longint) : Integer;assembler;
     function CallExtendedProc(s : Pointer;Address : Pointer;Value : Extended; INdex,IVAlue : Longint) : Integer;assembler;
@@ -336,7 +336,7 @@ uses sysutils;
     function GetTypeData(TypeInfo : PTypeInfo) : PTypeData;
     function GetTypeData(TypeInfo : PTypeInfo) : PTypeData;
 
 
       begin
       begin
-         GetTypeData:=PTypeData(TypeInfo)+2+PByte(TypeInfo+1)^;
+         GetTypeData:=PTypeData(pointer(TypeInfo)+2+PByte(pointer(TypeInfo)+1)^);
       end;
       end;
 
 
     function GetPropInfo(TypeInfo : PTypeInfo;const PropName : string) : PPropInfo;
     function GetPropInfo(TypeInfo : PTypeInfo;const PropName : string) : PPropInfo;
@@ -354,7 +354,7 @@ uses sysutils;
 
 
               // the class info rtti the property rtti follows
               // the class info rtti the property rtti follows
               // immediatly
               // immediatly
-              Result:=PPropInfo(@hp^.UnitName)+Length(hp^.UnitName)+1+SizeOF(Word);
+              Result:=PPropInfo(pointer(@hp^.UnitName)+Length(hp^.UnitName)+1+SizeOF(Word));
               for i:=1 to hp^.PropCount do
               for i:=1 to hp^.PropCount do
                 begin
                 begin
                    // found a property of that name ?
                    // found a property of that name ?
@@ -362,7 +362,7 @@ uses sysutils;
                      exit;
                      exit;
 
 
                    // skip to next property
                    // skip to next property
-                   Result:=PPropInfo(@Result^.Name)+byte(Result^.Name[0])+1;
+                   Result:=PPropInfo(pointer(@Result^.Name)+byte(Result^.Name[0])+1);
                 end;
                 end;
               // parent class
               // parent class
               Typeinfo:=hp^.ParentInfo;
               Typeinfo:=hp^.ParentInfo;
@@ -378,7 +378,7 @@ uses sysutils;
             ptstatic:
             ptstatic:
               IsStoredProp:=CallBooleanFunc(Instance,PropInfo^.StoredProc,0,0);
               IsStoredProp:=CallBooleanFunc(Instance,PropInfo^.StoredProc,0,0);
             ptvirtual:
             ptvirtual:
-              IsStoredProp:=CallBooleanFunc(Instance,(PPointer(Instance.ClassType)+Longint(PropInfo^.StoredProc))^,0,0);
+              IsStoredProp:=CallBooleanFunc(Instance,ppointer(Pointer(Instance.ClassType)+Longint(PropInfo^.StoredProc))^,0,0);
             ptconst:
             ptconst:
               IsStoredProp:=LongBool(PropInfo^.StoredProc);
               IsStoredProp:=LongBool(PropInfo^.StoredProc);
          end;
          end;
@@ -409,7 +409,7 @@ uses sysutils;
         Inc(Longint(PropList),SizeOf(Pointer));
         Inc(Longint(PropList),SizeOf(Pointer));
         // Point to TP next propinfo record.
         // Point to TP next propinfo record.
         // Located at Name[Length(Name)+1] !
         // Located at Name[Length(Name)+1] !
-        TP:=PPropInfo((@TP^.Name)+PByte(@TP^.Name)^+1);
+        TP:=PPropInfo(pointer(@TP^.Name)+PByte(@TP^.Name)^+1);
         Dec(Count);
         Dec(Count);
         end;
         end;
       // recursive call for parent info.
       // recursive call for parent info.
@@ -487,9 +487,7 @@ uses sysutils;
             ptstatic:
             ptstatic:
               Value:=CallIntegerFunc(Instance,PropInfo^.GetProc,Index,IValue);
               Value:=CallIntegerFunc(Instance,PropInfo^.GetProc,Index,IValue);
             ptvirtual:
             ptvirtual:
-              Value:=CallIntegerFunc(Instance,
-                                     (PPointer(Instance.ClassType)+Longint(PropInfo^.GetProc))^,
-                                     Index,IValue);
+              Value:=CallIntegerFunc(Instance,PPointer(Pointer(Instance.ClassType)+Longint(PropInfo^.GetProc))^,Index,IValue);
          end;
          end;
          { cut off unnecessary stuff }
          { cut off unnecessary stuff }
          case GetTypeData(PropInfo^.PropType)^.OrdType of
          case GetTypeData(PropInfo^.PropType)^.OrdType of
@@ -506,35 +504,33 @@ uses sysutils;
 
 
       var
       var
         Index,IValue : Longint;
         Index,IValue : Longint;
-	DataSize: Integer;
+        DataSize: Integer;
 
 
       begin
       begin
          { cut off unnecessary stuff }
          { cut off unnecessary stuff }
          case GetTypeData(PropInfo^.PropType)^.OrdType of
          case GetTypeData(PropInfo^.PropType)^.OrdType of
             otSWord,otUWord: begin
             otSWord,otUWord: begin
                 Value:=Value and $ffff;
                 Value:=Value and $ffff;
-	        DataSize := 2;
-	      end;
+                DataSize := 2;
+              end;
             otSByte,otUByte: begin
             otSByte,otUByte: begin
                 Value:=Value and $ff;
                 Value:=Value and $ff;
-	        DataSize := 1;
-	    end;
-	   else DataSize := 4;
+                DataSize := 1;
+            end;
+           else DataSize := 4;
          end;
          end;
          SetIndexValues(PropInfo,Index,Ivalue);
          SetIndexValues(PropInfo,Index,Ivalue);
          case (PropInfo^.PropProcs shr 2) and 3 of
          case (PropInfo^.PropProcs shr 2) and 3 of
             ptfield:
             ptfield:
-	      case DataSize of
-	        1: PByte(Pointer(Instance)+Longint(PropInfo^.SetProc))^:=Byte(Value);
-		2: PWord(Pointer(Instance)+Longint(PropInfo^.SetProc))^:=Word(Value);
+              case DataSize of
+                1: PByte(Pointer(Instance)+Longint(PropInfo^.SetProc))^:=Byte(Value);
+                2: PWord(Pointer(Instance)+Longint(PropInfo^.SetProc))^:=Word(Value);
                 4: PLongint(Pointer(Instance)+Longint(PropInfo^.SetProc))^:=Value;
                 4: PLongint(Pointer(Instance)+Longint(PropInfo^.SetProc))^:=Value;
-	      end;
+              end;
             ptstatic:
             ptstatic:
               CallIntegerProc(Instance,PropInfo^.SetProc,Value,Index,IValue);
               CallIntegerProc(Instance,PropInfo^.SetProc,Value,Index,IValue);
             ptvirtual:
             ptvirtual:
-              CallIntegerProc(Instance,
-                              (PPointer(Instance.ClassType)+Longint(PropInfo^.SetProc))^,
-                              Value,Index,IValue);
+              CallIntegerProc(Instance,PPointer(Pointer(Instance.ClassType)+Longint(PropInfo^.SetProc))^,Value,Index,IValue);
          end;
          end;
       end;
       end;
 
 
@@ -557,9 +553,7 @@ uses sysutils;
             ptstatic:
             ptstatic:
               Value:=Pointer(CallIntegerFunc(Instance,PropInfo^.GetProc,Index,IValue));
               Value:=Pointer(CallIntegerFunc(Instance,PropInfo^.GetProc,Index,IValue));
             ptvirtual:
             ptvirtual:
-              Value:=Pointer(CallIntegerFunc(Instance,
-                                     (PPointer(Instance.ClassType)+Longint(PropInfo^.GetProc))^,
-                                     Index,IValue));
+              Value:=Pointer(CallIntegerFunc(Instance,PPointer(Pointer(Instance.ClassType)+Longint(PropInfo^.GetProc))^,Index,IValue));
          end;
          end;
          GetAstrProp:=Value;
          GetAstrProp:=Value;
       end;
       end;
@@ -578,9 +572,7 @@ uses sysutils;
             ptstatic:
             ptstatic:
              CallSStringFunc(Instance,PropInfo^.GetProc,Index,IValue,Value);
              CallSStringFunc(Instance,PropInfo^.GetProc,Index,IValue,Value);
             ptvirtual:
             ptvirtual:
-             CallSSTringFunc(Instance,
-                                     (PPointer(Instance.ClassType)+Longint(PropInfo^.GetProc))^,
-                                     Index,Ivalue,Value);
+             CallSSTringFunc(Instance,PPointer(Pointer(Instance.ClassType)+Longint(PropInfo^.GetProc))^,Index,Ivalue,Value);
          end;
          end;
          GetSStrProp:=Value;
          GetSStrProp:=Value;
       end;
       end;
@@ -614,9 +606,7 @@ uses sysutils;
             ptstatic:
             ptstatic:
               CallIntegerProc(Instance,PropInfo^.SetProc,Longint(Pointer(Value)),Index,IValue);
               CallIntegerProc(Instance,PropInfo^.SetProc,Longint(Pointer(Value)),Index,IValue);
             ptvirtual:
             ptvirtual:
-              CallIntegerProc(Instance,
-                              (PPointer(Instance.ClassType)+Longint(PropInfo^.SetProc))^,
-                              Longint(Pointer(Value)),Index,IValue);
+              CallIntegerProc(Instance,PPointer(Pointer(Instance.ClassType)+Longint(PropInfo^.SetProc))^,Longint(Pointer(Value)),Index,IValue);
          end;
          end;
       end;
       end;
 
 
@@ -633,9 +623,7 @@ uses sysutils;
             ptstatic:
             ptstatic:
               CallSStringProc(Instance,PropInfo^.GetProc,Value,Index,IValue);
               CallSStringProc(Instance,PropInfo^.GetProc,Value,Index,IValue);
             ptvirtual:
             ptvirtual:
-              CallSStringProc(Instance,
-                              (PPointer(Instance.ClassType)+Longint(PropInfo^.GetProc))^,
-                              Value,Index,IValue);
+              CallSStringProc(Instance,PPointer(Pointer(Instance.ClassType)+Longint(PropInfo^.GetProc))^,Value,Index,IValue);
          end;
          end;
     end;
     end;
 
 
@@ -679,9 +667,7 @@ uses sysutils;
             ptstatic:
             ptstatic:
               Value:=CallExtendedFunc(Instance,PropInfo^.GetProc,Index,IValue);
               Value:=CallExtendedFunc(Instance,PropInfo^.GetProc,Index,IValue);
             ptvirtual:
             ptvirtual:
-              Value:=CallExtendedFunc(Instance,
-                                     (PPointer(Instance.ClassType)+Longint(PropInfo^.GetProc))^,
-                                     Index,IValue);
+              Value:=CallExtendedFunc(Instance,PPointer(Pointer(Instance.ClassType)+Longint(PropInfo^.GetProc))^,Index,IValue);
          end;
          end;
          Result:=Value;
          Result:=Value;
       end;
       end;
@@ -714,9 +700,7 @@ uses sysutils;
             ptstatic:
             ptstatic:
               CallExtendedProc(Instance,PropInfo^.SetProc,Value,Index,IValue);
               CallExtendedProc(Instance,PropInfo^.SetProc,Value,Index,IValue);
             ptvirtual:
             ptvirtual:
-              CallExtendedProc(Instance,
-                               (PPointer(Instance.ClassType)+Longint(PropInfo^.GetProc))^,
-                               Value,Index,IValue);
+              CallExtendedProc(Instance,PPointer(Pointer(Instance.ClassType)+Longint(PropInfo^.GetProc))^,Value,Index,IValue);
          end;
          end;
       end;
       end;
 
 
@@ -759,10 +743,10 @@ uses sysutils;
        //      If PT^.MinValue<0 then Value:=Ord(Value<>0); {map to 0/1}
        //      If PT^.MinValue<0 then Value:=Ord(Value<>0); {map to 0/1}
        PS:=@PT^.NameList;
        PS:=@PT^.NameList;
        While Value>0 Do
        While Value>0 Do
-         begin
-         PS:=PS+PByte(PS)^+1;
-         Dec(Value);
-         end;
+        begin
+          PS:=PShortString(pointer(PS)+PByte(PS)^+1);
+          Dec(Value);
+        end;
        Result:=PS^;
        Result:=PS^;
       end;
       end;
 
 
@@ -782,7 +766,7 @@ uses sysutils;
           begin
           begin
           If PS^=Name then
           If PS^=Name then
             Result:=Count;
             Result:=Count;
-          PS:=PS+PByte(PS)^;
+          PS:=PShortString(pointer(PS)+PByte(PS)^);
           Inc(Count);
           Inc(Count);
           end;
           end;
       end;
       end;
@@ -791,7 +775,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.26  1999-09-03 15:39:23  michael
+  Revision 1.27  1999-09-08 16:14:43  peter
+    * pointer fixes
+
+  Revision 1.26  1999/09/03 15:39:23  michael
   * Fixes from Sebastian Guenther
   * Fixes from Sebastian Guenther
 
 
   Revision 1.25  1999/08/29 22:21:27  michael
   Revision 1.25  1999/08/29 22:21:27  michael