GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Support for 'call setter' statements · Jatz/PeopleCodeTools@e62ae11

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • ExtractCallStack.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎ExtractCallStack.py‎

Copy file name to clipboardExpand all lines: ExtractCallStack.py
+23-27Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ def run(self, edit):
2626
# Add an end-get for relevant lines
2727
# I.e. Find all internal call getters and add end-gets. This is done by matching line number before the call getter and after the getter method has finished
2828
# Note: This is really ugly, but I couldn't find a better way to do this. Plus it's all done in one line of code
29-
newViewString = re.sub(r'(\d+:.*)(\n.*call getter\s+(?:\w+:?)+\.\w+[\s\S]*?)(.*)(\1)', r'\1\2\3End-Get;', newViewString)
29+
newViewString = re.sub(r'(\d+:.*)(\n.*call getter\s+(?:\w+:?)+\.\w+[\s\S]*?)(.*)(\1)', r'\1\2\3end-get;', newViewString)
3030

3131
# Extract all lines containing start, end, Nest=, call int, call private, call method and End-Function
3232
# Note: we ignore call constructor and call setter
33-
str_list = re.findall(r'(?:(?:.*(?:start|end|resume|reend).*Nest=.*)|(?:.*call (?:int|private|method|getter).*)|.*End-Function.*|.*End-Get.*)', newViewString, re.MULTILINE)
33+
str_list = re.findall(r'(?:(?:.*(?:start|end|resume|reend).*Nest=.*)|(?:.*call (?:int|private|method|getter|setter).*)|.*End-Function.*|.*end-get.*|.*end-set.*)', newViewString, re.MULTILINE)
3434
newViewString = '\n'.join(str_list)
3535

3636
# Get the unique session numbers and store them in a list
@@ -46,7 +46,7 @@ def run(self, edit):
4646
sessionSpecificString = '\n'.join(str_list)
4747

4848
# Remove header junk for each of the lines
49-
str_list = re.findall(r'(?:(?:(?:start|end|resume|reend).*Nest=.*)|(?:call (?:int|private|method|getter).*)|End-Function.*|End-Get.*)', sessionSpecificString, re.MULTILINE)
49+
str_list = re.findall(r'(?:(?:(?:start|end|resume|reend).*Nest=.*)|(?:call (?:int|private|method|getter|setter).*)|End-Function.*|end-get.*|end-set.*)', sessionSpecificString, re.MULTILINE)
5050
sessionSpecificString = '\n'.join(str_list)
5151

5252
# Get all the Nest values and store them in a list and store the lowest Nest value
@@ -79,59 +79,62 @@ def run(self, edit):
7979

8080
if match.group(1) == 'start':
8181
lastCall = 'start'
82-
# PSAPPSRV.3320 (556) 1-32321 10.37.25 0.000000 >>> start Nest=12 DERIVED_ADDR.ADDRESSLONG.RowInit
82+
# E.g. >>> start Nest=12 DERIVED_ADDR.ADDRESSLONG.RowInit
8383
matchExt = re.search(r'start.*Nest=(?:\d+).*?((?:\w+\.?)+)', lineContents)
8484
extContext.append(matchExt.group(1))
8585
if match.group(1) == 'start-ext':
8686
lastCall = 'start'
8787
# keep track of start-ext location so that we can append the location to call private and call int lines
88+
# E.g. >>> start-ext Nest=14 ActivePrograms_SCT SSR_STUDENT_RECORDS.SR_StudentData.StudentActivePrograms.OnExecute
8889
matchExt = re.search(r'start-ext.*Nest=(?:\d+).*\w+\s(.*)', lineContents)
8990
extContext.append(matchExt.group(1))
90-
#print('Added %s' % extContext[-1])
9191
if match.group(1) == 'resume':
9292
lastCall = 'resume'
9393
if match.group(1) == 'end-ext':
9494
lastCall = 'end'
9595
# remove the last element from extContext
96-
#print('Removed %s' % extContext[-1])
9796
extContext.pop()
9897
if match.group(1) == 'end':
9998
lastCall = 'end'
10099
if match.group(1) == 'reend':
101100
lastCall = 'reend'
102101

103102
else:
104-
match = re.search(r'(call (int|setter|getter|private)|End-Function|End-Get)', lineContents)
103+
match = re.search(r'(call (int|setter|getter|private)|End-Function|end-get|end-set)', lineContents)
105104
if match:
106105
# if first 4 chars are 'call'
107106
if match.group(1)[:4] == 'call':
108107

