Hello Mahmoud et ALL
When trying to Trace a program with a lot of Functions ...
Its nice to know Who Calls Who to try to figure out the program
Func Block calls => these Funcs
Func Block is called <= by these Funcs
List-Functions.ring
RingFmt.ring // <<<< analyze this ring program
# Lists the Functions in a Ring program.
# Function Block shows the Called Functions
# Functions Calling a Function Block
#--- NEEDS NEEDS NEEDS the following LIBRARY
#--- ringpm install dialog from ysdragon
Example:
Who does removeLastTabFromBuffer => Call
Who Calls => removeLastTabFromBuffer
FUNC BLOCK name found on line 364, it is Func# 19
F: 364: 19: func removeLastTabFromBuffer
FUNC BLOCK on line 364 => calls these Function on line 366
FUNC.: 364| func removeLastTabFromBuffer|
.func: 366| > getTabChars #16
Func #19 Block <= Called by these Functions using Dynamic Array
FUNC: 19 removeLastTabFromBuffer: 3
<< processKeyword
<< processKeyword
<< processOperator
========================
Output
Using Dialog select a file
Selected file: C:\MyStuff\AA-FormatRing-Repository\RingFmt.ring
<= Line# Func# Name ===========================>
F: 67: 1: func main
F: 80: 2: func processArguments aPara
F: 96: 3: func processFiles
F: 102: 4: func getListOfFiles cArg
F: 114: 5: func processOptions cOption
F: 149: 6: func prepareFileName cFileName
F: 158: 7: func processFile cFileName
F: 176: 8: func loadFileTokens cFileName
F: 189: 9: func processTokens aTokens
F: 212: 10: func checkChangingKeywords nToken, nTokensCount, aToken, cValue, aFileTokens
F: 228: 11: func resetVariables
F: 240: 12: func processToken aToken, cValue
F: 261: 13: func printToken cValue
F: 267: 14: func getTabs
F: 271: 15: func getNTabs nCount
F: 275: 16: func getTabChars
F: 290: 17: func processKeyword aToken,cValue
F: 354: 18: func lastTokenIsOperator aOperators
F: 364: 19: func removeLastTabFromBuffer
F: 374: 20: func afterTabOrSpaceOrNLInBuffer
F: 383: 21: func processOperator cOperator
F: 433: 22: func getNextToken
F: 442: 23: func getPrevToken
F: 450: 24: func processLiteral cLiteral
F: 464: 25: func processNumber cNumber
F: 470: 26: func addSpaceBeforeThisTokenIfThePrevTokenIsNumberOrLiteral
F: 477: 27: func processIdentifier cIdentifier
F: 490: 28: func getLastCharInBuffer
F: 498: 29: func processEndLine cEndLine
F: 541: 30: func processComment cComment
F: 585: 31: func showhelp
F: 607: 32: func line
<===== List of FUNC Block with Called Func ====>
FUNC.: 67| func main|
.func: 76| > processArguments #2
.func: 78| > processFiles #3
FUNC.: 80| func processArguments aPara |
.func: 83| > processOptions #5
.func: 87| > getListOfFiles #4
.func: 89| > prepareFileName #6
FUNC.: 96| func processFiles|
.func: 99| > processFile #7
FUNC.: 102| func getListOfFiles cArg|
FUNC.: 114| func processOptions cOption|
FUNC.: 149| func prepareFileName cFileName|
FUNC.: 158| func processFile cFileName|
.func: 160| > line #32
.func: 162| > line #32
.func: 165| > processTokens #9
.func: 166| > line #32
.func: 168| > line #32
.func: 170| > line #32
.func: 173| > line #32
FUNC.: 176| func loadFileTokens cFileName|
FUNC.: 189| func processTokens aTokens |
.func: 192| > resetVariables #11
.func: 199| > checkChangingKeywords #10
.func: 200| > processToken #12
.func: 201| > printToken #13
FUNC.: 212| func checkChangingKeywords nToken, nTokensCount, aToken, cValue, aFileTokens|
FUNC.: 228| func resetVariables|
FUNC.: 240| func processToken aToken, cValue|
FUNC.: 261| func printToken cValue|
FUNC.: 267| func getTabs|
.func: 269| > getNTabs #15
FUNC.: 271| func getNTabs nCount|
FUNC.: 275| func getTabChars|
FUNC.: 290| func processKeyword aToken,cValue|
.func: 309| > lastTokenIsOperator #18
.func: 338| > removeLastTabFromBuffer #19
.func: 341| > getNTabs #15
.func: 344| > getNTabs #15
.func: 346| > removeLastTabFromBuffer #19
.func: 349| > afterTabOrSpaceOrNLInBuffer #20
FUNC.: 354| func lastTokenIsOperator aOperators|
.func: 356| > getPrevToken #23
FUNC.: 364| func removeLastTabFromBuffer|
.func: 366| > getTabChars #16
FUNC.: 374| func afterTabOrSpaceOrNLInBuffer|
FUNC.: 383| func processOperator cOperator|
.func: 394| > getNextToken #22
.func: 419| > removeLastTabFromBuffer #19
FUNC.: 433| func getNextToken|
FUNC.: 442| func getPrevToken|
FUNC.: 450| func processLiteral cLiteral|
.func: 452| > addSpaceBeforeThisTokenIfThePrevTokenIsNumberOrLiteral #26
FUNC.: 464| func processNumber cNumber|
.func: 466| > addSpaceBeforeThisTokenIfThePrevTokenIsNumberOrLiteral #26
FUNC.: 470| func addSpaceBeforeThisTokenIfThePrevTokenIsNumberOrLiteral|
.func: 472| > getPrevToken #23
FUNC.: 477| func processIdentifier cIdentifier|
.func: 480| > getPrevToken #23
.func: 484| > getNextToken #22
FUNC.: 490| func getLastCharInBuffer|
FUNC.: 498| func processEndLine cEndLine|
.func: 539| > getTabs #14
FUNC.: 541| func processComment cComment|
.func: 565| > getNTabs #15
.func: 567| > getNTabs #15
.func: 573| > getNTabs #15
.func: 576| > afterTabOrSpaceOrNLInBuffer #20
FUNC.: 585| func showhelp|
.func: 587| > line #32
.func: 589| > line #32
.func: 592| > line #32
.func: 594| > line #32
.func: 605| > line #32
FUNC.: 607| func line|
<===== List of Func Block Called by Func ======>
<--- Dynamic 2D Array --->
FUNC: 1 main: 1
<<
FUNC: 2 processArguments: 1
<< main
FUNC: 3 processFiles: 1
<< main
FUNC: 4 getListOfFiles: 1
<< processArguments
FUNC: 5 processOptions: 1
<< processArguments
FUNC: 6 prepareFileName: 1
<< processArguments
FUNC: 7 processFile: 1
<< processFiles
FUNC: 8 loadFileTokens: 0
FUNC: 9 processTokens: 1
<< processFile
FUNC: 10 checkChangingKeywords: 1
<< processTokens
FUNC: 11 resetVariables: 1
<< processTokens
FUNC: 12 processToken: 1
<< processTokens
FUNC: 13 printToken: 1
<< processTokens
FUNC: 14 getTabs: 1
<< processEndLine
FUNC: 15 getNTabs: 6
<< getTabs
<< processKeyword
<< processKeyword
<< processComment
<< processComment
<< processComment
FUNC: 16 getTabChars: 1
<< removeLastTabFromBuffer
FUNC: 17 processKeyword: 0
FUNC: 18 lastTokenIsOperator: 1
<< processKeyword
FUNC: 19 removeLastTabFromBuffer: 3
<< processKeyword
<< processKeyword
<< processOperator
FUNC: 20 afterTabOrSpaceOrNLInBuffer: 2
<< processKeyword
<< processComment
FUNC: 21 processOperator: 0
FUNC: 22 getNextToken: 2
<< processOperator
<< processIdentifier
FUNC: 23 getPrevToken: 3
<< lastTokenIsOperator
<< addSpaceBeforeThisTokenIfThePrevTokenIsNumberOrLiteral
<< processIdentifier
FUNC: 24 processLiteral: 0
FUNC: 25 processNumber: 0
FUNC: 26 addSpaceBeforeThisTokenIfThePrevTokenIsNumberOrLiteral: 2
<< processLiteral
<< processNumber
FUNC: 27 processIdentifier: 0
FUNC: 28 getLastCharInBuffer: 0
FUNC: 29 processEndLine: 0
FUNC: 30 processComment: 0
FUNC: 31 showhelp: 0
FUNC: 32 line: 11
<< processFile
<< processFile
<< processFile
<< processFile
<< processFile
<< processFile
<< showhelp
<< showhelp
<< showhelp
<< showhelp
<< showhelp
<===== END ====================================>