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.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Annoying behavior Date: Sat, 25 Apr 2015 07:50:14 +0300 Organization: Tidorum Ltd Message-ID: References: <47c7df1e-17c1-44cb-a455-43431f0d39cd@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net y0kH4FwqcII/tP7gXQAolQbqyTpXADvd92xo59xcFLpdPMBVuf Cancel-Lock: sha1:CN2ar2hDIf3OCgDNDemOUbdUe+A= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 In-Reply-To: <47c7df1e-17c1-44cb-a455-43431f0d39cd@googlegroups.com> Xref: news.eternal-september.org comp.lang.ada:25611 Date: 2015-04-25T07:50:14+03:00 List-Id: On 15-04-25 00:40 , Laurent wrote: > Hi > > Trying to build a program which generates this type of txt files: Irrelevant. > For the moment I try to get the part done which generates the > content in the middle of the file, Irrelevant. > The annoying behavior (for me, perhaps it is absolutely normal) I get > is this while I try to read in the configuration file The annoying behaviour (for me) is the way you are asking this question... half- :-) > raised ANTIBIOTIQUES.NAME_TOO_SHORT : antibiotiques.adb:90 You should have showed the part of the program that raises this exception, and explained why you think it should NOT happen. Forcing us to download code from github is... annoying behaviour. At least, you should have put the github link at the start and explained why we should go there. In summary, your configuration file consists of groups of lines of the form: string Name, read with Text_IO.Get_Line string Code_SIL, read with Text_IO.Get_Line string CMI, read with Text_IO.Get_Line literal SIR, read with an instance of Enumeration_IO.Get. > So the first antibiotic is read but then something blows up. > Has to to with the SIR which is an enumeration. The others are > strings. If I remove the SIR's from the config file then all > items are read. This should have pushed you to look at (and show us) how you are reading in the SIR, which is with an instance of Enumeration_IO.Get. > I am a bit lost because I don't understand what the reading > procedure is getting to fail like this. Text_IO.Get_Line reads the whole rest of the line, and then skips the line terminator. Enumeration_IO.Get reads an enumeration literal, stops after the literal, and does NOT skip the line terminator. Therefore, the next Get_Line sees only the line terminator, returns a null string, and then skips the line terminator. The null string leads to raising Name_Too_Short. > Putting a Skip_Line behind doesn't help, makes things even worse. Uncommenting your Skip_Line after the SIR_Type_IO.Get works perfectly for me, giving the output: Begin of reading loop read name: Amikacine read code: am read cmi: test read sir: S Begin of reading loop read name: Augmentin and so on. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .