-- Simple demonstration of the generic sorting package. WITH TEXT_IO ; USE TEXT_IO ; -- make standard text I/O available WITH gensort ; -- make generic sorting package available PROCEDURE sortdemo IS -- Global Types : TYPE intvec IS ARRAY ( INTEGER RANGE <> ) OF INTEGER ; -- Generic Package Instantiations : PACKAGE intsort IS NEW gensort ( INTEGER, intvec, ">" ) ; PACKAGE intio IS NEW INTEGER_IO ( INTEGER ) ; USE intsort, intio ; -- Global Variables : test_array : intvec ( 1..10 ) ; -- array to be sorted BEGIN -- sortdemo -- initialise array to be sorted test_array := ( 56, -7, 4, 98, -300, -301, -45, 199, 0, 4 ) ; -- sort this array quicksort ( test_array ) ; -- write out results FOR index IN test_array'RANGE LOOP PUT ( test_array ( index ), WIDTH => 5 ) ; PUT ( " " ) ; END LOOP ; NEW_LINE ; END sortdemo ; -----------------------------------------------------