      SUBROUTINE LSTFLT(LUN,FSPEC,TITLE)                                        
C                                                                               
C MODULE         LSTFLT                                                         
C VERSION        1.0                                                            
C PACKAGE        SIGPRO                                                         
C ROUTINE NO     20                                                             
C LAST MODIFIED  10/02/82   (BY D.R.POWELL)                                     
C AUTHOR         N C SEDGWICK                                                   
C                                                                               
C LISTS THE VAUES OF THE FILTER (FSPEC) TO THE SPECIFIED                        
C LOGICAL UNIT (LUN). WRITES THE TITLE FIRST.                                   
C                                                                               
C ACCEPTS AN FSPEC OF ONE OF THREE TYPES. NAMELY:                               
C         S-PLANE SPECIFICATION                                                 
C         Z-PLANE SPECIFICATION                                                 
C         FILTER CO-EFFICIENTS                                                  
C                                                                               
C PARAMETERS                                                                    
C **********                                                                    
C                                                                               
C LUN     I*4  LOGICAL UNIT FOR OUTPUT                                          
C FSPEC   R*4A FILTER SPECIFICATION                                             
C TITLE   C*(*)TITLE OF UP TO 55 CHARACTERS                                     
C                                                                               
      INTEGER LUN                                                               
C LENGTH OF FSPEC IS INDETERMINATE                                              
      REAL FSPEC(9999)                                                          
      CHARACTER*(*) TITLE                                                       
C                                                                               
C GLOBAL VARIABLES                                                              
C ****************                                                              
C                                                                               
$INCLUDE SIGPRO10.CMN (NLIST)                                                   
$INCLUDE SPLANE10.CMN (NLIST)                                                   
$INCLUDE ZPLANE10.CMN (NLIST)                                                   
C                                                                               
C LOCAL VARIABLES                                                               
C ***************                                                               
C                                                                               
C IS      I*4  LOOP COUNTER OVER SINGULARITIES/QUARTET                          
C IP      I*4  POINTER TO START OF CURRENT SINGULARITY/QUARTET                  
C IER     I*4  ERROR NUMBER                                                     
C TYPE    C*14 TEXT GIVING TYPE OF SINGULARITY                                  
C IOS     I*4  FORTRAN I/O SYSTEM ERROR CODE                                    
C RTN     I*4  ROUTINE NUMBER WITHIN PACKAGE                                    
C                                                                               
      INTEGER IS,IP,IER,IOS,RTN                                                 
      CHARACTER*14 TYPE                                                         
      PARAMETER (RTN=20)                                                        
C                                                                               
C===================================================================            
C                                                                               
C CHECK PARAMETERS                                                              
C ****************                                                              
C                                                                               
      IF(LUN.LT.0) GOTO 9001                                                    
      IF(LEN(TITLE).GT.55) GOTO 9002                                            
C                                                                               
C INITIALISE                                                                    
C **********                                                                    
C                                                                               
      IOS=0                                                                     
C                                                                               
C SWITCH ON TYPE OF FILTER SPECIFICATION                                        
C **************************************                                        
C                                                                               
      IF(INT(FSPEC(PSX)).EQ.PSV) GOTO 1000                                      
      IF(INT(FSPEC(PZX)).EQ.PZV) GOTO 2000                                      
C     IF(INT(FSPEC(PFX)).EQ.PFV) GOTO 3000                                      
      GOTO 9003                                                                 
C                                                                               
C LIST S-PLANE SPECIFICATION                                                    
C **************************                                                    
C                                                                               
1000  CONTINUE                                                                  
C                                                                               
C WRITE TITLE                                                                   
C -----------                                                                   
C                                                                               
      WRITE(LUN,1701,ERR=9004,IOSTAT=IOS) TITLE                                 
1701  FORMAT(/X,'S-PLANE SPECIFICATION --',A/X,21(1H-))                         
C                                                                               
C WRITE COLUMN HEADINGS                                                         
C ---------------------                                                         
C                                                                               
      WRITE(LUN,1702,ERR=9004,IOSTAT=IOS)                                       
