Skip to content

Commit 0fa8174

Browse files
committed
Fix: Find dependencies of static classes
1 parent 5caf48f commit 0fa8174

13 files changed

+81
-270
lines changed

.Copy2AddInFolder.cmd

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
copy ACLibStructReader.accdb .\access-add-in\ACLibStructReader.accda
2+
timeout 2

access-add-in/ACLibStructReader.accda

-24 KB
Binary file not shown.

source/___TEST.bas

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ End Sub
3939

4040
Private Sub testGetLink()
4141

42-
Debug.Print getLink("abcXYZ")
42+
Debug.Print GetLink("abcXYZ")
4343

4444
End Sub
4545

46-
Private Function getLink(strName As String) As String
46+
Private Function GetLink(strName As String) As String
4747

4848

4949
Dim i As Long
@@ -58,6 +58,6 @@ Private Function getLink(strName As String) As String
5858
i = i + 1
5959
Loop
6060

61-
getLink = strName
61+
GetLink = strName
6262

6363
End Function

source/codelib/_codelib/addins/StructViewer/GraphvizStructViewer.cls

+12-13
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,17 @@ Attribute VB_Creatable = False
88
Attribute VB_PredeclaredId = False
99
Attribute VB_Exposed = False
1010
'---------------------------------------------------------------------------------------
11-
' Class Module: GraphvizStructViewer (Josef Pötzl, 2010-03-23)
11+
' Class: _codelib.addins.StructViewer.GraphvizStructViewer
1212
'---------------------------------------------------------------------------------------
13-
'/**
14-
' <summary>
13+
'
1514
' GraphvizStructViewer
16-
' </summary>
17-
' <remarks>
18-
' </remarks>
1915
'
20-
' @todo Einstellung der Graphviz-Parameter fehlt noch (es gibt noch zu viele Konstanten)
16+
' Remarks:
17+
'
18+
' @todo Setting of Graphviz parameters is still missing (there are still too many constants)
2119
'
22-
'**/
20+
'---------------------------------------------------------------------------------------
21+
2322
'---------------------------------------------------------------------------------------
2423
'<codelib>
2524
' <file>_codelib/addins/StructViewer/GraphvizStructViewer.cls</file>
@@ -89,11 +88,11 @@ Public Sub ReadStruct()
8988

9089
End Sub
9190

92-
Private Function modulReaderExistsInCollection(col As Collection, cmr As CodeModuleReader) As Boolean
91+
Private Function ModulReaderExistsInCollection(col As Collection, cmr As CodeModuleReader) As Boolean
9392
Dim TempModuleReader As CodeModuleReader
9493
For Each TempModuleReader In col
9594
If TempModuleReader.Name = cmr.Name Then
96-
modulReaderExistsInCollection = True
95+
ModulReaderExistsInCollection = True
9796
Exit For
9897
End If
9998
Next
@@ -138,7 +137,7 @@ Private Sub addDOTobjects(ByVal markFirstItem As Boolean)
138137
If collectionItem.Name = "modErrorHandler" Then
139138
strColor = "gray"
140139
End If
141-
m_DOT.AddNode strNodeID, collectionItem.Name, , strColor, strStyle, , , getLink(collectionItem)
140+
m_DOT.AddNode strNodeID, collectionItem.Name, , strColor, strStyle, , , GetLink(collectionItem)
142141
m_DOT.Node(strNodeID).LayoutMode = collectionItem.CodeModule.Parent.Type
143142

144143
If Len(strColor) > 0 Then strColor = vbNullString
@@ -149,7 +148,7 @@ Private Sub addDOTobjects(ByVal markFirstItem As Boolean)
149148

150149
End Sub
151150

152-
Private Function getLink(cmr As CodeModuleReader) As String
151+
Private Function GetLink(cmr As CodeModuleReader) As String
153152

154153
Dim strName As String
155154
Dim i As Long
@@ -180,7 +179,7 @@ Private Function getLink(cmr As CodeModuleReader) As String
180179
' lassen
181180
End Select
182181

183-
getLink = LCase(strName) & ".html"
182+
GetLink = LCase(strName) & ".html"
184183

185184
End Function
186185

source/codelib/_codelib/addins/shared/CodeModuleReader.cls

+11-9
Original file line numberDiff line numberDiff line change
@@ -276,20 +276,22 @@ End Function
276276
'---------------------------------------------------------------------------------------
277277
Public Function ClassUsed(ByVal ClassName As String) As Boolean
278278

279-
Dim SearchString(5) As String
279+
Dim SearchString(6) As String
280280
Dim i As Long
281281
Dim IsUsed As Boolean
282-
Dim MaxCnt As Long
282+
Dim MaxIndex As Long
283283

284284
SearchString(0) = " As " & Trim$(ClassName) & vbNewLine
285285
SearchString(1) = " As " & Trim$(ClassName) & ","
286286
SearchString(2) = " As " & Trim$(ClassName) & " "
287287

