* Last processed by NICE on 12-Jun-2000 15:54:00
* Customized for :  IEEE, LINUX, UNIX, MOTIF, F77
*----------------------------------------------------------------
*
*     ZIGZAG_CORRECTION()
*
*----------------------------------------------------------------
*
      SUBROUTINE  ZIGZAG_CORRECTION(XCOORD,NSUBREC)
*
      INCLUDE 'makplan.inc'
      REAL     XCOORD(1)
      INTEGER  NSUBREC(1)
*
      INTEGER  IFIRST,ILAST,I,ISUBSCAN
      REAL     OFFSET
*
      IFIRST = 1
      DO ISUBSCAN=1,NSUBSCAN
         IF (NSUBREC(ISUBSCAN).GT.0) THEN
            OFFSET = ((-1)**(ISUBSCAN-1))*ZIGZAG*10.
            ILAST  = IFIRST + NSUBREC(ISUBSCAN)-1
            DO I=IFIRST,ILAST
               XCOORD(I) = XCOORD(I)+OFFSET
               IF (FLIP) XCOORD(I) = -XCOORD(I)
            ENDDO
            IFIRST = ILAST+1
         ENDIF
      ENDDO
      RETURN
      END
*----------------------------------------------------------------
*
*     REMOVE_ZIGZAG_CORRECTION()
*
*----------------------------------------------------------------
*
      SUBROUTINE  REMOVE_ZIGZAG_CORRECTION(XCOORD,NSUBREC)
*
      INCLUDE 'makplan.inc'
      REAL     XCOORD(1)
      INTEGER  NSUBREC(1)
*
      INTEGER  IFIRST,ILAST,I,ISUBSCAN
      REAL     OFFSET
*
      IFIRST = 1
      DO ISUBSCAN=1,NSUBSCAN
         IF (NSUBREC(ISUBSCAN).GT.0) THEN
            OFFSET = ((-1)**(ISUBSCAN-1))*ZIGZAG*10.
            ILAST  = IFIRST + NSUBREC(ISUBSCAN)-1
            DO I=IFIRST,ILAST
               IF (FLIP) XCOORD(I) = -XCOORD(I)
               XCOORD(I) = XCOORD(I)-OFFSET
            ENDDO
            IFIRST = ILAST+1
         ENDIF
      ENDDO
      RETURN
      END
