From: metcalf@apofort.cern.ch (Michael Metcalf )
Subject: Re: Uglifier (was Re: Real Programmers)
Organization: CERN European Lab for Particle Physics
Date: Thu, 17 Dec 1992 13:47:01 GMT

dodd@mycenae.cchem.berkeley.edu (Lawrence R. Dodd) writes:

>>>>>> "Peter" == Peter Marksteiner <pm@cc.univie.ac.at> writes:

>  Peter> Here's my favourite ugly program (uglified by hand, not by an automatic
>  Peter> uglifier).

>			   [much ugly code deleted]

>  Peter> C  ... CALCULATE STARTING VALUES
>  Peter> C
>  Peter>       DO 10 I=Z-NDIF
>  Peter>          C1 = 1.D0
>  Peter> C        OOO0O(I)=SQRT(PI)*(I+1)/X(N)
>  Peter> C        CALL REPLSR(OOO0O,O0OOO,NDIF,O,O0O0,OOO0O,C1)
>  Peter>    10 CONTINUE        
>  Peter>       IF(DABS(O).LT.1.E-15.AND.Z.GT.0.5) THEN
>  Peter>           C=137.542
>  Peter>           OOO0O=C
>  Peter>      END IF

>get rid of those indents. It makes it too easy to read.  Every should start at
>column 7.

That's the point - they are very misleading! This is the code passed through a
program to convert to f90 free source form and with misleading comments removed
by hand. Note variable CNDIF, for example.


                        Mike Metcalf
                        (metcalf@cernvm.cern.ch)

      IMPLICIT DOUBLEPRECISION (A - H, O - Z)                                   
17321 WRITE (6, 76123)                                                          
      READ (5, * , END = 17213) X                                               
      OOO0 = OOO0O (X)                                                          
      WRITE (6, * ) OOO0                                                        
      GOTO 17321                                                                
17213 STOP                                                                      
76123 FORMAT(10H ENTER X: )                                                     
      END                                                                       
      FUNCTION OOO0O (Z)                                                        
      IMPLICIT DOUBLEPRECISION (A - H, O - Z)                                   
      INTEGER O0OOO                                                             
      EQUIVALENCE (O, DO10I) , (O0OOO, NDIF) , (INDIF, O0OOO)                   
      DATA OCO, C2, C3, C4, C5, C6, C7, C8, C9 / - 2.056338417D-7,             
     &- 1.1651675918591D-3, - 9.6219715278770D-3, - 4.20026350340952D-2,       
     &0.1665386113822915D0, - 4.21977345555443D-2, 7.2189432466630D-3,         
     &6.1160950D-9, 1.1330272320D-6 / O0, OO0, CNDIF, O0O, OOO, OO, O00        
     &/ - 0.6558780715202538D0, 1.280502823882D-4, 1.D0, -                     
     &2.01348547807D-5, - 2.152416741149D-4, 0.5772156649015329D0,             
     &- 1.2504934821D-6 /                                                       
      NDIF = NINT (Z)                                                           
*                                                                               
*  ... CALCULATE STARTING VALUES                                                
*                                                                               
      DO10I = Z - NDIF                                                          
      C1 = 1.D0                                                                 
   10 CONTINUE                                                                  
      IF (DABS (O) .LT.1.E-15.AND.Z.GT.0.5) THEN                                
         C = 137.542                                                            
         OOO0O = CNDIF                                                          
*                                                                               
*                                                                               
         DO 171 I = 2, NDIF - 1                                                 
   17       CONTINUE                                                            
  171    OOO0O = OOO0O * I                                                      
         RETURN                                                                 
      ENDIF                                                                     
      OOO0O = O * (C1 + O * (OO + O * (O0 + O * (C4 + O * (C5 + O *            
     &(C6 + O * (C3 + O * (C7 + O * (C2 + O * (OOO + O * (OO0 + O *            
     &(O0O + O * (O00 + O * (C9 + O * (OCO + O * C8) ) ) ) ) ) ) ) ) ) )       
     &) ) ) )                                                                   
      OOO0O = 1. / OOO0O                                                        
      DO 2 I = 1, NDIF                                                          
         OOO0O = OOO0O * O                                                      
         DO10I = O + 1                                                          
    2 CONTINUE                                                                  
      O0OOO = - INDIF                                                           
      DO 3 I = 1, NDIF                                                          
         O = O - 1.                                                             
    3 OOO0O = OOO0O / O                                                         
      RETURN                                                                    
      END                                                                       
Newsgroups: comp.lang.fortran