FORTRAN preprocessor---ForPP
[Back to main page]

FORTRAN preprocessor ForPP is implemented as KEDIT (KEDIT for DOS and OS/2 versions 4.00, 5.00 and KEDIT for Windows versions 1.0 and 1.5) macros (KEXX), and as a FORTRAN program for DOS (plus executable), and UNIX. They work a bit different way, KEXX version is faster and more sophisticated. The idea is just macro substitution and enabling several instructions per line. FORTRAN code becomes more compact, let's see:
* ForPP (fragment)
      If (ncol==1) {ln(1:newl0)=s2(1:l2)//ln(l1+1:l0)
	 Do i=1, less; nw=newl0+i; ln(nw:nw)=' ' # MakeRepl=l2+1; Return
      }: (lrest>0) {ln(ncol:newl0)=s2(1:l2)//ln(ncol+l1:l0)
	 Do i=1, less; nw=newl0+i; ln(nw:nw)=' ' # MakeRepl=ncol+l2; Return
      }: (lrest==0) {ln(ncol:newl0)=s2(1:l2); MakeRepl=0; Return
      }{ Msg, 'Debugging information:'; Msg, 'Current column:', ncol
	 Msg, 'Length:', l0, ' line:', ln(1:l0)
	 Msg, 'Length:', l1, ' pattern:', s1(1:l1)
	 Msg, 'Length:', l2, ' substitution:', s2(1:l2); Call Dam
      }

* FORTRAN (formatted manually for better readability)
* F-77 extensions such as `End Do' used
      If (ncol.eq.1) Then
	 ln(1:newl0)=s2(1:l2)//ln(l1+1:l0)
	 Do i=1, less
	    nw=newl0+i
	    ln(nw:nw)=' '
	 End Do

	 MakeRepl=l2+1
	 Return
      Else If (lrest.gt.0) Then
	 ln(ncol:newl0)=s2(1:l2)//ln(ncol+l1:l0)
	 Do i=1, less
	    nw=newl0+i
	    ln(nw:nw)=' '
	 End Do
	 MakeRepl=ncol+l2
	 Return
      Else If (lrest.eq.0) Then
	 ln(ncol:newl0)=s2(1:l2)
	 MakeRepl=0
	 Return
      Else
	 Print *, 'Debugging information:'
	 Print *, 'Current column:', ncol
	 Print *, 'Length:', l0, ' line:', ln(1:l0)
	 Print *, 'Length:', l1, ' pattern:', s1(1:l1)
	 Print *, 'Length:', l2, ' substitution:', s2(1:l2)
	 Call Dam
      End If
You may see that even FORTRAN-90 and GNU FORTRAN-77 with FORTRAN-90 features does not cover ForPP's facilities.

End of ForPP page