109-
if (lastCall == 'start') or (lastCall == 'resume') or (lastCall == 'callGetter') or (lastCall == 'callPrivate'):
110-
nestLevel= nestLevel + 1
108+
if lastCall in ['start', 'resume'] or (lastCall[:4] == 'call'):
109+
nestLevel = nestLevel + 1
111110

112111
if match.group(1) == 'call getter':
113112
lastCall = 'callGetter'
114113

114+
if match.group(1) == 'call setter':
115+
lastCall = 'callSetter'
116+
# Remove extra space after call setter
117+
# E.g. call setter EO:CA:Address.EditPageHeader #params=3
118+
lineContents = re.sub(r'call setter\s+(\w+.*)', r'call setter \1', lineContents)
115119
if match.group(1) == 'call private':
116120
lastCall = 'callPrivate'
117-
# Now we need to append the last value in extContext
118-
# i.e. extContext[-1]
121+
# Now we need to append the last value in extContext (i.e. extContext[-1])
119122
lineContents = re.sub(r'call private\s+(\w+)', r'call private \1 %s' % extContext[-1], lineContents)
120123
if match.group(1) == 'call int':
121124
lastCall = 'callInt'
122-
# Now we need to append the last value in extContext
123-
# i.e. extContext[-1]
124-
print(lineContents)
125-
#print(extContext[-1])
125+
# Now we need to append the last value in extContext (i.e. extContext[-1])
126126
lineContents = re.sub(r'call int\s+(\w+)', r'call int \1 %s' % extContext[-1], lineContents)
127127
else:
128128
lastCall='call'
129129
else:
130-
if lastCall == 'endFunction':
130+
if match.group(1) == 'End-Function':
131131
lastCall ='endFunction'
132-
else:
132+
if match.group(1) == 'end-get':
133133
# End-Get reached
134134
lastCall = 'endGet'
135+
if match.group(1) == 'end-set':
136+
# End-Get reached
137+
lastCall = 'endSet'
135138

136139
startIndex = 0
137140

@@ -147,10 +150,7 @@ def run(self, edit):
147150
if lastCall[:4] == 'call':
148151
nestLevel = nestLevel + 1
149152

150-
if lastCall == 'endFunction':
151-
nestLevel = nestLevel - 1
152-
153-
if lastCall == 'endGet':
153+
if lastCall in ['endFunction', 'endGet', 'endSet']:
154154
nestLevel = nestLevel - 1
155155

156156
# Remove Nest from each line since we no longer need it
@@ -205,14 +205,14 @@ def run(self, edit):
205205

206206
# Clean lines
207207
# Remove the end-ext, End-Function, resume, end and reend calls, since we no longer need them
208-
str_list = re.findall(r'(?:.*(?:start).*)|.*(?:call (?:int|private|method|getter).*)', sessionSpecificString, re.MULTILINE)
208+
str_list = re.findall(r'(?:.*(?:start).*)|.*(?:call (?:int|private|method|getter|setter).*)', sessionSpecificString, re.MULTILINE)
209209
sessionSpecificString = '\n'.join(str_list)
210210

211211
# Rearrange the call getter so that it is in the same format as all the other calls
212212
sessionSpecificString = re.sub(r'call getter\s+((?:\w+(?::?))+)\.(\w+)', r'call getter \2 \1.OnExecute', sessionSpecificString)
213213

214214
# Remove the start and call int/private/method strings from all lines as these strings are no longer required
215-
#sessionSpecificString = re.sub(r'(start|call (int|private|method|getter)|start-ext)\s+', '', sessionSpecificString)
215+
#sessionSpecificString = re.sub(r'(start|call (int|private|method|getter|setter)|start-ext)\s+', '', sessionSpecificString)
216216

217217
# Remove unnecessary trailer junk (e.g. params= or #params=)
218218
sessionSpecificString = re.sub(r'Dur=.*', '', sessionSpecificString)
@@ -221,10 +221,6 @@ def run(self, edit):
221221
# Replace any colons with dots
222222
sessionSpecificString = re.sub(':', r'.', sessionSpecificString)
223223

224-
# Find all functions (?<=\s)\w+(?=\n)
225-
# Add their location
226-
227-
228224
# We now have the complete callstack for the session
229225
# Insert the call stack in the new view
230226
newViewAllTextRegion = sublime.Region(0, newView.size())

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.