288-
MaxCnt = 2
289-
For i = 0 To MaxCnt
290-
SearchString(MaxCnt + 1 + i) = " New " & Mid(SearchString(i), 5)
288+
MaxIndex = 2
289+
For i = 0 To MaxIndex
290+
SearchString(MaxIndex + 1 + i) = " New " & Mid(SearchString(i), 5)
291291
Next
292292

293+
SearchString(6) = " " & Trim$(ClassName) & "." ' to detect the use of static classes
294+
293295
If StrPtr(m_CodeModuleText) = 0 Then
294296
m_CodeModuleText = PlainCodeText
295297
End If
@@ -340,11 +342,11 @@ Public Function ProcedureUsed(ByRef CodeModuleProc As CodeModuleProcedure) As Bo
340342
If StrPtr(m_CodeModuleText) = 0 Then
341343
m_CodeModuleText = PlainCodeText
342344
End If
343-
345+
344346
'Text durchsuchen
345347
For i = LBound(SearchStringArray) To UBound(SearchStringArray)
346-
#If USEREGEX = 1 Then
347-
With RegEx
348+
#If USEREGEXP = 1 Then
349+
With RegExp
348350
.Pattern = SearchStringArray(i)
349351
.Global = False
350352
IsUsed = .Test(m_CodeModuleText)
@@ -395,7 +397,7 @@ Public Function HeaderItemUsed(ByRef HdrItm As CodeModuleHeaderItem) As Boolean
395397

396398
For i = LBound(SearchStringArray) To UBound(SearchStringArray)
397399
#If USEREGEX = 1 Then
398-
With RegEx
400+
With RegExp
399401
.Pattern = SearchStringArray(i)
400402
.Global = False
401403
IsUsed = .Test(m_CodeModuleText)

source/codelib/_codelib/addins/shared/CodeModuleStructReader.cls

+10-11
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Public Sub ReadStruct()
122122
Dim vbc As Object
123123
#End If
124124
Dim TempModuleReader As CodeModuleReader
125-
Dim baseModuleReader As CodeModuleReader
125+
Dim BaseModuleReader As CodeModuleReader
126126

127127
Dim strBaseCodeModuleName As String
128128
Dim lngCount As Long
@@ -137,7 +137,7 @@ Public Sub ReadStruct()
137137
Set TempModuleReader = New CodeModuleReader
138138
Set TempModuleReader.CodeModule = vbc.CodeModule
139139
m_CodeModuleReaderCollection.Add TempModuleReader, TempModuleReader.Name
140-
If TempModuleReader.Name = strBaseCodeModuleName Then Set baseModuleReader = TempModuleReader
140+
If TempModuleReader.Name = strBaseCodeModuleName Then Set BaseModuleReader = TempModuleReader
141141
Next
142142

143143
'Abhängigkeiten ermitteln
@@ -147,7 +147,7 @@ Public Sub ReadStruct()
147147
Next
148148
Else
149149

150-
If baseModuleReader Is Nothing Then
150+
If BaseModuleReader Is Nothing Then
151151
Err.Raise vbObjectError, "ReadStruct", "Das Code-Modul '" & strBaseCodeModuleName & "' wurde nicht gefunden!"
152152
End If
153153

@@ -156,15 +156,15 @@ Public Sub ReadStruct()
156156
Dim checkReader As CodeModuleReader
157157

158158
Set newCol = New Collection
159-
Call baseModuleReader.CheckDependency(, m_CodeModuleReaderCollection)
160-
newCol.Add baseModuleReader, baseModuleReader.Name
159+
Call BaseModuleReader.CheckDependency(, m_CodeModuleReaderCollection)
160+
newCol.Add BaseModuleReader, BaseModuleReader.Name
161161

162162
lngCount = 1
163163
Do While lngCount <= newCol.Count
164164
Set TempModuleReader = newCol(lngCount)
165165
lngCount = lngCount + 1
166166
For Each checkReader In TempModuleReader.RequiredModules
167-
If Not modulReaderExistsInCollection(newCol, checkReader) Then
167+
If Not ModulReaderExistsInCollection(newCol, checkReader) Then
168168
Call checkReader.CheckDependency(, m_CodeModuleReaderCollection)
169169
newCol.Add checkReader, checkReader.Name
170170
End If
@@ -180,18 +180,17 @@ Public Sub ReadStruct()
180180

181181
End Sub
182182

183-
Private Function modulReaderExistsInCollection(col As Collection, cmr As CodeModuleReader) As Boolean
183+
Private Function ModulReaderExistsInCollection(col As Collection, cmr As CodeModuleReader) As Boolean
184184
Dim TempModuleReader As CodeModuleReader
185185
For Each TempModuleReader In col
186186
If TempModuleReader.Name = cmr.Name Then
187-
modulReaderExistsInCollection = True
187+
ModulReaderExistsInCollection = True
188188
Exit For
189189
End If
190190
Next
191191
End Function
192192

