X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=Ada95%2Fsrc%2Fterminal_interface-curses-menus.adb;h=0b24c74f57c3a9465ba7deaa631f0521b8f1914d;hp=92ae0f9c2d1b1dc06849375e2deda7c8231d6ef4;hb=8f527f87c0b979d9c2598ef5c3394463af288468;hpb=0eb88fc5281804773e2a0c7a488a4452463535ce diff --git a/Ada95/src/terminal_interface-curses-menus.adb b/Ada95/src/terminal_interface-curses-menus.adb index 92ae0f9c..0b24c74f 100644 --- a/Ada95/src/terminal_interface-curses-menus.adb +++ b/Ada95/src/terminal_interface-curses-menus.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998-2004,2008 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -33,9 +33,10 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------ --- Author: Juergen Pfeifer 1996 +-- Author: Juergen Pfeifer, 1996 -- Version Control: --- $Revision: 1.20 $ +-- $Revision: 1.26 $ +-- $Date: 2008/07/26 18:50:58 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Unchecked_Deallocation; @@ -105,8 +106,8 @@ package body Terminal_Interface.Curses.Menus is type Desc_String_Ptr is access Desc_String; pragma Controlled (Desc_String_Ptr); - Name_Str : Name_String_Ptr := new Name_String; - Desc_Str : Desc_String_Ptr := new Desc_String; + Name_Str : constant Name_String_Ptr := new Name_String; + Desc_Str : constant Desc_String_Ptr := new Desc_String; Name_Len, Desc_Len : size_t; Result : Item; begin @@ -194,7 +195,7 @@ package body Terminal_Interface.Curses.Menus is Opt : C_Int) return C_Int; pragma Import (C, Set_Item_Opts, "set_item_opts"); - Opt : C_Int := IOS_2_CInt (Options); + Opt : constant C_Int := IOS_2_CInt (Options); Res : Eti_Error; begin Res := Set_Item_Opts (Itm, Opt); @@ -214,7 +215,7 @@ package body Terminal_Interface.Curses.Menus is Opt : C_Int) return C_Int; pragma Import (C, Item_Opts_Off, "item_opts_off"); - Opt : C_Int := IOS_2_CInt (Options); + Opt : constant C_Int := IOS_2_CInt (Options); Err : Eti_Error; begin if On then @@ -233,7 +234,7 @@ package body Terminal_Interface.Curses.Menus is function Item_Opts (Itm : Item) return C_Int; pragma Import (C, Item_Opts, "item_opts"); - Res : C_Int := Item_Opts (Itm); + Res : constant C_Int := Item_Opts (Itm); begin Options := CInt_2_IOS (Res); end Get_Options; @@ -374,7 +375,7 @@ package body Terminal_Interface.Curses.Menus is Opt : C_Int) return C_Int; pragma Import (C, Set_Menu_Opts, "set_menu_opts"); - Opt : C_Int := MOS_2_CInt (Options); + Opt : constant C_Int := MOS_2_CInt (Options); Res : Eti_Error; begin Res := Set_Menu_Opts (Men, Opt); @@ -394,7 +395,7 @@ package body Terminal_Interface.Curses.Menus is Opt : C_Int) return C_Int; pragma Import (C, Menu_Opts_Off, "menu_opts_off"); - Opt : C_Int := MOS_2_CInt (Options); + Opt : constant C_Int := MOS_2_CInt (Options); Err : Eti_Error; begin if On then @@ -413,7 +414,7 @@ package body Terminal_Interface.Curses.Menus is function Menu_Opts (Men : Menu) return C_Int; pragma Import (C, Menu_Opts, "menu_opts"); - Res : C_Int := Menu_Opts (Men); + Res : constant C_Int := Menu_Opts (Men); begin Options := CInt_2_MOS (Res); end Get_Options; @@ -924,7 +925,7 @@ package body Terminal_Interface.Curses.Menus is P : Pointer := C_Mitems (Men); begin - if P = null or else Index not in 1 .. Item_Count (Men) then + if P = null or else Index > Item_Count (Men) then raise Menu_Exception; else P := P + ptrdiff_t (C_Int (Index) - 1); @@ -973,7 +974,7 @@ package body Terminal_Interface.Curses.Menus is Key : C_Int) return C_Int; pragma Import (C, Driver, "menu_driver"); - R : Eti_Error := Driver (Men, C_Int (Key)); + R : constant Eti_Error := Driver (Men, C_Int (Key)); begin if R /= E_Ok then case R is @@ -996,7 +997,7 @@ package body Terminal_Interface.Curses.Menus is begin if IA /= null and then Free_Items then for I in IA'First .. (IA'Last - 1) loop - if (IA (I) /= Null_Item) then + if IA (I) /= Null_Item then Delete (IA (I)); end if; end loop;