Declaring a Record Type using Case.

Please support our Pascal and Delphi advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2007
Posts: 68
Reputation: jsosnowski is an unknown quantity at this point 
Solved Threads: 11
jsosnowski's Avatar
jsosnowski jsosnowski is offline Offline
Junior Poster in Training

Declaring a Record Type using Case.

 
0
  #1
Feb 23rd, 2009
I just ran across some code that declares a complex packed record:

aSInt = Integer;
entity = packed Record
   Enttype : byte;   
   field2 : double;
   ... //continues with other standard fields and then uses this case 
      CASE aSInt OF
       entlin: (linpt1,
            linpt2: point);
         entln3: (ln3pt1,
            ln3pt2: point);
         entmrk: (mrkpnt,
            mrkvec: point;
            mrktyp,
            mrksiz: aSInt);  
            ... //other case types
      End;
end;

The entlin, entln3, entmrk are constants used to identify specific types.
This code confuses me. The case statement is using an aSint, which is an integer, but does not assign it to a variable such as with this:
Case Etype of 
       entlin: (linpt1,
            linpt2: point);
       ...//etc.
where Etype is a variable that conveys the type constant to apply.

How is this code used without an identification of what the aSint? How is the Asint value passed on when the record is used since it varies in size and the type of each instance must known to determine its size and allocate memory and read the data?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Pascal and Delphi Forum
Thread Tools Search this Thread



Tag cloud for Pascal and Delphi
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC