Index of Functions: A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 
Index Page
cyacip

Table of contents
Procedure
Abstract
Required_Reading
Keywords
Declarations
Brief_I/O
Detailed_Input
Detailed_Output
Parameters
Exceptions
Files
Particulars
Examples
Restrictions
Literature_References
Author_and_Institution
Version

Procedure

     CYACIP ( Cycle the elements of a character array )

     SUBROUTINE CYACIP ( NELT, DIR, NCYCLE, ARRAY )

Abstract

     Cycle the elements of a character array forward or backward
     in place.

Required_Reading

     None.

Keywords

     ARRAY

Declarations

     IMPLICIT NONE

     INTEGER               NELT
     CHARACTER*1           DIR
     INTEGER               NCYCLE
     CHARACTER*(*)         ARRAY    ( * )

Brief_I/O

     VARIABLE  I/O  DESCRIPTION
     --------  ---  --------------------------------------------------
     NELT       I   Number of elements.
     DIR        I   Direction to cycle: 'F' or 'B'.
     NCYCLE     I   Number of times to cycle.
     ARRAY     I-O  Array to be cycled/cycled array.

Detailed_Input

     NELT     is the number of elements in the input array.

     DIR      is the direction in which the elements in the
              array are to be cycled.

                 'F' or 'f'  to cycle forward.
                 'B' or 'b'  to cycle backward.

     NCYCLE   is the number of times the elements in the array
              are to be cycled.

     ARRAY    is the array to be cycled.

Detailed_Output

     ARRAY    is the input array after it has been cycled.

Parameters

     None.

Exceptions

     1)  If the value of DIR is not recognized, the error
         SPICE(INVALIDDIRECTION) is signaled.

     2)  If NELT is less than 1, the output array is not modified.

     3)  If NCYCLE is negative, the array is cycled NCYCLE times in
         the opposite direction of DIR.

Files

     None.

Particulars

     This routine cycles a character array in place. To cycle
     an array and store the result in a new array, use CYCLAC.

     An array is cycled when its contents are shifted forward or
     backward by one place. An element pushed off one end of the
     array is brought around to the other end of the array instead
     of disappearing.

Examples

     Let the integer array A contain the following elements.

        A(1) = 'apple'
        A(2) = 'bear'
        A(3) = 'cake'
        A(4) = 'dragon'

     Cycling A forward once yields the array

        A(1) = 'dragon'
        A(2) = 'apple'
        A(3) = 'bear'
        A(4) = 'cake'

     Cycling A backward once yields the array

        A(1) = 'bear'
        A(2) = 'cake'
        A(3) = 'dragon'
        A(4) = 'apple'

     Cycling by any multiple of the number of elements in the array
     yields the same array.

Restrictions

     None.

Literature_References

     None.

Author_and_Institution

     N.J. Bachman       (JPL)
     J. Diaz del Rio    (ODC Space)
     H.A. Neilan        (JPL)
     W.L. Taber         (JPL)
     I.M. Underwood     (JPL)

Version

    SPICELIB Version 1.1.0, 12-AUG-2021 (JDR)

        Added IMPLICIT NONE statement.

        Edited the header to comply with NAIF standard.

    SPICELIB Version 1.0.0, 09-SEP-2005 (NJB) (HAN) (WLT) (IMU)
Fri Dec 31 18:36:05 2021