Reputation: 395
I want to be able to read any number of lines from any text file, then store each line into an array, then make each of these array elements into one enumeration type. I am able to get the size of the array/enum before reading the file, then I can populate the array, the only problem is being able to specify the amount of elements in the enumeration type before populating it. Is there a way to do this? or some other clever approach?
Upvotes: 0
Views: 249
Reputation: 6611
You can't create types on-the-fly in Ada, so the short answer is "no".
But there's (as always) a trick: You can write Ada source files for a package from your main program, where you declare an internal enumeration type based on the input data to the main program. Then you can compile these source files to a dynamic library, load that library into the main program on-the-fly, and then call the operations of the package you just wrote.
Upvotes: 4