|
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 |
I hope that makes a bit more obvious what I am looking for.
Thanks
Michael
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
Perhaps this is what you are looking for?#!/bin/bash
module=DMWindIO.mod
procList="StrLenWriteSpacesWriteEOLWriteCharsWriteCharDummyProcPointClickedRectClickedPointDoubleClickedRectDoubleClickedGetLastMouseClickGetCurMousePosDoTillMButReleasedDragSetContSizeGetContSizeSetScrollStepGetScrollStepGetScrollBoxPos"
for p in $procList; doprintf "%s$p: "cat $module | grep -c $pdone
Andreas
ETH ZurichProf. em. Dr. Andreas FischlinIPCC Vice-Chair WGIISystems Ecology - Institute of Biogeochemistry and Pollutant DynamicsCHN E 24Universitaetstrasse 168092 ZurichSWITZERLAND
+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
calltree.txt
Description: Text document
[Prev in Thread] | Current Thread | [Next in Thread] |