Keywords: sic-gdfv2

Next: GDF_READ_GILDAS Up: GDF API and programming Previous: GDF_COPY_HEADER Contents

## GDF_RANGE

Function `gdf_range` converts an input range to a valid output one given a total number of items. It is a generic function, accepting any kind of integers.

    interface gdf_range
      function gdf_range(nc,nchan)
        use gbl_message
        !---------------------------------------------------------------------
        ! @ public
        ! GDF API
        !       Return a range of (pixel / channel / items)
        !       Any Kind of integers is accepted
        !---------------------------------------------------------------------
        integer(4) :: gdf_range  ! Intent(out)  0 if no error
        integer(kind=*), intent(in) :: nchan     ! The actual number of channels
        integer(kind=*), intent(inout) :: nc(2)  ! The interpreted range of selected channels
      end function gdf_range
    end interface

Positive values of `nc` indicate an absolute channel number, while negative values are offsets from the last channel. Null values default to 1 (first channel) and `nchan` (last channel) respectively.