-- -- Revision 3: Version upgrade only -- -- Revision 2: Minor updates to constants -- -- Revision 1: Initial release --
package body Gpgerror is -------------------------------------------------------------------------- -- -------------------------------------------------------------------------- function Gpg_Err_Make(Source : Gpg_Err_Source_T; Code : Gpg_Err_Code_T) return Gpg_Error_T is begin if Code /= GPG_ERR_NO_ERROR then return Shift_Left((Source and GPG_ERR_SOURCE_MASK), Integer(GPG_ERR_SOURCE_SHIFT)) or (code and GPG_ERR_CODE_MASK); end if;
return GPG_ERR_NO_ERROR; end Gpg_Err_Make;
-------------------------------------------------------------------------- -- -------------------------------------------------------------------------- function Gpg_Error (Code : Gpg_Err_Code_T) return Gpg_Error_T is begin return Gpg_Err_Make(GPG_ERR_SOURCE_DEFAULT,Code); end Gpg_Error;
-------------------------------------------------------------------------- -- Retrieve the error code from an error value. -------------------------------------------------------------------------- function Gpg_Err_Code(Err : Gpg_Error_T) return Gpg_Err_Code_T is begin return err and GPG_ERR_CODE_MASK; end Gpg_Err_Code;
-------------------------------------------------------------------------- -- Retrieve the error source from an error value. -------------------------------------------------------------------------- function Gpg_Err_Source(Err : Gpg_Error_T) return Gpg_Err_Source_T is begin return Shift_Right(Err,Integer(GPG_ERR_SOURCE_SHIFT)) and GPG_ERR_SOURCE_MASK; end Gpg_Err_Source;
function Gpg_Err_Make_From_Errno (Source : Gpg_Err_Source_T; Err : Interfaces.C.int) return Gpg_Error_T is begin return Gpg_Err_Make(source,Gpg_Err_Code_From_Errno(Err)); end Gpg_Err_Make_From_Errno;
function Gpg_Error_From_Errno(Err : Interfaces.C.Int) return Gpg_Error_T is begin return Gpg_Error(Gpg_Err_Code_From_Errno(Err)); end Gpg_Error_From_Errno;
end Gpgerror;
|