fpt and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Ref Manual Home |

DO NOT OBFUSCATE

Syntax:

DO NOT OBFUSCATE [:] [:] <symbol_specification> [ , <symbol_specification> ... ]

where <symbol_specification> may be:

<target> where all symbols with matching names will be protected
[ <class> : ] <target> where the symbols of only the named class will be protected
[ <class> : ] ... [ <grand-parent> % ] <parent> % <target> where the target is a child of the specified parent-child chain
/<target>/ where the target is the named COMMON block symbol
//<target> where the target is a variable in the default COMMON block
/<COMMON_name>/<target> where the target is a variable in the named COMMON block

The <class> specification specifies a top-level sub-program. It is the keyword PROGRAM, MODULE, SUBROUTINE or FUNCTION.

Please see specifying a symbol for a more detailed description.

Function:

The commands OBFUSCATE and HIDE NAMES instruct fpt to replace some or all names by meaningless alphanumeric strings. The code becomes unreadable and unmaintainable. The command DO NOT OBFUSCATE prevents obfuscation of the specified names. These names remain visible, and it is then possible to link against external libraries or to reference labelled arguments.

If DO NOT OBFUSCATE is specified for a derived type or a Fortran structure, the names of the type components or structure fields are also protected from obfuscation.

Symbol names which contain exotic characters such as '%', ':' or '#' (which are all legal on some systems) must be written as quoted strings. If COMMON block names are written in this way the '/' characters must lie outside the quotation marks. Only one name may be specified in each command when a name is written as a quoted string.

The %DO NOT OBFUSCATE command may be written in the code. It is then introduced by a comment delimiter in column 1 and the character % in column 2. If the command is written in the code, the local scope does NOT affect the interpretation of the symbol specification. Please specify he intended scope wherever this command is written.

Where to Use this Command

Operating system command line Yes
Configuration file, config.fsp Yes
Specification (fsp) files, *.fsp Yes
Interactively, to FPT> prompt Yes
Interactive command files Yes
Embedded in the Fortran code Yes

Default

All names, or all local names may be obfuscated by default.

Example

The original code:

MODULE m1 INTEGER*4 :: i,j,k,i_not_obfuscated_1,i_not_obfuscated_2 CONTAINS SUBROUTINE s_not_obfuscated_1(a,b) !% DO NOT OBFUSCATE s_not_obfuscated_1 CALL s_not_obfuscated_2(a,b) END SUBROUTINE s_not_obfuscated_1 END MODULE m1 PROGRAM t USE m1 USE,INTRINSIC :: iso_c_binding REAL :: c = 1.0, d = 2.0 CALL s_not_obfuscated_1(c,d) WRITE(*,*)d,c_short END PROGRAM t

is obfuscted by the command:

$ fpt t_obfuscate.fsp

where t_obfuscate.fsp contains:

! t_obfuscate.fsp ../original_source/t_obfuscate.f90 % obfuscate all names % DO NOT OBFUSCATE :: i_not_obfuscated_1,i_not_obfuscated_2 % upper case symbols % upper case keywords % fixed format % maximum indentation nesting level: 0 % no column format % overwrite changed files ! End of t_obfuscate.fsp

Note that fixed-format, uppercase code with no indentation is already hard to read. The generated code is shown below:

MODULE A00791 INTEGER*4::I00720,I00732,I00793,I_NOT_OBFUSCATED_1, 1 I_NOT_OBFUSCATED_2 CONTAINS SUBROUTINE S_NOT_OBFUSCATED_1(A00717,A00681) CALL S_NOT_OBFUSCATED_2(A00717,A00681) END SUBROUTINE S_NOT_OBFUSCATED_1 END MODULE A00791 PROGRAM A00798 USE A00791 USE,INTRINSIC::ISO_C_BINDING REAL::A00682=1.0,A00803=2.0 CALL S_NOT_OBFUSCATED_1(A00682,A00803) WRITE (*,*)A00803,C_SHORT END PROGRAM A00798

I_NOT_OBFUSCATED_1, I_NOT_OBFUSCATED_2 and S_NOT_OBFUSCATED_1 are protected by the DO NOT OBFUSCATE commands. The subroutine S_NOT_OBFUSCATED_2 has not been read by fpt and therefore is not obfuscated. The parameter C_SHORT is in the intrinsic module iso_c_binding and therefore is not obfuscated.

See Also

OBFUSCATE

Copyright ©1995 to 2018 Software Validation Ltd. All rights reserved.