1702  FORMAT(/X,4X,'SINGULARITY',7X,'REAL',11X,'IMAG',8X,'REAL VALUE',          
     1       6X,'IMAG VALUE',/,8X,'TYPE',11X,'GAIN',11X,'GAIN',                 
     2       7X,'(ATTENUATION)',3X,'(ANGULAR FREQ)',/)                          
C                                                                               
C LOOP AND WRITE SINGULARITY VALUES                                             
C ---------------------------------                                             
C                                                                               
      IF( INT(FSPEC(PSN)).LE.0) GOTO 1200                                       
      DO 1100 IS=1,INT(FSPEC(PSN))                                              
      IP=PSH+1+PSE*(IS-1)                                                       
      IT=INT(FSPEC(IP+PST))                                                     
C                                                                               
      IF (IT.EQ.PSTRZ) THEN                                                     
          TYPE='REAL AXIS ZERO'                                                 
      ELSEIF (IT.EQ.PSTRP) THEN                                                 
          TYPE='REAL AXIS POLE'                                                 
      ELSEIF (IT.EQ.PSTCZ) THEN                                                 
          TYPE=' COMPLEX ZERO '                                                 
      ELSEIF (IT.EQ.PSTCP) THEN                                                 
          TYPE=' COMPLEX POLE '                                                 
      ELSEIF (IT.EQ.PST2Z) THEN                                                 
          TYPE='CONJ ZERO PAIR'                                                 
      ELSEIF (IT.EQ.PST2P) THEN                                                 
          TYPE='CONJ POLE PAIR'                                                 
      ELSE                                                                      
          GOTO 9005                                                             
      ENDIF                                                                     
C                                                                               
      WRITE(LUN,1703,ERR=9004,IOSTAT=IOS) INT(FSPEC(IP+PSM)),TYPE,              
     1     FSPEC(IP+PSG),FSPEC(IP+PSJ),FSPEC(IP+PSR),FSPEC(IP+PSI)              
1703  FORMAT(X,I3,X,A14,X,G14.8,X,G14.8,X,G14.8,X,G14.8)                        
1100  CONTINUE                                                                  
1200  CONTINUE                                                                  
C                                                                               
C WRITE ARRAY USAGE INFO                                                        
C ----------------------                                                        
C                                                                               
      WRITE(LUN,1704,ERR=9004,IOSTAT=IOS)                                       
     1     INT(FSPEC(PSL)),PSH+PSE*INT(FSPEC(PSN)),INT(FSPEC(PSU))              
1704  FORMAT(X,20X,'ARRAY LENGTH=',I4,4X,                                       
     1       'IN USE=',I4,4X,'MAX USED=',I4)                                    
C                                                                               
C EXIT                                                                          
C ----                                                                          
C                                                                               
      GOTO 5000                                                                 
C                                                                               
C LIST Z-PLANE SPECIFICATION                                                    
C **************************                                                    
C                                                                               
2000  CONTINUE                                                                  
C                                                                               
C WRITE TITLE                                                                   
C -----------                                                                   
C                                                                               
      WRITE(LUN,2701,ERR=9004,IOSTAT=IOS) TITLE                                 
2701  FORMAT(/X,'Z-PLANE SPECIFICATION --',A/X,21(1H-))                         
C                                                                               
C WRITE COLUMN HEADINGS                                                         
C ---------------------                                                         
C                                                                               
      WRITE(LUN,2702,ERR=9004,IOSTAT=IOS)                                       
2702  FORMAT(/X,4X,'SINGULARITY',7X,'REAL',11X,'IMAG',8X,'REAL VALUE',          
     1       6X,'IMAG VALUE',/,8X,'TYPE',11X,'GAIN',11X,'GAIN',                 
     2       7X,'(ATTENUATION)',3X,'(ANGULAR FREQ)',/)                          
