      SUBROUTINE FFPROC(NSPOT,NCHAN,NANC,TOTLIN,TOTBUF,DATBUF,ANCBUF,
     + DATOVL,ANCOVL,SYNCTR,NUMLIN)
      IMPLICIT NONE
C***********************************************************************
C    NAME- FFPROC
C
C    LANGUAGE- FORTRAN 77    TYPE- SUBROUTINE   COMPUTER- CRAY   
C
C    VERSION- 1.0     DATE- 2/21/91   PROGRAMMER- CARLA NEIGH (SMSRC)
C    VERSION- 2.0     DATE- 5/09/96   PROGRAMMER- ALEX POZDNYAK (FDC)
C      MODIFIED TO RUN ON THE CRAY.  REPLACED I*4 WITH INT AND
C      R*4 WITH REAL.
C 
C    FUNCTION-  THIS SUBROUTINE PERFORMS PROCESSING FOR A CASE OF A
C               DATA FRAME BEING THE FIRST FRAME INPUT FOLLOWING
C               SYNCHRONIZATION.  THE DATA AND OVERLAP BUFFERS USED
C               IN PROCESSING ARE INITIALIZED TO MISSING VALUES, AND
C               THE NUMBER OF LINES OF THE DATA BUFFER TO BE SKIPPED
C               OVER BEFORE ACTUAL PROCESSING BEGINS IS RETURNED AS
C               NUMLIN.
C
C    CALLING SEQUENCES-
C     VARIABLE  TYPE  I/O  DESCRIPTION
C     --------  ----  ---  -----------
C     NSPOT     INT    I   TOTAL NUMBER OF SPOTS PER SCAN IN BUFFER
C     NCHAN     INT    I   TOTAL NUMBER OF CHANNELS PER SPOT IN BUFFER
C     NANC      INT    I   TOTAL NUMBER OF ELEMENTS IN ANCILLARY DATA
C                          BUFFERS
C     TOTLIN    INT    I   TOTAL NUMBER OF LINES IN FRAME BUFFER
C     TOTBUF    INT    I   TOTAL NUMBER OF LINES IN OVERLAP BUFFER
C     DATBUF    REAL  I/O  3D BUFFER(NSPOT X TOTLIN X NCHAN) CONTAINING
C                          INSTRUMENT DATA
C     ANCBUF    REAL  I/O  3D BUFFER(NSPOT X TOTLIN X NANC) CONTAINING
C                          INSTRUMENT ANCILLARY DATA
C     DATOVL    REAL  I/O  3D BUFFER(NSPOT X TOTBUF X NCHAN) CONTAINING
C                          DATA FRAME OVERLAP
C     ANCOVL    REAL  I/O  3D BUFFER(NSPOT X TOTBUF X NANC) CONTAINING
C                          ANCILLARY DATA FRAME OVERLAP
C     SYNCTR    INT   I/O  COUNTER FOR NUMBER OF MISSING LINES TO
C                          INSERT INTO FRAME BEFORE ACTUAL DATA INPUT
C                          SO THAT FIRST LINE OF FRAME WILL BE A
C                          SYNCHRONIZATION POINT
C     NUMLIN    INT    O   NUMBER OF LINES IN DATA FRAME BUFFER FILLED
C                          BY SYNCHRONIZATION "DUMMY" LINES
C
C    SUBPROGRAMS CALLED- CLRBUF
C
C    EXIT STATES- NONE
C***********************************************************************
C
      INTEGER NSPOT, NCHAN, NANC, TOTLIN, TOTBUF, SYNCTR, NUMLIN
C
      REAL DATBUF(NSPOT,TOTLIN,NCHAN), ANCBUF(NSPOT,TOTLIN,NANC)
      REAL DATOVL(NSPOT,TOTBUF,NCHAN), ANCOVL(NSPOT,TOTBUF,NANC)
C
      INCLUDE 'SPVAL'
C
      NUMLIN = 0
C
C   CALL CLRBUF TO INITIALIZE BOTH FRAME BUFFERS AND BOTH OVERLAP
C   BUFFERS WITH MISSING VALUES.
C
      CALL CLRBUF(DATBUF, NSPOT, TOTLIN, NCHAN)
      CALL CLRBUF(ANCBUF, NSPOT, TOTLIN, NANC)
      CALL CLRBUF(DATOVL, NSPOT, TOTBUF, NCHAN)
      CALL CLRBUF(ANCOVL, NSPOT, TOTBUF, NANC)
C
C   INCREMENT LINE NUMBER SO THAT THE NUMBER OF DUMMY LINES IN
C   SYNCTR WILL BE FOUND IN THE BUFFER, PLUS THE NUMBER OF LINES
C   TO ACCOUNT FOR THE "32 SEC" OF THE PREVIOUS FRAME.
C
ccft  NUMLIN = (TOTBUF/2) + SYNCTR
      IF (NSPOT.EQ.56) NUMLIN = 9
      IF (NSPOT.EQ.30) NUMLIN = 8
      IF (NSPOT.EQ.90) NUMLIN = 24
C
      RETURN
      END
