text stringlengths 0 234 |
|---|
return ret : UUID do |
uuid_uuid_h.uuid_generate (ret.data (ret.data'First)'Unrestricted_Access); |
end return; |
end Generate; |
procedure Generate (this : out UUID) is |
begin |
this := Generate; |
end Generate; |
function Generate_Random return UUID is |
begin |
return ret : UUID do |
uuid_uuid_h.uuid_generate_random (ret.data (ret.data'First)'Unrestricted_Access); |
end return; |
end Generate_Random; |
procedure Generate_Random (this : out UUID) is |
begin |
this := Generate_Random; |
Function Definition: function conv is new ada.Unchecked_Conversion (system.Address, zlibVersion_Access); |
Function Body: zlibVersion : zlibVersion_Access; |
begin |
p.open (File_Name => "/lib/libz.so.1"); |
zlibVersion := conv (p.Sym ("zlibVersion")); |
declare |
version : constant string := Interfaces.C.Strings.Value (zlibVersion.all); |
begin |
test.Assert (Version (version'first + 1 ) = '.', "Dont seem to be a version numnber"); |
test.Assert (Version (version'first + 3 ) = '.', "Dont seem to be a version numnber"); |
Function Definition: procedure Chat_Server is |
Function Body: package ATI renames Ada.Text_IO; |
package CM renames Chat_Messages; |
package LLU renames Lower_Layer_UDP; |
package ACL renames Ada.Command_Line; |
package CC renames Client_Collections; |
package ASU renames Ada.Strings.Unbounded; |
use type CM.Message_Type; |
Server_EP: LLU.End_Point_Type; |
EP: LLU.End_Point_Type; |
Expired: Boolean; |
Port: Integer; |
Buffer_In: aliased LLU.Buffer_Type(1024); |
Buffer_Out: aliased LLU.Buffer_Type(1024); |
Collection_W: CC.Collection_Type; |
Collection_R: CC.Collection_Type; |
Unique: Boolean; |
Mess: CM.Message_Type; |
Nick: ASU.Unbounded_String; |
Comment: ASU.Unbounded_String; |
Nick_Server: ASU.Unbounded_String; |
Password: ASU.Unbounded_String; |
Data: ASU.Unbounded_String; |
Admin_EP: LLU.End_Point_Type; |
Admin_Pass: ASU.Unbounded_String; |
Shutdown: Boolean; |
begin |
-- Asignación y bindeado del Servidor |
Port := Integer'Value(ACL.Argument(1)); |
Password := ASU.To_Unbounded_String(ACL.Argument(2)); |
Server_EP := LLU.Build (LLU.To_IP(LLU.Get_Host_Name), Port); |
LLU.Bind (Server_EP); |
Shutdown := False; |
loop |
LLU.Reset (Buffer_In); |
LLU.Reset (Buffer_Out); |
LLU.Receive (Server_EP, Buffer_In'Access, 1000.0, Expired); |
if Expired then |
ATI.Put_Line ("Please, try again"); |
else |
Mess := CM.Message_Type'Input (Buffer_In'Access); |
if Mess = CM.Init then |
EP := LLU.End_Point_Type'Input (Buffer_In'Access); |
Nick := ASU.Unbounded_String'Input (Buffer_In'Access); |
ATI.Put("INIT received from " & ASU.To_String(Nick)); |
if ASU.To_String (Nick) = "reader" then |
Unique := False; |
CC.Add_Client (Collection_R, EP, Nick, Unique); |
else |
Unique := True; |
begin |
CC.Add_Client (Collection_W, EP, Nick, Unique); |
--Aviso de entrada al servidor |
Mess := CM.Server; |
CM.Message_Type'Output(Buffer_Out'Access, Mess); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.