listout(3f) - [M_strings:NUMERIC] expand a list of numbers where negative numbers denote range ends (1 -10 means 1 thru 10) (LICENSE:PD)
Synopsis
Description
Options
Returns
Examples
Author
License
subroutine listout(icurve_lists,icurve_expanded,inums,ierr)
integer,intent(in) :: icurve_lists(:) integer,intent(out) :: icurve_expanded(:) integer,intent(out) :: inums integer,intent(out) :: ierr
expand a list of whole numbers where negative numbers indicate a range. So [10,-20] would be expanded to [10,11,12,13,14,15,16,17,18,19,20].
icurve_lists(:) input array
icurve_expanded(:) output array; assumed large enough to hold returned list inums number of icurve_expanded numbers on output ierr zero if no error occurred
Sample program:
program demo_listout use M_strings, only : listout implicit none integer,allocatable :: icurve_lists(:) integer :: icurve_expanded(1000) ! icurve_lists is input array integer :: inums ! icurve_expanded is output array integer :: i ! number of icurve_lists values on input, ! number of icurve_expanded numbers on output integer :: ierr icurve_lists=[1, 20, -30, 101, 100, 99, 100, -120, 222, -200] inums=size(icurve_lists) call listout(icurve_lists,icurve_expanded,inums,ierr) if(ierr == 0)then write(*,(i0))(icurve_expanded(i),i=1,inums) else write(*,(a,i0))error occurred in *listout* ,ierr write(*,(i0))(icurve_expanded(i),i=1,inums) endif end program demo_listoutResults:
> 1 20 21 22 23 > 24 25 26 27 28 > 29 30 101 100 99 > 100 101 102 103 104 > 105 106 107 108 109 > 110 111 112 113 114 > 115 116 117 118 119 > 120 222 221 220 219 > 218 217 216 215 214 > 213 212 211 210 209 > 208 207 206 205 204 > 203 202 201 200
John S. Urban
Public Domain
Nemo Release 3.1 | listout (3m_strings) | January 10, 2025 |