text
stringlengths
0
234
exception
when Active_Clients.Full_Map =>
Ban_Nick := Client_To_Ban(Active_Map);
Logout_Time := Ada.Calendar.Clock;
Old_Clients.Put (Old_Map,Ban_Nick,Logout_Time);
Comment := ASU.To_Unbounded_String(ASU.To_String(Ban_Nick)
& " banned for being idle too long");
Server_To_All (Comment,O_Buffer);
Active_Clients.Delete (Active_Map,Ban_Nick,Success);
Active_Clients.Put (Active_Map,Nick,Client_Data);
Function Definition: procedure main is
Function Body: inputFname : unbounded_string;
outputFname : unbounded_string;
img : image;
processedImg :imageprocess.image;
userSelection : character;
-- function which gets and validates file name
function getFilename(RWIndicator: in String) return Unbounded_String is
inputFname : unbounded_string;
outputFname : unbounded_string;
ans: character;
outfp: file_type;
begin
-- hanldle file writing
if RWindicator = "W" then
Put_Line ("Enter file name to write: ");
get_line(outputFname);
if exists(to_string(outputFname)) then
put_line("File exists - overwrite (Y/N)? ");
get(ans);
if ans = 'Y' then
return outputFname;
else
put_line("Exiting - image not saved");
GNAT.OS_Lib.OS_Exit (0);
end if;
end if;
return outputFname;
end if;
--handle file reading
if RWindicator = "R" then
Put_Line ("Enter file name to read: ");
get_line(inputFname);
if not exists(to_string(inputFname)) then
put_line("File does not exist: exiting - image not saved");
GNAT.OS_Lib.OS_Exit (0);
end if;
end if;
return inputFname;
Function Definition: function histEQUAL(img: in image) return image is
Function Body: equalImage : image;
type histArray is Array(1..256) of integer;
type CHIntArray is Array(1..256) of integer;
type cumuHistArray is Array(1..256) of Float;
type PDFArray is Array(1..256) of Float;
cumuHistArray1 : cumuHistArray;
histArray1 : histArray;
PDFArray1 : PDFArray;
CHIntArray1 : CHIntArray;
totalPixels : integer;
begin
equalImage.dx := img.dx;
equalImage.dy := img.dy;
--calculate the total number of pixels in the image
totalPixels := equalImage.dx * equalImage.dy;
--create a histogram distribution array
for n in 1..256 loop
histArray1(n) := 0;
cumuHistArray1(n) := 0.0;
PDFArray1(n) := 0.0;
CHIntArray1(n) := 0;
end loop;