gm2
[Top][All Lists]
Advanced

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

Re: Call graph for Modula-2


From: Fischlin Andreas
Subject: Re: Call graph for Modula-2
Date: Sat, 11 Feb 2023 14:32:51 +0000

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: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

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