home *** CD-ROM | disk | FTP | other *** search
- From: julian@cernvax.UUCP (julian bunn)
- Newsgroups: comp.lang.fortran,alt.sources
- Subject: Floppy - Fortran Coding Convention Checker
- Message-ID: <1867@cernvax.UUCP>
- Date: 14 May 90 14:46:12 GMT
-
- Thanks to all the people who enthusiastically showed their
- interest in Floppy! The consensus seemed to be that Floppy
- should be posted to "comp.sources.misc". It is a rather
- large posting of 11 parts. In this mail I describe how to
- get Floppy up and running on Unix, VMS and CMS systems.
- The mail is included as "README" in the posting suite.
- I am assuming that the moderator of comp.sources.misc allows
- Floppy through.
-
- To date, Floppy has been installed and tested on ULTRIX,
- Sun OS, VMS and CMS operating systems. Please mail me if
- you find bugs. Although I cannot guarantee to post fixes
- I will attempt to if time permits.
-
- Instructions for Installing Floppy
- ----------------------------------
-
- Floppy is a Fortran Coding Convention Checker and Fortran
- code tidier. Floppy understands standard Fortran 77 code.
- The user may specify any combination of a total of 44
- different coding conventions. These are described fully
- in the Floppy guide, which comes as a PostScript file in
- the posting. (I also include the list of checks at the
- end of this article, those marked with an asterisk
- correspond to what we consider to be a "standard" set.)
- Users may tidy their code by renumbering all
- statement labels, renumbering all FORMAT statements,
- indenting DO and IF clauses, right-adjusting GOTOs and
- by moving all FORMAT statements to the end of each program
- module. Any combination of these tidy options is possible.
-
- Floppy was initially written for VMS systems. The posting
- includes routines and execs that allow Floppy to be built
- for VM/CMS, VAX/VMS and Unix systems. The procedure for
- each system is described briefly below.
-
- Floppy was written by Julian Bunn and Hans Grote at CERN, the
- European Centre for Particle Physics in Geneva, Switzerland.
-
- First Steps
- -----------
-
- Each part of the posting should be saved into a
- directory called "floppy". The mail headers should be
- removed from each part and then each part
- should be executed as a script (Floppy was packed using
- the Packmail utility on a VMS Ultrix system).
-
- There is a document in PostScript form, called "floppy.ps",
- which describes in detail how Floppy works and is used on
- Ultrix, VAX/VMS and VM/CMS systems.
-
- Please read the file called "copyright".
-
- Please also note that the source code for Floppy does
- NOT necessarily conform to the coding conventions it
- itself checks ! You may draw whatever conclusions you
- wish from this fact !
-
- Installing on Unix Systems
- --------------------------
- 1) After unpacking the source files, you should type "make".
- 2) If your Fortran compiler is not called "f77" then you
- should first edit the file called "makefile" accordingly.
-
- As installation has not been checked on many Unix
- platforms, you may also have to fiddle a bit with the
- makefile, and possibly with the syntax of the "include"
- directives in the .f files.
-
- The "man" page for Floppy is called "floppy.l".
-
- Installing on VMS Systems
- -------------------------
- 1) Copy all the .f and .h files to your VMS system.
- 2) Copy also the files "floppy.vmsfor","floppy.vmshlp",
- and "floppy.vmscld".
- 3) Remove the file "floppy.f", and replace it with the
- "floppy.vmsfor" file.
- 4) You will then have to edit all the "include" directives
- in the .f files to correspond with the VMS syntax.
- (If you're handy with "awk", you can probably do this
- already on your Unix machine.)
- 5) You should also edit PARAM.h so that MCUNIT=5.
- 6) Then compile the Fortran files, and link them together.
- No libraries should be required.
- 7) Take the "floppy.vmscld" file, edit it so that the
- image name is correct for your .EXE, and save it as
- "floppy.cld".
- 8) Then type "$ set command floppy".
- 9) Refer to the VMS help file in "floppy.vmshlp" for the
- syntax of the command.
-
- To make Floppy available for all users on your VMS system, you
- will need privilege to update DCLTABLES with the
- "set command" command.
-
- Installing on VM/CMS
- --------------------
- 1) Copy all the .f and .h files to your CMS minidisk.
- 2) Remove the "floppy.f" file.
- 3) Make one big file out of all the .f files.
- 4) Copy also the files "floppy.rexx" (call it "floppy exec"),
- "floppy.panel" (call it "floppy panel"), and "floppy.helpcms"
- (call it "floppy helpcms").
- 5) You will then have to edit all the "include" directives
- to correspond with the CMS MACLIB syntax.
- (If you're handy with "awk", you can probably do this already
- on your Unix machine.)
- 6) Create a CMS MACLIB, and place all the .h files in it.
- 7) Issue the GLOBAL MACLIB command to make the MACLIB available.
- 8) Edit PARAM.h so that MCUNIT=5.
- 9) Then compile the Fortran, and load it.
- No libraries should be required.
- 10) Generate a LOAD module called FLOPPY$M using the GENMOD
- command.
-
- Note that, for full-screen interaction, you need
- the IOS3270 Program Offering from IBM. But Floppy also
- works in command line mode. Refer to the HELPCMS file
- for details.
-
- Disclaimer
- ----------
- Although Floppy has been in constant use for some years at
- CERN, we make no guarantees of its correctness or "buglessness".
- If you manage to port Floppy to another platform, I would be
- very interested to hear details. Unfortunately, I cannot assist
- in any way with such exercises. Please read the file called
- "copyright" in the posting.
-
- -------------------------------------------------------------------
-
- Julian Bunn
- Computing and Networks Division
- CERN
- Geneva
- Switzerland
- Tel. 767 50 29
- 14th. May 1990
-
- List of Coding Conventions in Floppy
-
- * 1 Avoid comment lines after end of module
- * 2 End all program modules with the END statement
- * 3 Declared COMMON blocks must be used in the module
- * 4 COMPLEX and DOUBLEPRECISION vars at end of COMMON
- * 5 COMMON block definitions should not change
- * 6 Variable names should be 6 or fewer characters long
- 7 Variables in COMMON should be 6 characters long
- 8 Variables not in COMMON should be <6 characters
- * 9 Integer variables should begin with I to N
- * 10 Variable names should not equal FORTRAN keywords
- * 11 Avoid comment lines before module declaration
- * 12 Module names should not equal intrinsic functions
- * 13 First statement in a module should be declaration
- * 14 Module should begin with at least 3 comment lines
- 15 Comment lines should begin with a C
- * 16 No comment lines between continuations
- * 17 Avoid non-standard variable types eg INTEGER*2
- * 18 Avoid multiple COMMON definitions per line
- * 19 Do not dimension COMMON variables outside COMMON
- * 20 Avoid embedded blanks in variable names
- * 21 Avoid embedded blanks in syntactic entities
- * 22 Avoid the use of PRINT statements (use WRITE)
- 23 Do not give the END statement a label
- * 24 Avoid WRITE(* construction
- 25 Avoid WRITE statement in a FUNCTION
- * 26 Avoid the use of PAUSE statements
- * 27 Statement labels should not begin in column 1
- * 28 Always preceede STOP by a descriptive WRITE
- * 29 Avoid the use of ENTRY in FUNCTIONS
- * 30 Avoid using I/O in FUNCTIONs
- 31 Avoid the use of the alternate RETURN statement
- * 32 COMMON block names should not equal variable names
- * 33 Avoid use of obsolete CERN library routines
- 34 Avoid FUNCTION names the same as intrinsics
- * 35 Local functions should be declared EXTERNAL
- * 36 Module names should all be different
- * 37 Avoid expressions of mixed mode eg A=B/I
- * 38 Length of passed CHARACTER variables should be *
- * 39 Order of statements should conform !
- * 40 Separate Statement Functions by comment lines
- * 41 No names in Statement Function definitions elsewhere
- 42 Use LLT,LGT etc to compare CHARACTER vars. in IFs
- 43 Variables (not COMMON, not PARAMs) <6 characters
- * 44 Passed arguments should be dimensioned * in module
-
- The conventions are based on Chapters 8 and 9 of 'Effective FORTRAN 77',
- M. Metcalf (Oxford U. Press, 1985), ISBN 0-19-853709-3.
-
-