Loading Makefile.version +1 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ export PROJECT=drspine export VERSION_MAJOR=1 export VERSION_MINOR=1 export VERSION_RELEASE=2 export VERSION_RELEASE=3 export PROJLIB=lib$(PROJECT).a export PROJARCH=$(PROJECT)-$(VERSION_MAJOR).$(VERSION_MINOR) Loading sources/drspine.f90 +5 −3 Original line number Diff line number Diff line Loading @@ -1644,7 +1644,7 @@ CONTAINS integer, save :: sampleid_length = 10 integer, save :: samplename_length = 20 !integer, save :: sampledescription_length = 20 integer, save :: filename_length = 24 integer, save :: filename_length = 26 logical :: details, full, histo full = found('full') ! Loading @@ -1670,7 +1670,8 @@ CONTAINS if (full.or.details) then write(output_unit,'(i3,":",i8,1x,a,"(",i3,") |",a,"|",a,"|",a,"| mode=",a," role=",a)') & i, data_scan(i)%id, & data_scan(i)%file(1:filename_length), & !data_scan(i)%file(1:filename_length), & truncate_filename(data_scan(i)%file, filename_length), & data_scan(i)%number_of_points, & data_scan(i)%name(1:name_length), & data_scan(i)%sample%id(1:sampleid_length), & Loading @@ -1682,7 +1683,8 @@ CONTAINS else ! short write(output_unit,'(i3,":",i8,1x,a,"(",i3,") |",a,"| mode=",a9," role=",a10)') & i, data_scan(i)%id, & data_scan(i)%file(1:filename_length), & !data_scan(i)%file(1:filename_length), & truncate_filename(data_scan(i)%file, filename_length), & data_scan(i)%number_of_points, & data_scan(i)%name(1:name_length), & cformat_mode(data_scan(i)%mode), & Loading sources/os_utils.F90 +21 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ module os_utils public :: create_directory, change_directory public :: get_osname, os_openfile public :: format_path, search_path public :: truncate_filename character(len=*), parameter :: FILEPATH_SEPARATOR = '/' Loading Loading @@ -243,4 +244,24 @@ contains end if end do end function search_path function truncate_filename(filename, maxlength) result(cresult) character(len=*), intent(in) :: filename integer, intent(in) :: maxlength character(len=maxlength) :: cresult ! integer :: ilen ilen = len_trim(filename) cresult = repeat(' ',maxlength) if(ilen<=maxlength) then cresult(1:ilen) = filename(1:ilen) else ! remove extension ilen = index(filename, '.', .true.) cresult = filename(ilen-maxlength:ilen-1) endif end function truncate_filename end module os_utils tests/testosutils.f90 +9 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ program testosutils call test_os_openfile() call test_change_directory() call test_execute_command() call test_truncate_filename() contains Loading @@ -39,6 +40,14 @@ contains 'search path failed (3)') end subroutine test_search_path subroutine test_truncate_filename() write(*,'(a)') '===> test_truncate_filename' call assert('/SNS/NSE/IPTS-01234/s56789.echo'==trim(truncate_filename('/SNS/NSE/IPTS-01234/s56789.echo',64)),& 'full file name (1)') call assert('234/s56789'==trim(truncate_filename('/SNS/NSE/IPTS-01234/s56789.echo',10)),& 'short file name (1)') end subroutine test_truncate_filename subroutine test_create_directory() write(*,'(a)') '===> test_create_directory' Loading Loading
Makefile.version +1 −1 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ export PROJECT=drspine export VERSION_MAJOR=1 export VERSION_MINOR=1 export VERSION_RELEASE=2 export VERSION_RELEASE=3 export PROJLIB=lib$(PROJECT).a export PROJARCH=$(PROJECT)-$(VERSION_MAJOR).$(VERSION_MINOR) Loading
sources/drspine.f90 +5 −3 Original line number Diff line number Diff line Loading @@ -1644,7 +1644,7 @@ CONTAINS integer, save :: sampleid_length = 10 integer, save :: samplename_length = 20 !integer, save :: sampledescription_length = 20 integer, save :: filename_length = 24 integer, save :: filename_length = 26 logical :: details, full, histo full = found('full') ! Loading @@ -1670,7 +1670,8 @@ CONTAINS if (full.or.details) then write(output_unit,'(i3,":",i8,1x,a,"(",i3,") |",a,"|",a,"|",a,"| mode=",a," role=",a)') & i, data_scan(i)%id, & data_scan(i)%file(1:filename_length), & !data_scan(i)%file(1:filename_length), & truncate_filename(data_scan(i)%file, filename_length), & data_scan(i)%number_of_points, & data_scan(i)%name(1:name_length), & data_scan(i)%sample%id(1:sampleid_length), & Loading @@ -1682,7 +1683,8 @@ CONTAINS else ! short write(output_unit,'(i3,":",i8,1x,a,"(",i3,") |",a,"| mode=",a9," role=",a10)') & i, data_scan(i)%id, & data_scan(i)%file(1:filename_length), & !data_scan(i)%file(1:filename_length), & truncate_filename(data_scan(i)%file, filename_length), & data_scan(i)%number_of_points, & data_scan(i)%name(1:name_length), & cformat_mode(data_scan(i)%mode), & Loading
sources/os_utils.F90 +21 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ module os_utils public :: create_directory, change_directory public :: get_osname, os_openfile public :: format_path, search_path public :: truncate_filename character(len=*), parameter :: FILEPATH_SEPARATOR = '/' Loading Loading @@ -243,4 +244,24 @@ contains end if end do end function search_path function truncate_filename(filename, maxlength) result(cresult) character(len=*), intent(in) :: filename integer, intent(in) :: maxlength character(len=maxlength) :: cresult ! integer :: ilen ilen = len_trim(filename) cresult = repeat(' ',maxlength) if(ilen<=maxlength) then cresult(1:ilen) = filename(1:ilen) else ! remove extension ilen = index(filename, '.', .true.) cresult = filename(ilen-maxlength:ilen-1) endif end function truncate_filename end module os_utils
tests/testosutils.f90 +9 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ program testosutils call test_os_openfile() call test_change_directory() call test_execute_command() call test_truncate_filename() contains Loading @@ -39,6 +40,14 @@ contains 'search path failed (3)') end subroutine test_search_path subroutine test_truncate_filename() write(*,'(a)') '===> test_truncate_filename' call assert('/SNS/NSE/IPTS-01234/s56789.echo'==trim(truncate_filename('/SNS/NSE/IPTS-01234/s56789.echo',64)),& 'full file name (1)') call assert('234/s56789'==trim(truncate_filename('/SNS/NSE/IPTS-01234/s56789.echo',10)),& 'short file name (1)') end subroutine test_truncate_filename subroutine test_create_directory() write(*,'(a)') '===> test_create_directory' Loading