IO: Add compressed field to the XML file attribute.

Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
Grzegorz Kowal 2020-08-10 16:22:37 -03:00
parent 1d154ab492
commit 36996e6f76

View File

@ -2896,47 +2896,54 @@ module io
!
! Arguments:
!
! lun - the file handler to write to;
! aname - the file attribute name;
! bytes - the file size in bytes;
! digest - the digest of the file content;
! filename - the file name;
! lun - the file handler to write to;
! aname - the file attribute name;
! filename - the file name;
! data_bytes - the file size in bytes;
! data_digest - the digest of the file content;
! compressed_bytes - the size of the compressed data in bytes;
! compressed_digest - the digest of the compressed data;
!
!===============================================================================
!
subroutine write_attribute_xml_file(lun, aname, filename, bytes, digest)
subroutine write_attribute_xml_file(lun, aname, filename, &
data_bytes, data_digest, &
compressed_bytes, compressed_digest)
implicit none
! input and output arguments
!
integer , intent(in) :: lun
character(len=*), intent(in) :: aname, filename
integer(kind=8) , intent(in) :: bytes, digest
integer , intent(in) :: lun
character(len=*) , intent(in) :: aname, filename
integer(kind=8) , intent(in) :: data_bytes, data_digest
integer(kind=8) , optional, intent(in) :: compressed_bytes, compressed_digest
! local variables
!
character(len=32) :: digest_string, bytes_string
! local parameters
!
character(len=*), parameter :: afmt = "('<Attribute" // &
" type=" // '"' // "',a,'" // '"' // &
" name=" // '"' // "',a,'" // '"' // &
" size=" // '"' // "',a,'" // '"' // &
" digest_type=" // '"' // "',a,'" // '"' // &
" digest=" // '"' // "',a,'" // '"' // &
">',a,'</Attribute>')"
character(len=32) :: digest_string, bytes_string
character(len=1024) :: string
!
!-------------------------------------------------------------------------------
!
write(bytes_string,"(1i22)") bytes
write(digest_string,"(1z0.16)") digest
write(lun,afmt) "string", trim(adjustl(aname)), &
trim(adjustl(bytes_string)), &
"xxh64", &
trim(adjustl(digest_string)), &
trim(adjustl(filename))
string = '<Attribute type="string" name="' // trim(adjustl(aname)) // '"'
write(bytes_string,"(1i22)") data_bytes
string = trim(string) // ' size="' // trim(adjustl(bytes_string)) // '"'
if (present(compressed_bytes)) then
write(bytes_string,"(1i22)") compressed_bytes
string = trim(string) // ' compressed_size="' // &
trim(adjustl(bytes_string)) // '"'
end if
string = trim(string) // ' digest_type="xxh64"'
write(digest_string,"(1z0.16)") data_digest
string = trim(string) // ' digest="' // trim(adjustl(digest_string)) // '"'
if (present(compressed_digest)) then
write(digest_string,"(1z0.16)") compressed_digest
string = trim(string) // ' compressed_digest="' // &
trim(adjustl(digest_string)) // '"'
end if
string = trim(string) // '>' // trim(adjustl(filename)) // '</Attribute>'
write(lun,'(a)') trim(adjustl(string))
!-------------------------------------------------------------------------------
!