193-
194-
Private Function getLink(cmr As CodeModuleReader) As String
193+
Private Function GetLink(cmr As CodeModuleReader) As String
195194

196195
Dim strName As String
197196
Dim i As Long
@@ -222,7 +221,7 @@ Private Function getLink(cmr As CodeModuleReader) As String
222221
' lassen
223222
End Select
224223

225-
getLink = LCase(strName) & ".html"
224+
GetLink = LCase(strName) & ".html"
226225

227226
End Function
228227

source/codelib/api/graphviz/GraphvizDOT.cls

+8-7
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ Attribute VB_Creatable = False
88
Attribute VB_PredeclaredId = False
99
Attribute VB_Exposed = False
1010
'---------------------------------------------------------------------------------------
11-
' Class Module: GraphvizDOT (Josef Pötzl)
11+
' Class: api.graphviz.GraphvizDOT
1212
'---------------------------------------------------------------------------------------
13-
'/**
14-
' <summary>
13+
'
1514
' GraphvizDOT
16-
' </summary>
17-
' <remarks>
18-
' </remarks>
19-
'**/
15+
'
16+
' Author:
17+
' Josef Poetzl
18+
'
19+
'---------------------------------------------------------------------------------------
20+
2021
'---------------------------------------------------------------------------------------
2122
'<codelib>
2223
' <file>api/graphviz/GraphvizDOT.cls</file>

source/codelib/api/graphviz/GraphvizDOTconnection.cls

+9-8
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ Attribute VB_Creatable = False
88
Attribute VB_PredeclaredId = False
99
Attribute VB_Exposed = False
1010
'---------------------------------------------------------------------------------------
11-
' Class Module: GraphvizDOTconnection (Josef Pötzl)
11+
' Class: api.graphviz.GraphvizDOTconnection
1212
'---------------------------------------------------------------------------------------
13-
'/**
14-
' <summary>
15-
' Graphviz-Verbindung zw. zwei Knoten
16-
' </summary>
17-
' <remarks>
18-
' </remarks>
19-
'**/
13+
'
14+
' Graphviz connection between two nodes
15+
'
16+
' Author:
17+
' Josef Poetzl
18+
'
19+
'---------------------------------------------------------------------------------------
20+
2021
'---------------------------------------------------------------------------------------
2122
'<codelib>
2223
' <file>api/graphviz/GraphvizDOTconnection.cls</file>

source/codelib/api/graphviz/GraphvizDOTgraph.cls

+10-8
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@ Attribute VB_Creatable = False
88
Attribute VB_PredeclaredId = False
99
Attribute VB_Exposed = False
1010
'---------------------------------------------------------------------------------------
11-
' Class Module: GraphvizDOTgraph (Josef Pötzl)
11+
' Class: api.graphviz.GraphvizDOTgraph
1212
'---------------------------------------------------------------------------------------
13-
'/**
14-
' <summary>
15-
' Klasse zum Erstellen der Graphviz-Graph-Definition
16-
' </summary>
17-
' <remarks>
18-
' </remarks>
19-
'**/
13+
'
14+
' Class for creating the graphviz graph definition
15+
'
16+
'
17+
' Author:
18+
' Josef Poetzl
19+
'
20+
'---------------------------------------------------------------------------------------
21+
2022
'---------------------------------------------------------------------------------------
2123
'<codelib>
2224
' <file>api/graphviz/GraphvizDOTgraph.cls</file>

source/codelib/api/graphviz/GraphvizDOTnode.cls

+9-8
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ Attribute VB_Creatable = False
88
Attribute VB_PredeclaredId = False
99
Attribute VB_Exposed = False
1010
'---------------------------------------------------------------------------------------
11-
' Class Module: GraphvizDOTnode (Josef Pötzl)
11+
' Class: api.graphviz.GraphvizDOTnode
1212
'---------------------------------------------------------------------------------------
13-
'/**
14-
' <summary>
15-
' Graphviz-Knoten
16-
' </summary>
17-
' <remarks>
18-
' </remarks>
19-
'**/
13+
'
14+
' Graphviz node
15+
'
16+
' Author:
17+
' Josef Poetzl
18+
'
19+
'---------------------------------------------------------------------------------------
20+
2021
'---------------------------------------------------------------------------------------
2122
'<codelib>
2223
' <file>api/graphviz/GraphvizDOTnode.cls</file>

source/codelib/api/winapi/modWinAPI_Registry.bas

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ Attribute VB_Name = "modWinAPI_Registry"
55
'
66
' Access to Windows Registry
77
'
8+
' Author:
9+
' Josef Poetzl
10+
'
811
'---------------------------------------------------------------------------------------
912

1013
'---------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)