Created
August 10, 2016 13:35
-
-
Save alenbasic/9f077a8203fc67f26fe6038f31b45b2e to your computer and use it in GitHub Desktop.
A text "call graph" generator for SQR files. Checks procedures for calls to other procedures and prints the procedures and the calls they make.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
f = open(sys.argv[1],'r').readlines() | |
arr = [] | |
proc = False | |
for line in f: | |
if "begin-pro" in line: | |
print line.strip() | |
proc = True | |
elif proc and "do " in line: | |
try: | |
if line.index("!") < line.index("d"): | |
continue | |
except ValueError as error: | |
pass | |
line = line.strip() | |
line = line.split("!") | |
arr.append(line[0]) | |
elif "end-pro" in line: | |
for l in arr: | |
print "\t- %s" % l | |
print "" | |
arr = [] | |
proc = False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment