home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1331 < prev    next >
Internet Message Format  |  1990-12-28  |  8KB

  1. From: julian@cernvax.UUCP (julian bunn)
  2. Newsgroups: comp.lang.fortran,alt.sources
  3. Subject: Floppy - Fortran Coding Convention Checker
  4. Message-ID: <1867@cernvax.UUCP>
  5. Date: 14 May 90 14:46:12 GMT
  6.  
  7. Thanks to all the people who enthusiastically showed their
  8. interest in Floppy! The consensus seemed to be that Floppy
  9. should be posted to "comp.sources.misc". It is a rather
  10. large posting of 11 parts. In this mail I describe how to
  11. get Floppy up and running on Unix, VMS and CMS systems.
  12. The mail is included as "README" in the posting suite.
  13. I am assuming that the moderator of comp.sources.misc allows
  14. Floppy through.
  15.  
  16. To date, Floppy has been installed and tested on ULTRIX,
  17. Sun OS, VMS and CMS operating systems. Please mail me if
  18. you find bugs. Although I cannot guarantee to post fixes
  19. I will attempt to if time permits.
  20.  
  21. Instructions for Installing Floppy
  22. ----------------------------------
  23.  
  24. Floppy is a Fortran Coding Convention Checker and Fortran
  25. code tidier. Floppy understands standard Fortran 77 code.
  26. The user may specify any combination of a total of 44
  27. different coding conventions. These are described fully 
  28. in the Floppy guide, which comes as a PostScript file in
  29. the posting. (I also include the list of checks at the
  30. end of this article, those marked with an asterisk 
  31. correspond to what we consider to be a "standard" set.)
  32. Users may tidy their code by renumbering all
  33. statement labels, renumbering all FORMAT statements, 
  34. indenting DO and IF clauses, right-adjusting GOTOs and
  35. by moving all FORMAT statements to the end of each program
  36. module. Any combination of these tidy options is possible.
  37.  
  38. Floppy was initially written for VMS systems. The posting
  39. includes routines and execs that allow Floppy to be built
  40. for VM/CMS, VAX/VMS and Unix systems. The procedure for
  41. each system is described briefly below. 
  42.  
  43. Floppy was written by Julian Bunn and Hans Grote at CERN, the
  44. European Centre for Particle Physics in Geneva, Switzerland.
  45.  
  46. First Steps
  47. -----------
  48.  
  49. Each part of the posting should be saved into a
  50. directory called "floppy". The mail headers should be
  51. removed from each part and then each part
  52. should be executed as a script (Floppy was packed using
  53. the Packmail utility on a VMS Ultrix system).
  54.  
  55. There is a document in PostScript form, called "floppy.ps", 
  56. which describes in detail how Floppy works and is used on
  57. Ultrix, VAX/VMS and VM/CMS systems.
  58.  
  59. Please read the file called "copyright".
  60.  
  61. Please also note that the source code for Floppy does
  62. NOT necessarily conform to the coding conventions it
  63. itself checks ! You may draw whatever conclusions you
  64. wish from this fact !
  65.  
  66. Installing on Unix Systems
  67. --------------------------
  68. 1)  After unpacking the source files, you should type "make".
  69. 2)  If your Fortran compiler is not called "f77" then you
  70.     should first edit the file called "makefile" accordingly. 
  71.  
  72. As installation has not been checked on many Unix
  73. platforms, you may also have to fiddle a bit with the
  74. makefile, and possibly with the syntax of the "include"
  75. directives in the .f files.
  76.  
  77. The "man" page for Floppy is called "floppy.l". 
  78.  
  79. Installing on VMS Systems
  80. -------------------------
  81. 1)  Copy all the .f and .h files to your VMS system. 
  82. 2)  Copy also the files "floppy.vmsfor","floppy.vmshlp", 
  83.     and "floppy.vmscld".
  84. 3)  Remove the file "floppy.f", and replace it with the
  85.     "floppy.vmsfor" file. 
  86. 4)  You will then have to edit all the "include" directives 
  87.     in the .f files to correspond with the VMS syntax. 
  88.     (If you're handy with "awk", you can probably do this 
  89.     already on your Unix machine.)
  90. 5)  You should also edit PARAM.h so that MCUNIT=5. 
  91. 6)  Then compile the Fortran files, and link them together.
  92.     No libraries should be required. 
  93. 7)  Take the "floppy.vmscld" file, edit it so that the 
  94.     image name is correct for your .EXE, and save it as 
  95.     "floppy.cld". 
  96. 8)  Then type "$ set command floppy". 
  97. 9)  Refer to the VMS help file in "floppy.vmshlp" for the 
  98.     syntax of the command. 
  99.  
  100. To make Floppy available for all users on your VMS system, you
  101. will need privilege to update DCLTABLES with the
  102. "set command" command.
  103.  
  104. Installing on VM/CMS
  105. --------------------
  106. 1)  Copy all the .f and .h files to your CMS minidisk. 
  107. 2)  Remove the "floppy.f" file.
  108. 3)  Make one big file out of all the .f files. 
  109. 4)  Copy also the files "floppy.rexx" (call it "floppy exec"),
  110.     "floppy.panel" (call it "floppy panel"), and "floppy.helpcms"
  111.     (call it "floppy helpcms").
  112. 5)  You will then have to edit all the "include" directives 
  113.     to correspond with the CMS MACLIB syntax. 
  114.     (If you're handy with "awk", you can probably do this already 
  115.     on your Unix machine.)
  116. 6)  Create a CMS MACLIB, and place all the .h files in it.
  117. 7)  Issue the GLOBAL MACLIB command to make the MACLIB available.
  118. 8)  Edit PARAM.h so that MCUNIT=5. 
  119. 9)  Then compile the Fortran, and load it. 
  120.     No libraries should be required. 
  121. 10) Generate a LOAD module called FLOPPY$M using the GENMOD
  122.     command. 
  123.  
  124. Note that, for full-screen interaction, you need
  125. the IOS3270 Program Offering from IBM. But Floppy also
  126. works in command line mode. Refer to the HELPCMS file
  127. for details.
  128.  
  129. Disclaimer
  130. ----------
  131. Although Floppy has been in constant use for some years at
  132. CERN, we make no guarantees of its correctness or "buglessness".
  133. If you manage to port Floppy to another platform, I would be
  134. very interested to hear details. Unfortunately, I cannot assist
  135. in any way with such exercises. Please read the file called
  136. "copyright" in the posting.
  137.  
  138. -------------------------------------------------------------------
  139.  
  140. Julian Bunn
  141. Computing and Networks Division
  142. CERN
  143. Geneva
  144. Switzerland
  145. Tel. 767 50 29
  146. 14th. May 1990
  147.  
  148. List of Coding Conventions in Floppy
  149.  
  150. *  1   Avoid comment lines after end of module
  151. *  2   End all program modules with the END statement
  152. *  3   Declared COMMON blocks must be used in the module
  153. *  4   COMPLEX and DOUBLEPRECISION vars at end of COMMON
  154. *  5   COMMON block definitions should not change
  155. *  6   Variable names should be 6 or fewer characters long
  156.    7   Variables in COMMON should be 6 characters long
  157.    8   Variables not in COMMON should be <6 characters
  158. *  9   Integer variables should begin with I to N
  159. *  10  Variable names should not equal FORTRAN keywords
  160. *  11  Avoid comment lines before module declaration
  161. *  12  Module names should not equal intrinsic functions
  162. *  13  First statement in a module should be declaration
  163. *  14  Module should begin with at least 3 comment lines
  164.    15  Comment lines should begin with a C
  165. *  16  No comment lines between continuations
  166. *  17  Avoid non-standard variable types eg INTEGER*2
  167. *  18  Avoid multiple COMMON definitions per line
  168. *  19  Do not dimension COMMON variables outside COMMON
  169. *  20  Avoid embedded blanks in variable names
  170. *  21  Avoid embedded blanks in syntactic entities
  171. *  22  Avoid the use of PRINT statements (use WRITE)
  172.    23  Do not give the END statement a label
  173. *  24  Avoid WRITE(* construction
  174.    25  Avoid WRITE statement in a FUNCTION
  175. *  26  Avoid the use of PAUSE statements
  176. *  27  Statement labels should not begin in column 1
  177. *  28  Always preceede STOP by a descriptive WRITE
  178. *  29  Avoid the use of ENTRY in FUNCTIONS
  179. *  30  Avoid using I/O in FUNCTIONs
  180.    31  Avoid the use of the alternate RETURN statement
  181. *  32  COMMON block names should not equal variable names
  182. *  33  Avoid use of obsolete CERN library routines
  183.    34  Avoid FUNCTION names the same as intrinsics
  184. *  35  Local functions should be declared EXTERNAL
  185. *  36  Module names should all be different
  186. *  37  Avoid expressions of mixed mode eg A=B/I
  187. *  38  Length of passed CHARACTER variables should be *
  188. *  39  Order of statements should conform !
  189. *  40  Separate Statement Functions by comment lines
  190. *  41  No names in Statement Function definitions elsewhere
  191.    42  Use LLT,LGT etc to compare CHARACTER vars. in IFs
  192.    43  Variables (not COMMON, not PARAMs) <6 characters
  193. *  44  Passed arguments should be dimensioned * in module
  194.  
  195. The conventions are based on Chapters 8 and 9 of 'Effective FORTRAN 77',
  196. M. Metcalf (Oxford U. Press, 1985), ISBN 0-19-853709-3.
  197.  
  198.