-- Generic package for working with palindromes
generic
min_length: Natural := 0;
-- Below this length it's not a palindrome
case_sensitive: Boolean := true;
-- Whether to do case sensitive checking
package palspkg is
function is_pal(s: String) return Boolean;
-- Is it a (long enough) palindrome, perhaps case sensitive?
function min_pal_length return Natural;
-- How long is long enough?
procedure make_pal(orig: String; new_pal: out String) with
pre => orig'length <= Integer'last / 2
and then (2 * orig'length = new_pal'length
and orig'first = 1 and new_pal'first = 1);
-- post => new_pal = orig & reverse(orig);
-- Make new_pal a palindrome containing orig and its reverse
end palspkg;