This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
This patch adds the procedures For_Each and Sort_Table to GNAT.Table making its interface more similar to that of GNAT.Dynamic_Tables. The following test: 1. with GNAT.Table; 2. with Text_IO; use Text_IO; 3. procedure GTableTestFS is 4. package T is new GNAT.Table 5. (Table_Component_Type => Integer, 6. Table_Index_Type => Natural, 7. Table_Low_Bound => 1, 8. Table_Initial => 3, 9. Table_Increment => 100); 10. 11. procedure Action 12. (Index : Natural; 13. Item : Integer; 14. Quit : in out Boolean) 15. is 16. begin 17. Put_Line (Item'Img); 18. Quit := Item = 40; 19. end Action; 20. 21. procedure For_Each is new T.For_Each (Action); 22. procedure Sort_Table is new T.Sort_Table ("<"); 23. 24. begin 25. T.Init; 26. T.Append (60); 27. T.Append (50); 28. T.Append (40); 29. T.Append (30); 30. T.Append (20); 31. T.Append (10); 32. 33. For_Each; 34. Sort_Table; 35. For_Each; 36. end GTableTestFS; when run, generates the output 60 50 40 10 20 30 40 Tested on x86_64-pc-linux-gnu, committed on trunk 2013-09-10 Robert Dewar <dewar@adacore.com> * g-table.ads, g-table.adb (For_Each): New generic procedure (Sort_Table): New generic procedure.
Attachment:
difs
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |