gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Call graph for Modula-2


From: Michael Riedl
Subject: Re: Call graph for Modula-2
Date: Sat, 11 Feb 2023 16:43:17 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:102.0) Gecko/20100101 Thunderbird/102.7.1

allo Andreas, hallo John,

I see my question was not descibed precisly enough - sorry for that.

What I am locking for is a tool generating an overview upon what other
procedures a "high level" procedure is depending on. Below an shortend
example how that could look like.

  procedure                                 library

  JKHnd                                      :       
      |?----JKShel +                       :       
      |                                           :       
      |?----JKChrg                          :       
      |         |?----SSChrg +            :       
      |                                           :       
      |----+JKShel +                      :       
      |                                           :       
      |----+JKZero +                      :       
      |                                           :       
      |----+JKGen                           :       
      |         |?----SSSS                   :       
      |         |         |?---+JKout >    :       
      |         |                                 :       
      |         |?----SSKL                   :       
      |         |         |----+RT123 *   : Roots       
      |         |         |----+JKout >    :       
      .         .         .
      .         .         .
      .         .         .

(the complete overview in the attached file)

So I would like to see

- A procedure in a higher level module depends on which procedures
  define in the same module or in another module
- and optional - a procedure is called by which other procedures within the project

I hope that makes a bit more obvious what I am looking for.

Thanks

Michael


Am 11.02.23 um 15:32 schrieb Fischlin Andreas:
Dear Michael,

It is not quite clear to me what you wish to accomplish. You wanna find dead code? I mean hereby any procedure that is never called by anyone? If yes, I have to say I normally do this by programming. This means keeping modules as small as possible and nest auxiliary procedures as much as possible within a single scope. if a module gets nevertheless large, indeed this can become tedious is you forgot a lot about the code I would perhaps to resort to some grepping. E.g. 

cat DMWindIO.mod | grep PROCEDURE | awk '{print $2}' | awk '{print$1}' FS="(" | sed -e "s|;||g" > DMWindIO.mod.proclist

gives you a list of all procedures. Using this file to grep -c for all procedure idents tells you whether a proc is used at least once. This is a little shell script doing this job (I have pasted the DMWindIO.mod.proclist containing 113 PROC idents partly into following shell scirpt doing the job

#!/bin/bash

module=DMWindIO.mod

procList="
StrLen
WriteSpaces
WriteEOL
WriteChars
WriteChar
DummyProc
PointClicked
RectClicked
PointDoubleClicked
RectDoubleClicked
GetLastMouseClick
GetCurMousePos
DoTillMButReleased
Drag
SetContSize
GetContSize
SetScrollStep
GetScrollStep
GetScrollBoxPos
"

for p in $procList; do
    printf "%s$p: "
    cat $module | grep -c $p
done

Perhaps this is what you are looking for?

Andreas


ETH Zurich
Prof. em. Dr. Andreas Fischlin
IPCC Vice-Chair WGII
Systems Ecology - Institute of Biogeochemistry and Pollutant Dynamics
CHN E 24
Universitaetstrasse 16
8092 Zurich
SWITZERLAND


+41 44 633-6090 phone
+41 44 633-1136 fax
+41 79 595-4050 mobile

             Make it as simple as possible, but distrust it!
________________________________________________________________________









On 10/02/2023, at 23:46, Michael Riedl <udo-michael.riedl@t-online.de> wrote:

Hallo,

is anybody aware about a tool to generate a call graph for a Modula-2 library / program ?

I would like to use such a tool to be sure that all procedures in a library are at least indirectly referred to in a test routine.

(well knowing that this might not be sufficient, but it would be at least a starting point :-)

Any hint would be helpful

Thanks in advance

Michael




Attachment: calltree.txt
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]