home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / fchek284.zip / ftnchek.hlp < prev    next >
Text File  |  1995-06-02  |  48KB  |  991 lines

  1.  
  2. 1 FTNCHEK
  3.        ftnchek - Fortran program checker
  4.  
  5. 2 Introduction
  6.       ftnchek  (short  for Fortran checker) is designed to detect cer-
  7.  tain errors in a Fortran program that a compiler  usually  does  not.
  8.  ftnchek  is not primarily intended to detect syntax errors.  Its pur-
  9.  pose is to assist the user  in  finding  semantic  errors.   Semantic
  10.  errors  are  legal  in  the  Fortran language but are wasteful or may
  11.  cause incorrect operation.  For example, variables  which  are  never
  12.  used  may  indicate some omission in the program; uninitialized vari-
  13.  ables contain garbage which may cause incorrect results to be  calcu-
  14.  lated; and variables which are not declared may not have the intended
  15.  type.  ftnchek is intended to assist users in the debugging of  their
  16.  Fortran  program.   It  is  not  intended to catch all syntax errors.
  17.  This is the function of the compiler.  Prior to  using  ftnchek,  the
  18.  user should verify that the program compiles correctly.
  19.  
  20.  For more detailed information, consult the printed documentation.
  21.  
  22. 2 Invoking_Ftnchek
  23.        ftnchek is invoked through a command of the form:
  24.  
  25.         $ ftnchek [/option /option ...] filename [filename ...]
  26.       The brackets indicate something which is optional.  The brackets
  27.  themselves are not actually typed.   Here  options  are  command-line
  28.  switches  or settings, which control the operation of the program and
  29.  the amount of information that will be printed out.  If no option  is
  30.  specified,  the  default action is to print error messages, warnings,
  31.  and informational messages, but not the  program  listing  or  symbol
  32.  tables.
  33.  
  34.       Each option begins with the '/' character.  (ftnchek also allows
  35.  the '-' character to be used.)
  36.       ftnchek options fall into two categories:  switches,  which  are
  37.  either  true  or  false, and settings, which have a numeric or string
  38.  value.  The name of a switch is prefixed by 'no' to turn it off: e.g.
  39.  /nopure  would turn off the warnings about impure functions. The 'no'
  40.  prefix can also be used with numeric settings, having the  effect  of
  41.  turning  off the corresponding warnings.  Only the first 3 characters
  42.  of an option name (not counting the '/') need be provided.   A  colon
  43.  may  be used in place of an equals sign for option value assignments;
  44.  however, we show only the equals sign form below.
  45.       When more than one option is used, they should be separated by a
  46.  blank  space,  except on systems such as VMS where options begin with
  47.  slash ( / ).  No blank spaces may be placed around the equals sign  (
  48.  =  ) in a setting.  ftnchek "?"  will produce a command summary list-
  49.  ing all options and settings.
  50.  
  51. 2 Files
  52.       When giving a name of an input file, the extension is  optional.
  53.  If  no extension is given, ftnchek will first look for a project file
  54.  with extension .prj, and will use that if it exists.   If  not,  then
  55.  ftnchek  will look for a Fortran source file with the extension .for.
  56.  More than one file name can be given to ftnchek, and it will  process
  57.  the modules in all files as if they were in a single file.
  58.  
  59.       Wildcards  are  allowed in the specification of filenames on the
  60.  command line.
  61.       If no filename is given, ftnchek will read input from the  stan-
  62.  dard input.
  63.  
  64.  
  65. 2 Options
  66.       ftnchek  options  fall  into two categories: switches, which are
  67.  either true or false, and settings, which have a  numeric  or  string
  68.  value.   The  name  of a switch or numeric setting can be preceded by
  69.  'no' to turn it off: e.g. /nousage would turn off the warnings  about
  70.  variable  usage.   Only the first 3 characters of an option name (not
  71.  counting the '/') need be provided.   Most  options  are  positional:
  72.  each  option remains in effect from the point it is encountered until
  73.  it is overridden by a later change.
  74.  
  75.  
  76. 3 /arguments=num
  77.        Controls warnings about mismatches  between  actual  and  dummy
  78.  subprogram  arguments.   (An actual argument is an argument passed to
  79.  the subprogram by  the  caller;  a  dummy  argument  is  an  argument
  80.  received by the subprogram.)
  81.  
  82.      The meanings of the setting values are as follows:
  83.     0: turn off all such warnings.
  84.     1: warn only about different number of arguments.
  85.     2: warn only about mismatch of data type of arguments and of func-
  86.         tion itself.
  87.     3: all warnings.
  88.  
  89.      Default = 3.
  90.  
  91.      This setting is provided mainly to  suppress  warnings  when  you
  92.  wish  to use ftnchek for some other purpose than checking for errors,
  93.  for example when you only want to print the call tree.  It  does  not
  94.  apply  to  checking  invocations  of intrinsic functions or statement
  95.  functions.
  96.  
  97.      See also: /array, /library, /usage.
  98.  
  99.  
  100. 3 /array=num
  101.        Controls the degree of strictness in checking agreement between
  102.  actual  and dummy subprogram arguments that are arrays.  The warnings
  103.  controlled by this setting are for constructions that  might  legiti-
  104.  mately be used by a knowledgeable programmer, but that often indicate
  105.  programming errors.
  106.  
  107.      The meanings of the setting values are as follows:
  108.     0: only warn about cases that are  seldom  intentional  (see  note
  109.         below).
  110.     1:  warn if the arguments differ in their number of dimensions, or
  111.         if the actual argument is an array  element  while  the  dummy
  112.         argument is a whole array.
  113.     2: warn if both arguments are arrays, but they differ in number of
  114.         elements.
  115.     3: give both types of warnings.
  116.  
  117.      Default = 3.
  118.  
  119.      Note: A warning is always given regardless of this setting if the
  120.  actual  argument  is  an  array  while the dummy argument is a scalar
  121.  variable, or if the actual argument is a scalar variable  or  expres-
  122.  sion  while the dummy argument is an array.  No warning is ever given
  123.  if the actual argument is an array element while the  dummy  argument
  124.  is  a scalar variable.  Variable-dimensioned arrays and arrays dimen-
  125.  sioned with 1 or asterisk match any number of array elements.   There
  126.  is  no check of whether multi-dimensional arrays agree in the size of
  127.  each dimension separately.
  128.  
  129.      See also: /arguments, /library, /usage.
  130.  
  131.  
  132. 3 /backslash
  133.        Handle UNIX-style backslash escapes in character strings.   The
  134.  escape  sequence  following the backslash will be evaluated according
  135.  to the ANSI standard for strings in C: up to three digits signify  an
  136.  octal  value, an x signifies the start of a hexadecimal constant, any
  137.  of the letters a b f n r t signify special  control  codes,  and  any
  138.  other  character  (including newline) signifies the character itself.
  139.  When this option is in effect, a non-standard warning will  be  given
  140.  if the /f77 flag is set.  Default = no.
  141.  
  142.      If this option is turned off (the default), the backslash will be
  143.  treated like any other normal character, but a warning  about  porta-
  144.  bility will be generated if the /portability flag is set.  Because of
  145.  the fact that some compilers treat the  backslash  in  a  nonstandard
  146.  way,  it  is  possible  for  standard-conforming  programs to be non-
  147.  portable if they use the backslash character in strings.
  148.  
  149.      Since ftnchek does not do much with the interpreted string, it is
  150.  seldom  necessary to use this option.  It is needed in order to avoid
  151.  spurious warnings only if (a) the program being  checked  uses  back-
  152.  slash  to  embed  an  apostrophe or quote mark in a string instead of
  153.  using the standard mechanism of doubling the delimiter; (b) the back-
  154.  slash is used to escape the end-of-line in order to continue a string
  155.  across multiple source lines; or (c) a PARAMETER definition  uses  an
  156.  intrinsic string function such as LEN with such a string as argument,
  157.  and that value is later used to define array dimensions, etc.
  158.  
  159.  
  160. 3 /calltree
  161.        Causes ftnchek to print out the call structure of the  complete
  162.  program in the form of a tree.  The tree is printed out starting from
  163.  the main program, which is listed on the first line at the left  mar-
  164.  gin.   Then  on  the following lines, each routine called by the main
  165.  program is listed, indented a few spaces,  followed  by  the  subtree
  166.  starting at that routine.  Default = no.
  167.  
  168.      If  a  routine is called by more than one other routine, its call
  169.  subtree is printed only the first  time  it  is  encountered.   Later
  170.  calls give only the routine name and the notice ``(see above)''.
  171.  
  172.      Note  that  the  call tree will be incomplete if any of the input
  173.  files are project files containing more than  one  module  that  were
  174.  created in /library mode.  See the discussion of project files below.
  175.  
  176.      Technical points: Each list of routines called by a given routine
  177.  is  printed  in  alphabetical  order.   If multiple main programs are
  178.  found, the call tree of each is printed separately.  If no main  pro-
  179.  gram  is  found, a report to that effect is printed out, and the call
  180.  trees of any top-level non-library routines are printed.   This  flag
  181.  only  controls  the printing of the call tree: ftnchek constructs the
  182.  call tree in any case because it is used to determine  which  library
  183.  modules  will  be  cross-checked.  See the discussion of the /library
  184.  flag.
  185.  
  186.      See also: /crossref, /library, /reference, /sort, /symtab.
  187.  
  188.  
  189. 3 /columns=num
  190.        Set maximum statement length to num columns.  (Beyond  this  is
  191.  ignored.)   This  setting  is  provided to allow checking of programs
  192.  which may violate the Fortran standard limit of 72  columns  for  the
  193.  length  of  a  statement.   According to the standard, all characters
  194.  past column 72 are ignored.  If this setting is used  when  the  /f77
  195.  option  is  in effect, a warning will be given for any lines in which
  196.  characters past column 72 are processed.  Max is 132.  Default =  72.
  197.  
  198.  
  199. 3 /common=num
  200.         This  setting  varies  the  strictness  of  checking of COMMON
  201.  blocks.
  202.  
  203.      The different levels are:
  204.     0: no checking.
  205.     1: in each declaration of a given COMMON block, corresponding mem-
  206.         ory locations (words or bytes) must agree in data type.
  207.     2:  also  warn if different declarations of the same block are not
  208.         equal in total length.
  209.     3: corresponding variables in each declaration  of  a  block  must
  210.         agree  in  data  type  and  (if  arrays) in size and number of
  211.         dimensions.
  212.  
  213.      Default = 3.
  214.  
  215.      The Fortran 77 Standard requires each named common block, but not
  216.  blank  common,  to  be the same length in all modules of the program.
  217.  Level 3 provides an extra degree of checking to  support  a  frequent
  218.  programming practice.
  219.  
  220.      See also: /library, /usage, /volatile.
  221.  
  222.  
  223. 3 /crossref
  224.         Specifies that a cross-reference table be printed.  This table
  225.  lists each subprogram followed by a list of the  routines  that  call
  226.  it.  Also prints a table listing each COMMON block followed by a list
  227.  of the routines that access it.  Default = no.
  228.  
  229.      The cross-reference listing omits library modules that are not in
  230.  the  call  tree  of the main program.  The list is alphabetized.  The
  231.  routines listed as using a COMMON block are those in which some vari-
  232.  ables  in  the  block  are  accessed,  not simply those routines that
  233.  declare the block.  (To find out what routines declare a COMMON block
  234.  but do not use it, see the /usage flag.)
  235.  
  236.      See also: /calltree, /reference, /sort, /symtab.
  237.  
  238.  
  239. 3 /declare
  240.         If  this  flag  is  set, all identifiers whose datatype is not
  241.  declared in each module will be listed.   This  flag  is  useful  for
  242.  helping  to  find  misspelled  variable names, etc.  The same listing
  243.  will be given if the module  contains  an  IMPLICIT  NONE  statement.
  244.  Default = no.
  245.  
  246.      See also: /sixchar, /usage.
  247.  
  248.  
  249. 3 /division
  250.         This  switch is provided to help users spot potential division
  251.  by zero problems.  If this switch is selected, every division  except
  252.  by  a  constant  will  be  flagged.   (It is assumed that the user is
  253.  intelligent enough not to divide by a  constant  which  is  equal  to
  254.  zero!)  Default = no.
  255.  
  256.      See also: /portability, /truncation.
  257.  
  258.  
  259. 3 /extern
  260.        Causes ftnchek to report whether any subprograms invoked by the
  261.  program are never defined, or are multiply defined.   Ordinarily,  if
  262.  ftnchek  is  being  run  on a complete program, each subprogram other
  263.  than the intrinsic functions should be defined  once  and  only  once
  264.  somewhere.   Turn  off this switch if you just want to check a subset
  265.  of files which form part of a larger complete program,  or  to  check
  266.  all  at  once a number of unrelated files which might each contain an
  267.  unnamed main program.  Subprogram arguments will still be checked for
  268.  correctness.  Default = yes.
  269.  
  270.      See also: /library.
  271.  
  272.  
  273. 3 /f77
  274.         Use  this  flag to catch language extensions which violate the
  275.  Fortran 77 Standard.  Such extensions may cause your program  not  to
  276.  be  portable.   Examples  include  the use of underscores in variable
  277.  names; variable names longer than  six  characters;  statement  lines
  278.  longer  than 72 characters; and nonstandard statements such as the DO
  279.  ... ENDDO structure.  ftnchek does not report on the use of lowercase
  280.  letters.  Default = no.
  281.  
  282.      See also: /portability, /pretty, /wordsize.
  283.  
  284.  
  285. 3 /help
  286.         Prints  a  list  of  all the command-line options with a short
  287.  description of each along with its default value.   This  command  is
  288.  identical  in  function  to the ``?''  argument, and is provided as a
  289.  convenience for those systems in which the question mark has  special
  290.  meaning to the command interpreter.  Default = no.
  291.  
  292.      The  help  listing also prints the version number and patch level
  293.  of ftnchek and a copyright notice.
  294.  
  295.      Note: the ``default'' values printed in square  brackets  in  the
  296.  help  listing  are,  strictly speaking, not the built-in defaults but
  297.  the current values after any environment options and any command-line
  298.  options preceding the /help option have been processed.
  299.  
  300.  
  301. 3 /hollerith
  302.         Hollerith  constants (other than within FORMAT specifications)
  303.  are a source of possible portability problems, so when the /portabil-
  304.  ity  flag is set, warnings about them will be produced.  If your pro-
  305.  gram uses many Hollerith constants, these warnings can obscure  other
  306.  more  serious  warnings.   So you can set this flag to ``no'' to sup-
  307.  press the warnings about Holleriths.  This flag has no effect  unless
  308.  the  /portability  flag  (which  is  off  by  default)  is turned on.
  309.  Default = yes.
  310.  
  311.      See also: /portability.
  312.  
  313.  
  314. 3 /include=path
  315.        Specifies a directory to be searched  for  files  specified  by
  316.  INCLUDE  statements.  Unlike other command-line options, this setting
  317.  is cumulative; that is, if it is given more than once on the  command
  318.  line, all the directories so specified are placed on a list that will
  319.  be searched in the same order as they are given.  The order in  which
  320.  ftnchek searches for a file to be included is: the current directory;
  321.  the directory specified by environment  variable  FTNCHEK_INCLUDE  if
  322.  any; the directories specified by any /include options; the directory
  323.  specified by environment variable INCLUDE; and finally in a  standard
  324.  systemwide directory (/usr/include for UNIX, SYS$LIBRARY for VMS, and
  325.  \include for MSDOS).
  326.  
  327.  
  328. 3 /library
  329.        This switch is used when a number of subprograms are  contained
  330.  in  a  file,  but  not  all  of  them  are  used  by the application.
  331.  Normally, ftnchek warns you if any subprograms are defined but  never
  332.  used.  This switch will suppress these warnings.  Default = no.
  333.  
  334.      This switch also controls which subprogram calls and COMMON block
  335.  declarations are checked.  If a file is read with the  /library  flag
  336.  in  effect, the subprogram calls and COMMON declarations contained in
  337.  a routine in that file will be checked only if that routine is in the
  338.  main  program's call tree.  On the other hand, if the /library switch
  339.  is turned off, then ftnchek checks the  calls  of  every  routine  by
  340.  every  other routine, regardless of whether those routines could ever
  341.  actually be invoked at run time, and likewise all COMMON block decla-
  342.  rations are compared for agreement.
  343.  
  344.      (If  there  is  no main program anywhere in the set of files that
  345.  ftnchek has read, so that there is no call tree,  then  ftnchek  will
  346.  look  for  any  non-library routines that are not called by any other
  347.  routine, and use these as substitutes for the main  program  in  con-
  348.  structing  the call tree and deciding what to check.  If no such top-
  349.  level non-library routines are found, then all inter-module calls and
  350.  all COMMON declarations will be checked.)
  351.  
  352.      See also: /arguments, /calltree, /common, /extern.
  353.  
  354.  
  355. 3 /list
  356.         Specifies  that  a  listing  of  the  Fortran program is to be
  357.  printed out with line numbers.  If  ftnchek  detects  an  error,  the
  358.  error  message follows the program line with a caret ( ^ ) specifying
  359.  the location of the error.   If  no  source  listing  was  requested,
  360.  ftnchek will still print out any line containing an error, to aid the
  361.  user in determining where the error occurred.  Default = no.
  362.  
  363.      See also: /symtab, /verbose.
  364.  
  365.  
  366. 3 /makedcls=num
  367.        Prepare a neatly-formatted file of declarations  of  variables,
  368.  common  blocks,  and  namelist  lists,  for possible merging into the
  369.  source code.  The declarations are stored in a file of the same  name
  370.  as  the  source  code, but with the extension changed to .dcl.  If no
  371.  declarations are written to the file, it is deleted to reduce clutter
  372.  from empty files.
  373.  
  374.      If input comes from standard input, instead of a named file, then
  375.  declarations are written to standard output.
  376.  
  377.      Variables are declared in alphabetical order within each declara-
  378.  tion  class  and type, with integer variables first, because of their
  379.  later possible use in array dimensions.
  380.  
  381.      PARAMETER statements are an exception to the  alphabetical  order
  382.  rule,  because  the Fortran 77 Standard requires that the expressions
  383.  defining parameter values refer only to constants and already-defined
  384.  parameter  names.  This forces the original source file order of such
  385.  statements to be preserved in the declaration files.
  386.  
  387.      Explicit declaration of all variables is considered  good  modern
  388.  programming practice.  By using compiler options to reject undeclared
  389.  variables, misspelled variable names (or names extending past  column
  390.  72)  can  be  caught  at  compile  time.   Explicit declarations also
  391.  greatly facilitate changing  floating-point  precision  with  filters
  392.  such   as  dtoq(1L),  dtos(1L),  fd2s(1L),  fs2d(1L),  qtod(1L),  and
  393.  stod(1L).  These programs are capable of changing types  of  explicit
  394.  floating-point type declarations, intrinsic functions, and constants,
  395.  but because they do not carry out rigorous  lexical  and  grammatical
  396.  analysis  of  the  Fortran  source code, they cannot provide modified
  397.  type declarations for undeclared variables.
  398.  
  399.      The setting values are given by the sum of selected option values
  400.  from the following list:
  401.     0: Do not write a declaration file.
  402.     1: Write a declaration file.
  403.     2:  Normally,  all variables are included in the declaration file.
  404.         With this option, include  only  undeclared  variables.   This
  405.         setting  is  useful  if you want to check for undeclared vari-
  406.         ables, since Fortran source files with all variables  properly
  407.         declared  will  not  result in a .dcl file.  With this option,
  408.         common blocks and namelist lists will not be included  in  the
  409.         declaration  file,  since by their nature they cannot be unde-
  410.         clared.
  411.     4: The declarations are normally prettyprinted to line  up  neatly
  412.         in  common  columns, as in the declaration files output by the
  413.         Extended PFORT Verifier, pfort(1L).  This option value selects
  414.         instead compact output, without column alignment.
  415.     8:  Causes  continuation  lines to be used where permissible.  The
  416.         default is to begin a new  declaration  on  each  line.   This
  417.         option  is appropriate to use with the option for compact out-
  418.         put.
  419.     16: Output Fortran keywords in lowercase, instead of  the  default
  420.         uppercase.
  421.     32:  Output  variables  and constants in lowercase, instead of the
  422.         default  uppercase.    Character  string  constants  are   not
  423.         affected by this option.
  424.     64:  Omit  declarations  of internal integer variables produced by
  425.         the SFTRAN3 preprocessor, xsf3(1L), as part of the translation
  426.         of  structured  Fortran statements to ordinary Fortran.  These
  427.         variables have six-character names of the form NPRddd, NXdddd,
  428.         N2dddd,  and N3dddd, where d is a decimal digit.  Because they
  429.         are invisible in the SFTRAN3 source code, and will  change  if
  430.         the  SFTRAN3  code  is  modified, such variables should not be
  431.         explicitly declared.  Instead, they  should  just  assume  the
  432.         default  Fortran INTEGER data type based on their initial let-
  433.         ter, N.
  434.     128: Use an asterisk as the comment character; the default is oth-
  435.         erwise 'C'.
  436.     256: Use 'c' instead of 'C' or '*' as the comment character.
  437.  
  438.      If  any  non-zero  value is specified, then declaration output is
  439.  selected, even if the value 1 was not included in the sum.
  440.  
  441.      The declaration files contain distinctive comments that mark  the
  442.  start  and  end  of declarations for each program unit, to facilitate
  443.  using text editor macros for merging the declarations back  into  the
  444.  source code.
  445.  
  446.  
  447. 3 /novice
  448.        This flag is intended to provide more helpful output for begin-
  449.  ners.  It has two effects:
  450.     (a) provides an extra message to the effect that a  function  that
  451.         is  used  but not defined anywhere might be an array which the
  452.         user forgot to declare in a  DIMENSION  statement  (since  the
  453.         syntax of an array reference is the same as that of a function
  454.         reference).
  455.     (b) modifies the form of the error messages and warnings.  If  the
  456.         flag is turned off by /nonovice, these messages are printed in
  457.         a style more resembling UNIX lint.
  458.  
  459.      Default = yes.
  460.  
  461.      In versions of ftnchek prior to 2.6, this option  could  take  on
  462.  various  numerical values, as a way of controlling various classes of
  463.  warnings.  These warnings are now controlled  individually  by  their
  464.  own flags.  Novice level 1 is now handled by the /array flag; level 2
  465.  has been eliminated; level 3 is equivalent now to setting /novice  to
  466.  yes; level 4 is handled by the /pure flag.
  467.  
  468.  
  469. 3 /output=filename
  470.         This  setting  is provided for convenience on systems which do
  471.  not allow easy redirection of output from programs.  When  this  set-
  472.  ting  is  given, the output which normally appears on the screen will
  473.  be sent instead to the named file.  Note, however,  that  operational
  474.  errors of ftnchek itself (e.g. out of space or cannot open file) will
  475.  still be sent to the screen.   The  extension  for  the  filename  is
  476.  optional,  and  if  no extension is given, the extension .lis will be
  477.  used.
  478.  
  479.  
  480. 3 /portability
  481.        ftnchek will  give  warnings  for  a  variety  of  non-portable
  482.  usages.   Examples  include  the  use  of  tabs except in comments or
  483.  inside strings, the use of Hollerith constants, and the equivalencing
  484.  of  variables  of different data types.  This option does not produce
  485.  warnings for supported extensions to the Fortran 77  Standard,  which
  486.  may  also  cause  portability problems.  To catch those, use the /f77
  487.  option.  Default = no.
  488.  
  489.      See also: /backslash, /f77, /hollerith, /pretty, /wordsize.
  490.  
  491.  
  492. 3 /pretty
  493.        Controls certain messages related  to  the  appearance  of  the
  494.  source  code.  These warn about things that might be deceptive to the
  495.  reader.  Default = yes.
  496.  
  497.      The warnings controlled by this flag include such things as  com-
  498.  ments  that are interspersed among the continuation lines of a state-
  499.  ment, lack of space between a keyword and a following variable  name,
  500.  and statement lines containing characters past column 72.
  501.  
  502.      See also: /f77, /portability.
  503.  
  504.  
  505. 3 /project
  506.         ftnchek  will create a project file from each source file that
  507.  is input while this flag is in effect.   The  project  file  will  be
  508.  given  the  same name as the input file, but with the extension .f or
  509.  .for replaced by .prj.  (If input is from standard input, the project
  510.  file is named ftnchek.prj.)  Default = no.
  511.  
  512.      A  project file contains a summary of information from the source
  513.  file, for use in checking agreement among FUNCTION,  SUBROUTINE,  and
  514.  COMMON  usages in other files.  It allows incremental checking, which
  515.  saves time whenever you have a large set of files  containing  shared
  516.  subroutines,  most  of which seldom change.  You can run ftnchek once
  517.  on each file with the /project flag set, creating the project  files.
  518.  Usually  you  would also set the /library and /noextern flags at this
  519.  time, to suppress messages relating to consistency with other  files.
  520.  Only error messages pertaining to each file by itself will be printed
  521.  at this time.  Thereafter, run ftnchek without these flags on all the
  522.  project  files  together,  to  check  consistency among the different
  523.  files.  All messages internal to the individual  files  will  now  be
  524.  omitted.  Only when a file is altered will a new project file need to
  525.  be made for it.
  526.  
  527.      Naturally, when the /project flag is set, ftnchek will  not  read
  528.  project files as input.
  529.  
  530.      Project files contain only information needed for checking agree-
  531.  ment between files.  This means that a project file is of no  use  if
  532.  all modules of the complete program are contained in a single file.
  533.  
  534.      A  more detailed discussion is given in the section on Using Pro-
  535.  ject Files.
  536.  
  537.  
  538. 3 /pure
  539.        Assume functions are ``pure'', i.e., they will  not  have  side
  540.  effects  by modifying their arguments or variables in a COMMON block.
  541.  When this flag is in effect, ftnchek will base its  determination  of
  542.  set  and  used  status of the actual arguments on the assumption that
  543.  arguments passed to a function are not altered.  It will also issue a
  544.  warning  if a function is found to modify any of its arguments or any
  545.  COMMON variables.  Default = yes.
  546.  
  547.      When this flag is turned off, actual arguments  passed  to  func-
  548.  tions will be handled the same way as actual arguments passed to sub-
  549.  routines.  This means that ftnchek will assume that arguments may  be
  550.  modified  by  the functions.  No warnings will be given if a function
  551.  is found to have side effects.  Because stricter checking is possible
  552.  if  functions  are  assumed to be pure, you should turn this flag off
  553.  only if your program actually uses functions with side effects.
  554.  
  555.  
  556. 3 /reference
  557.        Specifies that a who-calls-who table be  printed.   This  table
  558.  lists  each  subprogram  followed by a list of the routines it calls.
  559.  Default = no.
  560.  
  561.      The reference list omits routines called by unused  library  mod-
  562.  ules.   Thus  it  contains  the same information as for the /calltree
  563.  flag, namely the hierarchy of subprogram calls, but printed in a dif-
  564.  ferent format.  This prints out a breadth-first traversal of the call
  565.  tree whereas /calltree prints out a depth-first traversal.   If  both
  566.  /calltree  and /reference flags are given, only the reference form of
  567.  the table will be produced.
  568.  
  569.      See also: /calltree, /crossref, /library, /sort, /symtab.
  570.  
  571.  
  572. 3 /resource
  573.        Prints the amount of resources used by  ftnchek  in  processing
  574.  the  program.   This  listing may be useful in analyzing the size and
  575.  complexity of a program.  It can also help in choosing  larger  sizes
  576.  for ftnchek's internal tables if they are too small to analyze a par-
  577.  ticular program.  Default = no.
  578.  
  579.      In this listing, the term ``chunk  size''  is  the  size  of  the
  580.  blocks of memory allocated to store the item in question, in units of
  581.  the size of one item, not necessarily in bytes.  When  the  initially
  582.  allocated  space  is filled up, more memory is allocated in chunks of
  583.  this size.  The following is an explanation of the items printed:
  584.     Source lines processed: Total number of lines of code, with  sepa-
  585.         rate  totals  for  statement lines and comment lines.  Comment
  586.         lines include lines with 'C' or '*' in column  1  as  well  as
  587.         blank  lines  and  lines  containing  only  an inline comment.
  588.         Statement lines are all other lines, including lines that have
  589.         an inline comment following some code.  Continuation lines are
  590.         counted as separate lines.  Lines in include files are counted
  591.         each time the file is included.
  592.     Total  executable statements: Number of statements in the program,
  593.         other than specification,  data,  statement-function,  FORMAT,
  594.         ENTRY, and END statements.
  595.     Total  number  of  modules:  A  module is any external subprogram,
  596.         including the main program, subroutines, functions, and  block
  597.         data  units.   This  count  is  of  modules defined within the
  598.         source, not modules referenced.  Statement functions  are  not
  599.         included.   A  subprogram  with  multiple entry points is only
  600.         counted once.
  601.     Max identifier name chars: Number of characters used  for  storing
  602.         identifier names.  An identifier is a variable, subprogram, or
  603.         common block name.  Local names are those of  local  variables
  604.         in  a subprogram, whereas global names refer to subprogram and
  605.         common block names, as well as dummy argument names and common
  606.         variable names.  Actual argument text (up to 15 characters for
  607.         each argument) is also included  here.   The  space  used  for
  608.         local  names  is  recovered at the end of each module, whereas
  609.         the global space grows until the whole  program  is  analyzed.
  610.         Unfortunately, this figure may include some common block names
  611.         and arguments stored more than once, although a  heuristic  is
  612.         used that will avoid duplicates in many cases.
  613.     Max  token  text  chars: A token is the smallest syntactic unit of
  614.         the FORTRAN language above the level of individual characters.
  615.         For  instance a token can be a variable name, a numerical con-
  616.         stant, a quoted  text  string,  or  a  punctuation  character.
  617.         Token  text  is stored while a module is being processed.  For
  618.         technical reasons, single-character tokens are not included in
  619.         this  total.   Items  that  are  not represented in the symbol
  620.         table may be duplicated.  The space for token text  is  recov-
  621.         ered  at the end of each module, so this figure represents the
  622.         maximum for any one module.
  623.     Max local symbols: This is the largest number of  entries  in  the
  624.         local symbol table for any module.  Local symbol table entries
  625.         include all variables  and  parameters,  common  block  names,
  626.         statement  functions, external subprograms and intrinsic func-
  627.         tions referenced by the module.   Literal  constants  are  not
  628.         stored in the local symbol table.
  629.     Max  global  symbols:  This is the number of entries in the global
  630.         symbol table at the end of processing.   Global  symbol  table
  631.         entries  include  external  subprogram and common block names.
  632.         Intrinsic functions and statement functions are not  included.
  633.     Max  number  of  tokenlists:  A token list is a sequence of tokens
  634.         representing the actual or dummy argument list  of  a  subpro-
  635.         gram,  or the list of variables in a common block or namelist.
  636.         Therefore this number represents the largest  sum  of  COMMON,
  637.         CALL,  NAMELIST  and ENTRY statements and function invocations
  638.         for any one module.  The space is recovered at the end of each
  639.         module.
  640.     Max token list/tree space: This is the largest number of tokens in
  641.         all the token lists and token trees  of  any  one  module.   A
  642.         token  tree  is  formed  when  analyzing  an  expression: each
  643.         operand is a leaf of the  tree,  and  the  operators  are  the
  644.         nodes.  Therefore this number is a measure of the maximum com-
  645.         plexity of an individual module.  For instance a  module  with
  646.         many  long  arithmetic  expressions  will  have a high number.
  647.         Note that unlike token text described  above,  the  number  of
  648.         tokens  is  independent of the length of the variable names or
  649.         literal constants in the expressions.
  650.     Number of subprogram invocations: This is the sum over all modules
  651.         of  the  number  of  CALL  statements and function invocations
  652.         (except intrinsic functions and statement functions).
  653.     Number of common block decls: This is the sum over all modules  of
  654.         the number of common block declarations.  That is, each decla-
  655.         ration of a block in a different module is counted separately.
  656.         (The  standard  allows multiple declarations of a block within
  657.         the same module; these are counted  as  only  one  declaration
  658.         since they are equivalent to a single long declaration.)
  659.     Number of array dim & param ptrs: This is the sum over all modules
  660.         of the number of array dimension and parameter definition text
  661.         strings  saved for use by the /makedcls option.  The length of
  662.         the text strings is not counted.  Each dimension of a multidi-
  663.         mensional array is counted separately.
  664.  
  665.      These  numbers  are obviously not the same when project files are
  666.  used in place of the original source  code.   Even  the  numbers  for
  667.  global entities may be different, since some redundant information is
  668.  eliminated in project files.
  669.  
  670.  
  671. 3 /sixchar
  672.        One of the goals of the ftnchek program is  to  help  users  to
  673.  write  portable  Fortran programs.  One potential source of nonporta-
  674.  bility is the use of variable names that are longer than six  charac-
  675.  ters.   Some compilers just ignore the extra characters.  This behav-
  676.  ior could potentially lead to two different variables  being  consid-
  677.  ered  as  the  same.   For  instance, variables named AVERAGECOST and
  678.  AVERAGEPRICE are the same in the first six characters.  If  you  wish
  679.  to catch such possible conflicts, use this flag.  Default = no.
  680.  
  681.      Use  the  /f77 flag if you want to list all variables longer than
  682.  six characters, not just those pairs that are the same in  the  first
  683.  six.
  684.  
  685.      See also: /f77, /portability.
  686.  
  687.  
  688. 3 /sort
  689.        Specifies that a sorted list of all modules used in the program
  690.  be printed.  This list is in ``prerequisite'' order, i.e. each module
  691.  is  printed  only  after all the modules from which it is called have
  692.  been printed.  This is also called a ``topological sort'' of the call
  693.  tree.  Each module is listed only once.  Routines that are not in the
  694.  call tree of the main program are omitted.  If there are  any  cycles
  695.  in the call graph (illegal in standard Fortran) they will be detected
  696.  and diagnosed.  Default = no.
  697.  
  698.      See also: /calltree, /crossref, /reference, /symtab.
  699.  
  700.  
  701. 3 /symtab
  702.        A symbol table will be printed out for each module, listing all
  703.  identifiers  mentioned  in  the module.  This table gives the name of
  704.  each variable, its datatype, and the number of dimensions for arrays.
  705.  An  asterisk  (*)  indicates  that  the  variable has been implicitly
  706.  typed, rather than being named in an explicit type declaration state-
  707.  ment.   The  table  also lists all subprograms invoked by the module,
  708.  all COMMON blocks declared, etc.  Default = no.
  709.  
  710.      See also: /calltree, /crossref, /list, /reference, /sort.
  711.  
  712.  
  713. 3 /tab
  714.        Accept DEC-style tab-formatted source.  A line  beginning  with
  715.  an  initial  tab  will  be treated as a new statement line unless the
  716.  character after the tab is a nonzero  digit,  in  which  case  it  is
  717.  treated  as  a  continuation  line.  The next column after the tab or
  718.  continuation mark is taken as column 7.  A warning will be  given  in
  719.  the  case  where  the  line  is a continuation, if /f77 is in effect.
  720.  Default = no.
  721.  
  722.  
  723. 3 /truncation
  724.        Warn about possible truncation (or roundoff) errors.   Most  of
  725.  these  are  related to integer arithmetic.  The warnings enabled when
  726.  this flag is in effect are:
  727.     (a) use of the result of integer  division  where  a  real  result
  728.         seems  intended  (namely as an exponent, or if the quotient is
  729.         later converted to real);
  730.     (b) division in an  integer  constant  expression  that  yields  a
  731.         result of zero;
  732.     (c)  exponentiation  of  an  integer  by a negative integer (which
  733.         yields zero unless the base integer is 1 in magnitude);
  734.     (d) use of a non-integer array subscript or DO index;
  735.     (e) conversion of any real type to integer,  or  conversion  of  a
  736.         complex value to real or integer;
  737.     (f) conversion of a double precision value to single precision, or
  738.         vice-versa (promotion).  This applies both to real  types  and
  739.         to complex types.
  740.  
  741.      Default = yes.
  742.  
  743.      Note:  warnings  about truncating type conversions are given only
  744.  when the conversion is done automatically,  e.g.   by  an  assignment
  745.  statement.   If  intrinsic  functions such as INT are used to perform
  746.  the conversion, no warning is given.  Promotions of real  types  from
  747.  single to double precision are included here because such conversions
  748.  imply a possible loss of accuracy that is similar to the  correspond-
  749.  ing demotions.
  750.  
  751.      See also: /portability, /wordsize.
  752.  
  753.  
  754. 3 /usage=num
  755.         Warn  about  unused  or  possible  uninitialized variables and
  756.  unused common blocks.
  757.  
  758.      The meanings of the setting values are as follows:
  759.     0: no warnings.
  760.     1: warn if variables are (or may be) used before they are set.
  761.     2: warn if variables are declared or set but never used.
  762.     3: give both types of warnings.
  763.  
  764.      Default = 3.
  765.  
  766.      Sometimes ftnchek makes a mistake about these warnings.   Usually
  767.  it  errs on the side of giving a warning where no problem exists, but
  768.  in rare cases it may fail to warn where the problem does exist.   See
  769.  the section on Bugs for examples.  If variables are equivalenced, the
  770.  rule used by ftnchek is that a reference to any variable implies  the
  771.  same  reference  to all variables it is equivalenced to.  For arrays,
  772.  the rule is that a reference to any array element  is  treated  as  a
  773.  reference to all elements of the array.
  774.  
  775.      This  setting  controls warnings not only for local variables but
  776.  also for variables in COMMON blocks.  Level 2 also controls whether a
  777.  warning  is given when an entire COMMON block is unused.  When check-
  778.  ing for used-before-set errors involving  COMMON  variables,  ftnchek
  779.  does  not  do  a  thorough enough analysis of the calling sequence to
  780.  know which routines are called before others.  So warnings about this
  781.  type  of  error  will  only be given for cases in which a variable is
  782.  used in some routine but not set in any other routine.   Checking  of
  783.  individual  COMMON variables is done only if the /common setting is 3
  784.  (variable by variable agreement).
  785.  
  786.      See also: /common, /declare, /volatile.
  787.  
  788.  
  789. 3 /verbose
  790.        This option is on by  default.   Turning  it  off  reduces  the
  791.  amount of output relating to normal operation, so that error messages
  792.  are more apparent.  This option is provided for  the  convenience  of
  793.  users  who are checking large suites of files.  The eliminated output
  794.  includes the names of project files, and the message  reporting  that
  795.  no  syntax errors were found.  (Some of this output is turned back on
  796.  by the /list and /symtab options.)  Default = yes.
  797.  
  798.  
  799. 3 /volatile
  800.        Assume that COMMON blocks are volatile.  Default = no.
  801.  
  802.      Many Fortran programmers assume that variables, whether local  or
  803.  in  COMMON,  are static, i.e. that once assigned a value, they retain
  804.  that value permanently until assigned a different value by  the  pro-
  805.  gram.  However, in fact the Fortran 77 Standard does not require this
  806.  to be the case.  Local variables may become undefined between activa-
  807.  tions  of  a  module  in  which they are declared.  Similarly, COMMON
  808.  blocks may become undefined if no module in which they  are  declared
  809.  is  active.   (The technical term for this behavior is ``automatic'',
  810.  but ftnchek uses the word ``volatile'' since it  is  clearer  to  the
  811.  nonspecialist.)   Only COMMON blocks declared in a SAVE statement, or
  812.  declared in the main program or in a  block  data  subprogram  remain
  813.  defined  as  long  as  the  program is running.  Variables and COMMON
  814.  blocks that can become undefined at some point are called volatile.
  815.  
  816.      If the /volatile flag is turned on, ftnchek will warn you  if  it
  817.  finds a volatile COMMON block.  If, at the same time, the /usage set-
  818.  ting is 1 or 3 (check used before set), ftnchek  will  try  to  check
  819.  whether  such a block can lose its defined status between activations
  820.  of the modules where it is declared.  ftnchek does not do a very good
  821.  job of this: the rule used is to see whether the block is declared in
  822.  two separated subtrees of the call tree.  For instance, this would be
  823.  the  case if two modules, both called from the main program, shared a
  824.  volatile COMMON block.  A block can also become undefined between two
  825.  successive  calls  of  the  same subprogram, but ftnchek is not smart
  826.  enough to tell whether a subprogram can be called more than once,  so
  827.  this case is not checked for.
  828.  
  829.      The  /volatile  flag  does  not affect the way ftnchek checks the
  830.  usage of local variables.
  831.  
  832.      See also: /common, /usage.
  833.  
  834.  
  835. 3 /wordsize=num
  836.        Specifies the default word size to be num bytes.  This  is  the
  837.  size  of  logical and single-precision numeric variables that are not
  838.  given explicit precisions.  Double-precision  and  complex  variables
  839.  will  be  twice  this value, and double complex variables four times.
  840.  Explicit precisions for non-character variables are an  extension  to
  841.  the  Fortran  77 Standard, and are given by type declarations such as
  842.  REAL*8 X.  Default = 4 bytes.
  843.  
  844.      If you want to change the built-in default value of this setting,
  845.  compile  ftnchek  with the macro name BpW (Bytes per Word) set to the
  846.  desired default value.  This is not critical:  the  word  size  value
  847.  does not matter for checking standard-conforming programs that do not
  848.  declare explicit precisions for non-character variables or store Hol-
  849.  lerith  data  in  variables.   This  setting also does not affect the
  850.  default size of character variables, which is always  1  byte.   Hol-
  851.  lerith constants also are assumed to occupy 1 byte per character.
  852.  
  853.      The  word  size is used to determine whether truncation occurs in
  854.  assignment statements, and to catch precision mismatches  in  subpro-
  855.  gram  argument lists and common block lists.  The exact warnings that
  856.  are issued will depend on the status of other flags.  Under both  the
  857.  /portability  or  /nowordsize  flags,  any  mixing  of  explicit with
  858.  default precision objects (character  expressions  not  included)  is
  859.  warned about.  This applies to arithmetic expressions containing both
  860.  types of objects, and to subprogram arguments and  COMMON  variables.
  861.  Under  the  /truncation flag, a warning is given for assignment of an
  862.  expression to a shorter variable of the same type, or  for  promotion
  863.  of  a  lower  precision  value  to  higher precision in an arithmetic
  864.  expression or an assignment statement.
  865.  
  866.      Giving a word size of 0, or equivalently, using /nowordsize means
  867.  that  no  default value will be assumed.  Use this instead of /porta-
  868.  bility if you want to check only for  those  aspects  of  portability
  869.  related to mixing default and explicit precision, for example to flag
  870.  places where REAL*8 is treated as equivalent to DOUBLE PRECISION.
  871.  
  872.      See also: /portability, /truncation.
  873.  
  874.  
  875. 3 /wrap=col
  876.        Controls the wrapping of error messages.  Long  error  messages
  877.  that would run past the specified column will be broken up into sepa-
  878.  rate lines between the words of the message for  better  readability.
  879.  If  turned  off  with  /nowrap,  each  separate error message will be
  880.  printed on one line, leaving it up to the display to wrap the message
  881.  or truncate it.  Default = 79.
  882.  
  883.  
  884. 2 Changing_the_defaults
  885.        ftnchek includes a mechanism for changing the default values of
  886.  all options by defining environment variables.  When  ftnchek  starts
  887.  up,  it  looks  in  its environment for any variables whose names are
  888.  composed by prefixing the string FTNCHEK_ onto the uppercased version
  889.  of  the  option name.  If such a variable is found, its value is used
  890.  to specify the default for the corresponding switch or  setting.   In
  891.  the  case  of  settings (for example, the /common strictness setting)
  892.  the value of the environment variable is read as the default  setting
  893.  value.   In the case of switches, the default switch will be taken as
  894.  true or yes unless the environment variable has the value  0  or  NO.
  895.  Of course, command-line options will override these defaults the same
  896.  way as they override the built-in defaults.
  897.       Note that the environment variable name must be constructed with
  898.  the  full-length  option name, which must be in uppercase.  For exam-
  899.  ple, to make ftnchek print a source listing by default, set the envi-
  900.  ronment variable FTNCHEK_LIST to 1 or YES or anything other than 0 or
  901.  NO.  The names FTNCHEK_LIS (not the full option name) or ftnchek_list
  902.  (lower case) would not be recognized.
  903.  
  904.  The  way to set the environment variables on the VAX/VMS system is by
  905.  using the DEFINE command.  For example,  to  set  the  default  /list
  906.  switch to YES, give the command
  907.  
  908.           $ DEFINE FTNCHEK_LIST 1
  909.  
  910.  
  911. 2 Project_files
  912.         This  section contains detailed information on how to use pro-
  913.  ject files most effectively, and how to avoid some pitfalls.
  914.       Ordinarily, project files should be created  with  the  /library
  915.  flag  in  effect.  In this mode, the information saved in the project
  916.  file consists of all subprogram declarations, all subprogram  invoca-
  917.  tions not resolved by declarations in the same file, and one instance
  918.  of each COMMON block declaration.  This  is  the  minimum  amount  of
  919.  information needed to check agreement between files.
  920.       If  the file contains more than one routine, there are some pos-
  921.  sible problems that can arise  from  creating  the  project  file  in
  922.  library  mode,  because  the calling hierarchy among routines defined
  923.  within the file is lost.  Also, if the routines in the file make  use
  924.  of  COMMON blocks that are shared with routines in other files, there
  925.  will not be enough information saved for the correct checking of  set
  926.  and  used  status  of COMMON blocks and COMMON variables according to
  927.  the /usage setting.  Therefore if you plan to use project files  when
  928.  the  /usage  setting is nonzero (which is the default situation), and
  929.  if multiple routines in one project file  share  COMMON  blocks  with
  930.  routines in other files, the project files should be created with the
  931.  /library flag turned off.  In this mode, ftnchek saves,  besides  the
  932.  information  listed  above,  one invocation of each subprogram by any
  933.  other subprogram in the same file, and all COMMON block declarations.
  934.  This  means  that the project file will be larger than necessary, and
  935.  that when it is read in, ftnchek may repeat some inter-module  checks
  936.  that  it already did when the project file was created.  If each pro-
  937.  ject file contains only one module, there is no loss  of  information
  938.  in creating the project files in library mode.
  939.       Because of the possible loss of information entailed by creating
  940.  a project file with the /library flag in effect, whenever  that  pro-
  941.  ject  file  is  read  in  later, it will be treated as a library file
  942.  regardless of the current setting of the /library flag.  On the other
  943.  hand, a project file created with library mode turned off can be read
  944.  in later in either mode.
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.