[comp.lang.ada] instantiating io for variant records

mcragg@gmu90x.UUCP (Maureen Cragg) (04/18/89)

i have a variant record type defined, something like this:

type field_type is (id, date, text);
type record_type(field : field_type);
type rec_ptr is access record_type;
type record_type(field : field_type) is
   record
     previous : rec_ptr := null;
     next     : rec_ptr := null;
     case field is
        when id =>
           id : integer;
        when date =>
           date : calendar.time;
        when text =>
           line : string(1..80);
     end case;
   end record;

for the purpose of storing different types of info in the same record,
as well as varying numbers of the same type(the text is used to store
free-format data, entered via an text editor:can be any number of lines).

so how does one instantiate sequential_io for this record_type? this:

package rec_io is new sequential_io(record_type);

gives the error msg: "generic package/subprogram spec/body requires
                       a constrained type"

adTHANXvance for any suggestions.
the air drummer

mcragg@gmu90x.UUCP (Maureen Cragg) (04/18/89)

after compiling this code successfully under dec ada, i finally figured
out that the discriminant needed a default...dec ada is much more forgiving
than adavax:-}

the air drummer