home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / c / 13103 < prev    next >
Encoding:
Internet Message Format  |  1992-09-02  |  9.6 KB

  1. Xref: sparky comp.lang.c:13103 comp.lang.c++:13192 comp.sources.wanted:4185
  2. Path: sparky!uunet!sun-barr!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!uka!i41s14!prechelt
  3. From: prechelt@i41s14.ira.uka.de (Lutz Prechelt)
  4. Newsgroups: comp.lang.c,comp.lang.c++,comp.sources.wanted
  5. Subject: SUMMARY: Software Metrics Tools available ?
  6. Date: 2 Sep 1992 11:03:24 GMT
  7. Organization: University of Karlsruhe, FRG
  8. Lines: 236
  9. Distribution: world
  10. Message-ID: <18271sINNrd6@iraul1.ira.uka.de>
  11. NNTP-Posting-Host: i41s14.ira.uka.de
  12.  
  13.  
  14. Some days ago, I posted the following question:
  15.  
  16. > Does anybody know of any freely available tools that compute
  17. > some software metrics for C or C++ programs ?
  18. >
  19. > I am thinking of such things as numbers of operators/operands/controls
  20. > per function/file/statement and so on.
  21.  
  22. This is the summary of the answers I got.
  23. Basically, I did not find what I wanted. But some remotely similar tools
  24. showed up: A simple lines-of-code counter script and ftp sites of 
  25. Halstead Software Science metrics programs.
  26.  
  27. ------------------------------
  28.  
  29. From: Clifton Liles 282-4736 <liles@sweetpea.jsc.nasa.gov>
  30.  
  31. This is not much but it what I have used to guess about code metics.  Its
  32. a lines of code counter script.  
  33. #!/bin/csh -f
  34. #
  35. # This shell divides the lines of code into two groups,
  36. # "comments" and "executable" code (other), as described below.
  37. # The "executable" lines of code is not the number of executable statements.
  38. #
  39. # C
  40. #    comments include:
  41. #        comments (from lines with /* to lines with */)
  42. #        blank lines
  43. #        lines with only braces and/or semicolons
  44. #
  45. #    executable lines include:
  46. #        lines which are not comments
  47. #
  48. # FORTRAN
  49. #    comments include:
  50. #        comments (lines beginning with C or c)
  51. #        blank lines
  52. #
  53. #    executable line include:
  54. #        lines which are not comments
  55. #
  56.  
  57. echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
  58. echo -n $1"    "
  59.  
  60.  
  61. if($1:e == "c" || $1:e == "h") then
  62.  
  63.     @ total = `cat $1 | wc -l`
  64.  
  65.     @ exlines = `egrep -v '(^[     ]*$|^[     ]*[{}]*[     ]*;[     ]*$|^[     ]*[{}][     ]*;*[     ]*$)' $1 | sed    -e 's+/\*.*\*/++g' -e '\+/\*+,\+\*/+ d' | wc -l`
  66.  
  67.     @ comlines = $total - $exlines
  68.  
  69.     echo -n "total=    "$total"    "
  70.     echo -n "C_executable=    "$exlines"    "
  71.     echo "C_comments=    "$comlines"    "
  72.  
  73. else if($1:e == "f") then
  74.  
  75.     @ total = `cat $1 | wc -l`
  76.  
  77.     @ comlines  = `egrep -c '(^[Cc]|^[     ]*$)' $1`
  78.  
  79.     @ exlines = $total - $comlines
  80.  
  81.     echo -n "total_lines=    "$total"    "
  82.     echo -n "F_executable=    "$exlines"    "
  83.     echo "F_comments=    "$comlines"    "
  84. else
  85.     echo not C or FORTRAN
  86. endif
  87.  
  88. ------------------------------
  89.  
  90. From: Kartick Thangavelu <ktt30@mcode.amdahl.com>
  91.  
  92. Yes, there are a number of commercially available tools in the market that
  93. compute various software metrics like operator density (also called Halstead
  94.  metrics), complexity (McCabe metrics) and also provide you with the flexibility
  95.  of enforcing compliance to coding styles and guidelines to make C programs 
  96.  readable, portable, and maintainable. The companies dealing with these products
  97. are (to name a few):
  98.  
  99. 1. Abraxas Software, Portland, Oregon, USA. Product-- CodeCheck (Unix/dos).
  100. 2. Veritas Software, Santa Clara, California, USA. Product-- VistaTest.
  101.  
  102. I recommend contacting Veritas Software because the other company has a bad 
  103.  reputation with regards to Customer Support and in fact dealing with customers.
  104. There have been numerous complaints with the way they do business. 
  105.  
  106. ------------------------------
  107.  
  108. From: tuan%ukfca1@sj.ate.slb.com
  109.  
  110.     I've done an 'archie' search recently for one of the metrics tools so
  111.     here are the results.
  112.  
  113.     Also, please can you e-mail copies of all the ones you have found from
  114.     this search too.
  115.  
  116. Search request for 'halstead'
  117.  
  118. Host cnam.cnam.fr   (192.33.159.6)
  119. Last updated 05:19  3 Jul 1992
  120.  
  121.     Location: /pub/Ada/Repository/id-files
  122.       FILE      r--r--r--      1882  Jun 24  1991   halstead.sid.Z
  123.     Location: /pub/Ada/Repository/metrics
  124.       FILE      r--r--r--      2187  Jul 21  1987   halstead.cmm.Z
  125.       FILE      r--r--r--       466  Jun 16  1986   halstead.co.Z
  126.       FILE      r--r--r--     14320  Jun 16  1986   halstead.doc.Z
  127.       FILE      r--r--r--      2250  Jun 16  1986   halstead.me.Z
  128.       FILE      r--r--r--       748  Jun 20  1986   halstead.pl.Z
  129.       FILE      r--r--r--      1366  Nov 16  1987   halstead.pro.Z
  130.       FILE      r--r--r--    225795  Feb 13  1991   halstead.src.Z
  131.       FILE      r--r--r--      9558  Jun 16  1986   halstead.tst.Z
  132.  
  133. Host cs.tut.fi   (130.230.4.2)
  134. Last updated 04:25  4 Jul 1992
  135.  
  136.     Location: /pub/src/software-eng/metrics/doc
  137.       FILE      rw-r--r--       618  Sep 20  1989   halstead.doc
  138.     Location: /pub/src/software-eng/metrics/src/halstead
  139.       FILE      rw-r--r--      2404  Sep 20  1989   halstead.sh
  140.     Location: /pub/src/software-eng/metrics/src
  141.       DIRECTORY rwxr-xr-x       512  Sep 20  1989   halstead
  142.     Location: /pub/src/software-eng/metrics/src/bin
  143.       FILE      rwxr-xr-x      2404  Sep 20  1989   halstead
  144.  
  145. Host rigel.acs.oakland.edu   (141.210.10.117)
  146. Last updated 16:46  5 May 1992
  147.  
  148.     Location: /pub/ada/metrics
  149.       FILE      rw-r--r--     33881  Jun 16  1986   halstead.doc
  150.       FILE      rw-r--r--     29855  Jun 16  1986   halstead.tst
  151.       FILE      rw-r--r--       899  Jun 16  1986   halstead.co
  152.     Location: /pub/ada/id-files
  153.       FILE      rw-r--r--      3566  Jun 24  1991   halstead.sid
  154.     Location: /pub/ada/metrics
  155.       FILE      rw-r--r--      2124  Jun 20  1986   halstead.pl
  156.       FILE      rw-r--r--      3414  Jul 21  1987   halstead.cmm
  157.       FILE      rw-r--r--      2414  Nov 16  1987   halstead.pro
  158.       FILE      rw-r--r--      3848  Jun 16  1986   halstead.me
  159.       FILE      rw-r--r--    973135  Feb 13  1991   halstead.src
  160.  
  161. Host wuarchive.wustl.edu   (128.252.135.4)
  162. Last updated 04:16 10 May 1992
  163.  
  164.     Location: /mirrors2/ada/metrics
  165.       FILE      rw-rw-r--       899  Jun 16  1986   halstead.co
  166.       FILE      rw-rw-r--      3414  Jul 21  1987   halstead.cmm
  167.       FILE      rw-rw-r--     32759  Jun 16  1986   halstead.doc
  168.       FILE      rw-rw-r--      2414  Nov 16  1987   halstead.pro
  169.       FILE      rw-rw-r--      3848  Jun 16  1986   halstead.me
  170.       FILE      rw-rw-r--    973135  Feb 13  1991   halstead.src
  171.       FILE      rw-rw-r--      2124  Jun 20  1986   halstead.pl
  172.       FILE      rw-rw-r--     29855  Jun 16  1986   halstead.tst
  173.     Location: /mirrors2/ada/id-files
  174.       FILE      rw-rw-r--      3566  Jun 24  1991   halstead.sid
  175. Search request for 'mccabe'
  176.  
  177.  
  178. Host cnam.cnam.fr   (192.33.159.6)
  179. Last updated 05:19  3 Jul 1992
  180.  
  181.     Location: /pub/Ada/Repository/id-files
  182.       FILE      r--r--r--      1897  Jun 24  1991   mccabe.sid.Z
  183.     Location: /pub/Ada/Repository/metrics
  184.       FILE      r--r--r--       688  Jun 16  1986   mccabe.cnt.Z
  185.       FILE      r--r--r--      6630  Jun 16  1986   mccabe.doc.Z
  186.       FILE      r--r--r--       643  Jun 16  1986   mccabe.dss.Z
  187.       FILE      r--r--r--      1074  Jun 16  1986   mccabe.dst.Z
  188.       FILE      r--r--r--     12918  Jun 16  1986   mccabe.grm.Z
  189.       FILE      r--r--r--      2488  Jun 16  1986   mccabe.me.Z
  190.       FILE      r--r--r--      1365  Nov 16  1987   mccabe.pro.Z
  191.       FILE      r--r--r--      4283  Jun 16  1986   mccabe.rno.Z
  192.       FILE      r--r--r--    127226  Jun 12  1986   mccabe.src.Z
  193.       FILE      r--r--r--     13852  Jun 16  1986   mccabe.tst.Z
  194.  
  195. Host cs.tut.fi   (130.230.4.2)
  196. Last updated 04:25  4 Jul 1992
  197.  
  198.     Location: /pub/src/software-eng/metrics/doc
  199.       FILE      rw-r--r--       590  Sep 20  1989   mccabe.doc
  200.     Location: /pub/src/software-eng/metrics/src/mccabe
  201.       FILE      rw-r--r--      3593  Sep 20  1989   mccabe.sh
  202.     Location: /pub/src/software-eng/metrics/src/bin
  203.       FILE      rwxr-xr-x      3593  Sep 20  1989   mccabe
  204.     Location: /pub/src/software-eng/metrics/src
  205.       DIRECTORY rwxr-xr-x       512  Sep 20  1989   mccabe
  206.  
  207. Host rigel.acs.oakland.edu   (141.210.10.117)
  208. Last updated 16:46  5 May 1992
  209.  
  210.     Location: /pub/ada/metrics
  211.       FILE      rw-r--r--     14906  Jun 16  1986   mccabe.doc
  212.     Location: /pub/ada/id-files
  213.       FILE      rw-r--r--      3637  Jun 24  1991   mccabe.sid
  214.     Location: /pub/ada/metrics
  215.       FILE      rw-r--r--     36616  Jun 16  1986   mccabe.grm
  216.       FILE      rw-r--r--      4647  Jun 16  1986   mccabe.dst
  217.       FILE      rw-r--r--      8163  Jun 16  1986   mccabe.rno
  218.       FILE      rw-r--r--      2160  Jun 16  1986   mccabe.cnt
  219.       FILE      rw-r--r--      4857  Jun 16  1986   mccabe.me
  220.       FILE      rw-r--r--      1837  Jun 16  1986   mccabe.dss
  221.       FILE      rw-r--r--      2417  Nov 16  1987   mccabe.pro
  222.       FILE      rw-r--r--    421342  Jun 12  1986   mccabe.src
  223.       FILE      rw-r--r--     54571  Jun 16  1986   mccabe.tst
  224.  
  225. Host wuarchive.wustl.edu   (128.252.135.4)
  226. Last updated 04:16 10 May 1992
  227.  
  228.     Location: /mirrors2/ada/metrics
  229.       FILE      rw-rw-r--      4647  Jun 16  1986   mccabe.dst
  230.       FILE      rw-rw-r--      1837  Jun 16  1986   mccabe.dss
  231.       FILE      rw-rw-r--     14218  Jun 16  1986   mccabe.doc
  232.       FILE      rw-rw-r--      2417  Nov 16  1987   mccabe.pro
  233.       FILE      rw-rw-r--      2160  Jun 16  1986   mccabe.cnt
  234.       FILE      rw-rw-r--      8163  Jun 16  1986   mccabe.rno
  235.       FILE      rw-rw-r--     36616  Jun 16  1986   mccabe.grm
  236.       FILE      rw-rw-r--    421342  Jun 12  1986   mccabe.src
  237.       FILE      rw-rw-r--      4857  Jun 16  1986   mccabe.me
  238.       FILE      rw-rw-r--     54571  Jun 16  1986   mccabe.tst
  239.     Location: /mirrors2/ada/id-files
  240.       FILE      rw-rw-r--      3637  Jun 24  1991   mccabe.sid
  241.  
  242. ------------------------------
  243.  
  244. -- 
  245. Lutz Prechelt   (email: prechelt@ira.uka.de)            | Whenever you 
  246. Institut fuer Programmstrukturen und Datenorganisation  | complicate things,
  247. Universitaet Karlsruhe;  D-7500 Karlsruhe 1;  Germany   | they get
  248. (Voice: ++49/721/608-4317, FAX: ++49/721/694092)        | less simple.
  249.