C Library Functions  - listout (3)

NAME

listout(3f) - [M_strings:NUMERIC] expand a list of numbers where negative numbers denote range ends (1 -10 means 1 thru 10) (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Returns
Example
Author
License

SYNOPSIS

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

DESCRIPTION

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].

OPTIONS

icurve_lists(:)
  input array

RETURNS

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

EXAMPLE

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_listout

Results:

    > 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

AUTHOR

John S. Urban

LICENSE

Public Domain


Nemo Release 3.1 listout (3) July 22, 2023
Generated by manServer 1.08 from 48ee1a75-170e-45aa-87ee-6623e69322de using man macros.