PROGRAM FA
IMPLICIT NONE
CHARACTER(*),PARAMETER::PB='FF08Obfuscate'
CHARACTER(*),PARAMETER::FC='(A)'
CALL RD()
CONTAINS
SUBROUTINE RD()
USE CE
USE DF
USE FG
USE SH
USE UI
USE VJ
USE,INTRINSIC::ISO_FORTRAN_ENV,ONLY:OUTPUT_UNIT,ERROR_UNIT
TYPE(CK)::CL(4)
TYPE(SM),ALLOCATABLE::AN(:)
INTEGER::SO
INTEGER::SP
INTEGER::IQ
CHARACTER(:),ALLOCATABLE::MR
CL(1)= &
CK(LS='help',CT='?', &
DU='Display command line and program usage help, then exit.')
CL(2)=CK(LS='version',DU='Display program version information, then exit.')
CL(3)=CK('dbg')
CL(4)= &
CK(LS='list', &
DU= &
'Specify a list file - each record from the given file will be add&
&ed (in addition to any source file specifications provided on&
& the command line) to the list of source file specifications &
&to be processed. May be specified multiple times.',OV=IX, &
CW=.TRUE.)
CALL PY(CL,AN,SO,MR)
IF(SO/=0)THEN
WRITE(ERROR_UNIT,FMT='(''Error parsing command line:'',A)')MR
CALL UZ(OUTPUT_UNIT,CL)
STOP 3
END IF
IF((CL(1)%PAA>0).OR.(COMMAND_ARGUMENT_COUNT()==0))THEN
CALL UZ(OUTPUT_UNIT,CL)
STOP
END IF
IF(CL(2)%PAA>0)THEN
CALL VAB(PB)
STOP
END IF
IF(CL(3)%PAA>0)THEN
DAC=.TRUE.
CALL GAD(DAE)
OPEN(UNIT=DAE,FILE=PB//DAF,ACTION='WRITE',STATUS='REPLACE')
WRITE(ERROR_UNIT,FMT='(''DbgFlag set'')')
ELSE
DAC=.FALSE.
END IF
DO IQ=1,CL(4)%PAA
CALL AAG(AN,CL(4)%AAH(IQ)%IAI,ERROR_UNIT,SP)
IF(SP/=0)THEN
CALL DAJ(SP)
END IF
END DO
CALL EAK(AN,OUTPUT_UNIT,ERROR_UNIT,SP)
CALL DAJ(SP)
END SUBROUTINE RD
SUBROUTINE EAK(FAL,OAM,EAN,SP)
USE BAO
USE BAP
USE CAQ
USE DAR
USE EAS
USE OAT
USE PAU
USE PAV
USE SH
TYPE(SM),INTENT(IN)::FAL(:)
INTEGER,INTENT(IN)::OAM
INTEGER,INTENT(IN)::EAN
INTEGER,INTENT(OUT)::SP
TYPE(DAW)::HAX
INTEGER::IAY
TYPE(SM),ALLOCATABLE::FAZ(:)
TYPE(BA0),POINTER::BA1
TYPE(PA2)::PA3
TYPE(EA4),ALLOCATABLE::EA5(:)
CALL EA6(HAX,FAL,FAZ,EA5)
DO IAY=1,SIZE(EA5)
WRITE(EAN,FC).BH.EA5(IAY)
END DO
IF(FA8(EA5))THEN
SP=2
RETURN
END IF
CALL BA9(FAZ,'',EAN,BA1,SP)
IF(SP/=0)THEN
RETURN
END IF
CALL DA0(BA1,EA5)
DO IAY=1,SIZE(EA5)
WRITE(EAN,FC).BH.EA5(IAY)
END DO
IF(FA8(EA5))THEN
SP=2
RETURN
END IF
CALL PA_(BA1,PA3,EA5)
DO IAY=1,SIZE(EA5)
WRITE(EAN,FC).BH.EA5(IAY)
END DO
IF(FA8(EA5))THEN
SP=2
END IF
CALL OBA(PA3,OAM)
SP=0
END SUBROUTINE EAK
SUBROUTINE BA9(FBB,CBC,EAN,CBD,SP)
USE BAO
USE BAP
USE DAR
USE SBE
USE SBF
USE SBG
USE SBH
USE SBI
USE SH
USE EAS
USE,INTRINSIC::ISO_FORTRAN_ENV,ONLY:INPUT_UNIT
TYPE(SM),INTENT(IN)::FBB(:)
CHARACTER(*),INTENT(IN)::CBC
INTEGER,INTENT(IN)::EAN
TYPE(BA0),POINTER,INTENT(OUT)::CBD
INTEGER,INTENT(OUT)::SP
INTEGER::IAY
INTEGER::IBJ
TYPE(DAW)::HAX
TYPE(EA4),ALLOCATABLE::EA5(:)
TYPE(BA0),POINTER::CBK
CLASS(SBL),ALLOCATABLE::CBM
TYPE(SBN),POINTER::SBO
CLASS(SBP),POINTER::PBQ
ALLOCATE(CBD)
ALLOCATE(CBD%PBR(0))
DO IBJ=1,SIZE(FBB)
CALL DBS(HAX,FBB(IBJ)%IAI,CBK,EA5)
DO IAY=1,SIZE(EA5)
WRITE(EAN,FC).BH.EA5(IAY)
END DO
IF(.NOT.FA8(EA5))THEN
CALL MBT(CBD,CBK,EA5)
DO IAY=1,SIZE(EA5)
WRITE(EAN,FC).BH.EA5(IAY)
END DO
END IF
DEALLOCATE(CBK)
IF(FA8(EA5))THEN
SP=2
RETURN
END IF
END DO
IF(CBC/='')THEN
CALL CBU(INPUT_UNIT,SBO)
PBQ=>SBO
SELECT CASE(CBC)
CASE ('FIXED')
ALLOCATE(CBM,SOURCE=FBV(PBQ))
CASE ('FREE')
ALLOCATE(CBM,SOURCE=FBW(PBQ))
END SELECT
CALL DBS(HAX,CBM,CBK,EA5)
DO IAY=1,SIZE(EA5)
WRITE(EAN,FC).BH.EA5(IAY)
END DO
IF(.NOT.FA8(EA5))THEN
CALL MBT(CBD,CBK,EA5)
DO IAY=1,SIZE(EA5)
WRITE(EAN,FC).BH.EA5(IAY)
END DO
END IF
DEALLOCATE(CBK)
IF(FA8(EA5))THEN
SP=2
RETURN
END IF
END IF
SP=0
END SUBROUTINE BA9
SUBROUTINE DAJ(SP)
INTEGER,INTENT(IN)::SP
SELECT CASE(SP)
CASE (0)
CASE (1)
STOP 1
CASE (2)
STOP 2
CASE DEFAULT
STOP 3
END SELECT
END SUBROUTINE DAJ
SUBROUTINE UZ(OAM,CL)
USE CE
INTEGER,INTENT(IN)::OAM
TYPE(CK),INTENT(IN)::CL(:)
CHARACTER(*),PARAMETER::FBX='(A)'
CHARACTER(:),ALLOCATABLE::LBY
INTEGER::SO
WRITE(OAM,FBX)'Obfuscate Fortran source.'
WRITE(OAM,FMT='()')
CALL GBZ(0,LBY,SO)
IF(SO/=0)THEN
LBY=PB
END IF
WRITE(OAM,FBX)'Usage: '//LBY//' [options] source-file-specs...'
WRITE(OAM,FMT='()')
WRITE(OAM,FBX)'Valid options are:'
WRITE(OAM,FMT='()')
CALL WB0(CL,OAM)
WRITE(OAM,FBX) &
'source-file-specs is a list of the names of the Fortran source files to&
& parse.'
WRITE(OAM,FMT='()')
WRITE(OAM,FBX)'The obfuscated source is written to the console.'
END SUBROUTINE UZ
END PROGRAM FA