C                                                                               
C LOOP AND WRITE SINGULARITY VALUES                                             
C ---------------------------------                                             
C                                                                               
      IF( INT(FSPEC(PZN)).LE.0) GOTO 2200                                       
      DO 2100 IS=1,INT(FSPEC(PZN))                                              
      IP=PZH+1+PZE*(IS-1)                                                       
      IT=INT(FSPEC(IP+PZT))                                                     
      IF (IT.EQ.PZTRZ) THEN                                                     
          TYPE='REAL AXIS ZERO'                                                 
      ELSEIF (IT.EQ.PZTRP) THEN                                                 
          TYPE='REAL AXIS POLE'                                                 
      ELSEIF (IT.EQ.PZTCZ) THEN                                                 
          TYPE=' COMPLEX ZERO '                                                 
      ELSEIF (IT.EQ.PZTCP) THEN                                                 
          TYPE=' COMPLEX POLE '                                                 
      ELSEIF (IT.EQ.PZT2Z) THEN                                                 
          TYPE='CONJ ZERO PAIR'                                                 
      ELSEIF (IT.EQ.PZT2P) THEN                                                 
          TYPE='CONJ POLE PAIR'                                                 
      ELSE                                                                      
          GOTO 9005                                                             
      ENDIF                                                                     
C                                                                               
      WRITE(LUN,2703,ERR=9004,IOSTAT=IOS) INT(FSPEC(IP+PZM)),TYPE,              
     1     FSPEC(IP+PZG),FSPEC(IP+PZJ),FSPEC(IP+PZR),FSPEC(IP+PZI)              
2703  FORMAT(X,I3,X,A14,X,G14.8,X,G14.8,X,G14.8,X,G14.8)                        
2100  CONTINUE                                                                  
2200  CONTINUE                                                                  
C                                                                               
C WRITE ARRAY USAGE INFO                                                        
C ----------------------                                                        
C                                                                               
      WRITE(LUN,2704,ERR=9004,IOSTAT=IOS)                                       
     1     INT(FSPEC(PZL)),PZH+PZE*INT(FSPEC(PZN)),INT(FSPEC(PZU))              
2704  FORMAT(X,20X,'ARRAY LENGTH=',I4,4X,                                       
     1       'IN USE=',I4,4X,'MAX USED=',I4)                                    
C                                                                               
C EXIT                                                                          
C ----                                                                          
C                                                                               
      GOTO 5000                                                                 
C                                                                               
C LIST FILTER COEFFICIENTS                                                      
C ************************                                                      
C                                                                               
C3000 CONTINUE    ;COMMENTED OUT                                                
C     STOP        ;COMMENTED OUT                                                
C     GOTO 5000   ;COMMENTED OUT                                                
C                                                                               
C RETURN                                                                        
C ******                                                                        
C                                                                               
5000  CONTINUE                                                                  
      RETURN                                                                    
C                                                                               
C===================================================================            
C                                                                               
C ERRORS                                                                        
C ******                                                                        
C                                                                               
C PARAMETER LUN OUT OF RANGE                                                    
9001  CONTINUE                                                                  
      IER=1                                                                     
      GOTO 9999                                                                 
C                                                                               
C PARAMETER TITLE TOO LONG                                                      
9002  CONTINUE                                                                  
      IER=2                                                                     
      GOTO 9999                                                                 
C                                                                               
C FSPEC TYPE NOT RECOGNISED                                                     
9003  CONTINUE                                                                  
      IER=3                                                                     
      GOTO 9999                                                                 
C                                                                               
C I/O ERROR ON SPECIFIED LIST LUN                                               
9004  CONTINUE                                                                  
      IER=4                                                                     
      GOTO 9999                                                                 
C                                                                               
C SINGULARITY TYPE UNKNOWN                                                      
9005  CONTINUE                                                                  
      IER=5                                                                     
      GOTO 9999                                                                 
C                                                                               
C GENERAL ERROR EXIT                                                            
C ------------------                                                            
C                                                                               
9999  CONTINUE                                                                  
C                                                                               
      CALL UERERR('FILTER',RTN,IER,IOS,'E')                                     
      CALL UERREP('FILTER',RTN,.TRUE.)                                          
C                                                                               
      RETURN                                                                    
      END                                                                       
