Path: utzoo!utgpu!watmath!clyde!att!rutgers!deimos!uxc!tank!mimsy!haven!ncifcrf!nlm-mcs!adm!xadmx!FINEBERG%WUMS.BITNET@cunyvm.cuny.edu
From: FINEBERG%WUMS.BITNET@cunyvm.cuny.edu
Newsgroups: comp.lang.pascal
Subject: Re: Pointers in TP4
Message-ID: <17683@adm.BRL.MIL>
Date: 2 Dec 88 02:43:32 GMT
Sender: news@adm.BRL.MIL
Lines: 58

To:     FINEBERG_C
Subj:   Re: Pointers in TP4

Received: From CUNYVM(MAILER) by WUMS with RSCS id 9650
          for FINEBERG_C@WUMS; Tue, 29-NOV-1988 04:01 CST
Received: from CUNYVM by CUNYVM.BITNET (Mailer X2.00) with BSMTP id 7537; Tue,
 29 Nov 88 04:51:22 EDT
Received: from VIM.BRL.MIL by CUNYVM.CUNY.EDU (IBM VM SMTP R1.1) with TCP; Tue,
 29 Nov 88 04:51:14 EDT
Received: from VIM.BRL.MIL by VIM.brl.MIL id aa15196; 29 Nov 88 1:36 EST
Received: from adm.brl.mil by VIM.BRL.MIL id aa15158; 29 Nov 88 1:22 EST
Received: from USENET by ADM.BRL.MIL id aa01166; 29 Nov 88 1:20 EST
Newsgroups: comp.lang.pascal
Subject: Re: Pointers in TP4
Message-ID: <230@prles2.UUCP>
Date: 28 Nov 88 08:36:27 GMT
Sender: nobody@prles2.uucp
Keywords: operations on them
To:       info-pascal@vim.brl.mil

bart van pelt  writes:
> To increment pointers in TP4, use a type cast as follows
>
> longint( Ptr ) := longint( Ptr ) + Increment;
  ^^^^^^^^^^^^^^

Right idea but you shouldn't be able to assign ANYTHING to a function.
You can do it without using any conversion extensions as long as a pointer
type and integer type are the same length on your computer.  Just make a
pointer math type like this:

Type
  your_type_pointer = ^to_your_type;

  pointer_math  = record
    case boolean of
      Pnt       : your_type_pointer;
      IPnt      : integer;
  end { pointer_math record } ;

Procedure Bump_Pointer (Var P : your_type_pointer; HowMany : integer);

Var
  Cnvrtr        : pointer_math;

Begin { Bump_Pointer }
  Cnvrtr.Pnt := P;
  Cnvrtr.IPnt := Cnvrtr.IPnt + HowMany*SizeOfYourType;
  P := Cnvrtr.Pnt;
end { Bump_Pointer } ;

You would then call the routine Bump_Pointer(P,1) to go to the next element.
If TP4 has some size function (I.E. a function which will take as an argument
either a variable or type name and return the size in bytes of the data
type) then you should use that instead of the constant SizeOfYourType.
That way you don't have to sully yourself with dirty bytes and what not
;-).
        Charlie