Board index » delphi » Pascal code analyzer.

Pascal code analyzer.

-=[ In:ggr...@internetland.ne was heard to say... ]=-

 In> grif...@magicnet.net (Michael Griffin) wrote:

 >I'm looking for software that will "analyze" my Pascal files and give me
 > information like this:
 > 1. Which variables are not being used
 > 2. A list of procedures/functions and their callers

 In> Callers?  Meaning what calls the functions?

 > 3. Procs/funcs that are not used
 > 4. General overview of program flow (what calls what, given primary file
 > starting point).

 In> What would 4 look like for output as a key?
 In> What kind of need might there be for such a program?  I might consider
 In> making that my next project...

I see a definite need for such a program, or something like it, and if I had
the time I'd give it a whirl myself, at least for my own use. The need comes
mostly when I'm reworking my code and making improvements or trying to add
new features, or trying to organize my units more efficiently, and I need a
breakdown of the overall flow. Right now I make good use out of GREP, which
is great for checking if variables or procedures/functions are being used,
and I use it to locate where functions and procedures are being called, but
it isn't enough, because I can't see what functions/procedures are related
and how they are related (where two routines tend to be used together alot,
for instance). It would also be nice to be able to get a complete tree
diagram of unit usage, in order to see relationships there. I have tried one
utility called UNITREE, but it doesn't give the full tree and only seems to
go a certain level, often missing some units completely. I guess I could
write my own utility to do this easy enough. Hmmm...

        -- Kim Forwood --

  /-=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=-\
  $           Kim Forwood  <kim.forw...@access.cn.camriv.bc.ca>          %
  %              http://goodship.cn.camriv.bc.ca/~kforwood/              $
  $         For what purpose is life, if one cannot live freely?         %
  \-=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=--=oOo=-/

___ Blue Wave/QWK v2.20

 

Re:Pascal code analyzer.


Quote
Kim.Forw...@access.cn.camriv.bc.ca (Kim Forwood) writes:
> It would also be nice to be able to get a complete tree
> diagram of unit usage, in order to see relationships there. I have tried one
> utility called UNITREE, but it doesn't give the full tree and only seems to
> go a certain level, often missing some units completely. I guess I could
> write my own utility to do this easy enough. Hmmm...

This is something I could use, too. Some special requirements for it to be
useful to me would be:

- Take a list of files (wildcards allowed, of course) that contain units
  and/or programs, and visualize the dependencies. Because more than one
  program could be there, the result would be a graph, rather than a tree.
  The graph would tell me things like: which units are needed for a certain
  program, or which programs need a certain unit. And, of course, the graph
  should be as clearly arranged as possible (which will probably be a lot
  harder to do for a graph than for a tree...)

- If A uses B and C, and B uses C, only A->B->C will be shown, assuming the
  (possible) relation A->C implicitly. This would probably be an optional
  feature, but I definitely need it, since I've drawn some graphs for my units
  by hand, and the only way to keep them easily visible was by removing
  relations like this - otherwise there were simply too many connections.

- The program should also be able to handle {$IFDEF}s and include files.
  For example, the following should be processed correctly:

  SOMEPROG.PAS: uses Dos,{$I CRTUNIT.INC}; ...

  CRTUNIT.INC:  {$IFDEF WINDOZE} WinCrt {$ELSE} Crt {$ENDIF}

Frank

Re:Pascal code analyzer.


In article <528c6n$...@rznews.rrze.uni-erlangen.de> of Tue, 24 Sep 1996
10:12:39 in comp.lang.pascal.borland, Frank Heckenbach

Quote
<fkhec...@cip.informatik.uni-erlangen.de> wrote:
>Kim.Forw...@access.cn.camriv.bc.ca (Kim Forwood) writes:
>> It would also be nice to be able to get a complete tree
>> diagram of unit usage, in order to see relationships there. I have tried one
>> utility called UNITREE, but it doesn't give the full tree and only seems to
>> go a certain level, often missing some units completely. I guess I could
>> write my own utility to do this easy enough. Hmmm...

>This is something I could use, too. Some special requirements for it to be
>useful to me would be:

>- Take a list of files (wildcards allowed, of course) that contain units
>  and/or programs, and visualize the dependencies. Because more than one
>  program could be there, the result would be a graph, rather than a tree.
>  The graph would tell me things like: which units are needed for a certain
>  program, or which programs need a certain unit. And, of course, the graph
>  should be as clearly arranged as possible (which will probably be a lot
>  harder to do for a graph than for a tree...)

>- If A uses B and C, and B uses C, only A->B->C will be shown, assuming the
>  (possible) relation A->C implicitly. This would probably be an optional
>  feature, but I definitely need it, since I've drawn some graphs for my units
>  by hand, and the only way to keep them easily visible was by removing
>  relations like this - otherwise there were simply too many connections.

>- The program should also be able to handle {$IFDEF}s and include files.
>  For example, the following should be processed correctly:

>  SOMEPROG.PAS: uses Dos,{$I CRTUNIT.INC}; ...

>  CRTUNIT.INC:  {$IFDEF WINDOZE} WinCrt {$ELSE} Crt {$ENDIF}

>Frank

I have done some of the work for this; no {$IFDEF} recognition, no {$I
file}, no graphical output.  Its purpose was to locate circularity in
"uses" calls - after generating a TCollection descendant of TCollection
descendants representing the directed graph, it pruned the ends and then
looked for loops.  The human interface was not nice, but was good enough
to locate loops.  I released a very few copies, but I don't have the
records here.  I don't think it's anywhere near Garbo-worthy, but I
might be persuaded to put it on
        http://www.merlyn.demon.co.uk/programs/
--
John Stockton, Surrey, UK.  J...@merlyn.demon.co.uk  Turnpike v1.12  MIME
    http://www.merlyn.demon.co.uk/

Other Threads