From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,48bf593f723b7524 X-Google-Attributes: gid103376,public From: "Josh Highley" Subject: Maybe not exactly a variant record. Date: 1999/04/22 Message-ID: <371f1e6d.0@silver.truman.edu>#1/1 X-Deja-AN: 469674602 References: <371c84fb.0@silver.truman.edu> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 X-Complaints-To: abuse@more.net X-Trace: news.more.net 924809527 7991 150.243.160.9 (22 Apr 1999 19:32:07 GMT) Organization: MOREnet X-MSMail-Priority: Normal NNTP-Posting-Date: 22 Apr 1999 19:32:07 GMT Newsgroups: comp.lang.ada Date: 1999-04-22T19:32:07+00:00 List-Id: Josh Highley wrote in message news:371c84fb.0@silver.truman.edu... > I have the following type declaration and I would like to have an array of > them. However, I need "length" to have different values for each element of > the array. > > type field (length : positive) is limited private; > --it's later defined to be a record with a string(1..length), among other > information. > > For instance, I would like field_array(1) to be a field with a length of 10, > field_array(2) to be a field of length 50, and so on. Can I declare an > array of these fields, with each field of a different length? > > I'm using GNAT 3.11, AdaGIDE 6.21, and Win95 I guess I should clarify. I'm not exactly sure the record is variant, at least not in the sense as some people have thought. So, here's the private declaration of "type field(length : positive);" private type field (length : positive ) is record row : y_pos := 0; column : x_pos := 0; fld_length : positive := length; text : string(1..length) := (others => ' '); text_length : natural := 0; label : string(1..x_pos'last) := (others => ' '); label_length : natural := 0; align : alignment := left; char : character := ' '; position : natural := 0; end record; I know there's a lot of room for optimization, but it gets the job done : ) So, the value of "length" doesn't change the record fields that are accessible, just the number of characters in a string. Now that I've better described the situation, does this change the responses to declaring an array of type field with different lengths?? P.S. For my future reference, is the record that I've declared above considered a variant record, or is it called something else since the available record fields don't actually change with the value of "length"? Thanks again, Josh Highley joshhighley@hotmail.com