New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get (in String; out Item; out Last) in many IO packages for null records is incorrect. #35
Comments
Thanks for taking the time to create the ticket; I appreciate this duplicates work you'd already done writing this up in a comment in the code. Is the third argument ("Last") part of an Ada standard/convention, or something created by Whitaker? |
@mk270 His various IO packages are based upon Ada.Text_IO. These particular subprograms are based on: http://www.adaic.org/resources/add_content/standards/05rm/html/RM-A-10-1.html paragraph 49; http://www.adaic.org/resources/add_content/standards/05rm/html/RM-A-10-7.html paragraphs 18-20. |
Ok, and presumably we should stick to that convention? (and the code currently violates it?) |
It would be better to stick to this convention, especially when you consider that calling this Get () subprogram may give you unexpected results. Generally standard Ada subprograms return 0 as position if nothing was processed/found (e.g. Strings.Fixed.Index, Vectors.Find_Index etc.). If these definitions were not based on standard definitions I would ignore it - alas they are, and this can cause confusion. |
Ok, I shall try to sort out makeinfl; the bugs I think are actually in routines that makeinfl calls. The bad news is that these routines are also called from the src/tools subdirectory, which we've been ignoring. |
Now that I think about it - we should have gprfile for src/tools too. I will add one in a moment and do pull request. |
Ah good, thanks. There is some documentation somewhere about these tools - I am not sure if they are still necessary/useful, but they may well be. |
There is howto file in src/tools. Just checked how build looks for them - many warnings... all over again :( |
Now that we have all the callers of get_non_comment_line(), one of which was in tools/ , I have fixed get_non_comment_line() such that it no longer throws exceptions in makeinfl - does this get us any further forward? |
Yes, but in different issue (in fact this should fix #36 ). And it does get us further - maybe the entire thing was cause by this. I will check in a moment. |
Last is always set to negative value, which under certain circumstances may lead to incorrect results.
Last should be set into position of last character in String that was processed inside Get.
In case of Inflections_Package.Interjection_Record_IO (among others) it is set to -1 in all cases (should be 0).
Unfortunately Interjection_Record_IO.Get can't be fixed at the moment due to different bug somewhere between makeinfl.adb and Inflections_Package.Ending_Record_IO.
The text was updated successfully, but these errors were encountered: