943,867 Members | Top Members by Rank

Ad:
Feb 23rd, 2009
0

Declaring a Record Type using Case.

Expand Post »
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?
Similar Threads
Reputation Points: 11
Solved Threads: 11
Junior Poster in Training
jsosnowski is offline Offline
68 posts
since Nov 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Pascal and Delphi Forum Timeline: Undetermined numbers
Next Thread in Pascal and Delphi Forum Timeline: A Nice Shortest path problem !





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC