-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathAsyncCall.cls
More file actions
254 lines (230 loc) · 6.73 KB
/
Copy pathAsyncCall.cls
File metadata and controls
254 lines (230 loc) · 6.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "AsyncCall"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Event Complete(x As Long)
Public Function CallEventFromGui(gui As Object, a As mEvent, aString$) As Boolean
Dim tr As Boolean, extr As Boolean, olescok As Boolean
olescok = escok
escok = False
extr = extreme
extreme = True
tr = trace
If Rnd * 100 > 3 Then trace = False
On Error Resume Next
CallEventFromGui = True
Dim n$, f$, bb As mStiva, oldbstack As mStiva, nowtotal As Long
Dim bstack As basetask
Set bstack = basestack1
bstack.IamAnEvent = True
Dim i As Long
If a Is Nothing Then GoTo conthere1
i = a.VarIndex
bstack.soros.DataStr aString$
If gui.index >= 0 Then
bstack.soros.DataVal gui.index
End If
bstack.soros.DataObj gui
Set oldbstack = bstack.soros
Dim j As Long, s1$, klm As Long
Dim ohere$
ohere$ = here$
For j = 0 To a.Count - 1
here$ = "EV" + CStr(i) + "." + CStr(j)
If a.enabled Then
a.ReadVar j, n$, f$
If f$ <> "" Then
Set bb = New mStiva
Set bstack.Sorosref = bb
bb.Copy2TopNItems2FromStiva a.params, oldbstack
PushStage bstack, False
s1$ = Mid$(f$, 2, rinstr(f$, "}") - 2)
klm = GlobalSub("A_()", s1$, Trim$(Mid$(f$, Len(s1$) + 3)))
If Not ProcModuleEntry(bstack, "A_()", klm, "") Then
PopStage bstack
bb.Flush
GoTo conthere
End If
PopStage bstack
bb.Flush
End If
End If
Next j
conthere:
Set bstack.Sorosref = oldbstack
Set oldbstack = Nothing
bstack.soros.drop a.params
Set bb = Nothing
here$ = ohere$
conthere1:
extreme = extr
If tr Then
'If STEXIT Then trace = tr
trace = tr
End If
escok = olescok
RaiseEvent Complete(3)
End Function
Public Function CallEventFromGuiOne(gui As Object, a As mEvent, aString$) As Boolean
Dim tr As Boolean, extr As Boolean, olescok As Boolean
CallEventFromGuiOne = True
olescok = escok
escok = False
tr = trace
extr = extreme
extreme = True
If Rnd * 100 > 3 Then trace = False
Dim n$, f$, F1$, bb As mStiva, uIndex As Long
Dim bstack As basetask
Set bstack = New basetask
Set bstack.Owner = Form1.DIS
bstack.IamAnEvent = True
Dim i As Long
If a Is Nothing Then GoTo conthere0
i = a.VarIndex
uIndex = gui.index
If uIndex >= 0 Then
bstack.soros.DataVal CDbl(uIndex)
uIndex = 1
End If
uIndex = uIndex + 1
F1$ = gui.modulename$
bstack.soros.DataObj gui
Dim j As Long, k As Long, s1$, klm As Long, s2$
Dim ohere$
ohere$ = here$
here$ = "EV" + CStr(i)
If a.enabled Then
PushStage bstack, False
IsLabelOnly (aString$), f$
n$ = Mid$(aString$, Len(f$) + 1)
n$ = Left$(n$, Len(n$) - 1)
If n$ <> "" Then
If uIndex > 0 Then
n$ = "Data " + n$ + " : ShiftBack Stack.Size" + Str(1 - uIndex) + "," + Str$(uIndex) + vbCrLf
Else
n$ = "Data " + n$ + " : ShiftBack Stack.Size" + vbCrLf
End If
End If
If F1$ <> "" Then f$ = myUcase(F1$ + "." + f$ + ")", True) Else f$ = myUcase(f$ + ")", True)
If Not GetSub(f$, klm) Then PopStage bstack: CallEventFromGuiOne = False: GoTo conthere
s1$ = sbf(klm).sb
If Left$(s1$, 10) = "'11001EDIT" Then
SetNextLine s1$
End If
If F1$ <> "" Then s1$ = n$ + "Module " + F1$ + vbCrLf + sbf(klm).sb Else s1$ = n$ + sbf(klm).sb
If Execute(bstack, s1$, False, False) <> 1 Then
bstack.soros.Flush
PopStage bstack
GoTo conthere
End If
PopStage bstack
End If
conthere:
Set bstack = Nothing
here$ = ohere$
conthere0:
If tr Then
'If STEXIT Then
trace = tr
End If
extreme = extr
escok = olescok
RaiseEvent Complete(2)
End Function
Public Function CallEventFromGuiNow(gui As Object, a As mEvent, aString$, vrs()) As Boolean
Dim tr As Boolean, extr As Boolean, olescok As Boolean
olescok = escok
escok = False
CallEventFromGuiNow = True
extr = extreme
extreme = True
tr = trace
If Rnd * 100 > 3 Then trace = False
Dim n$, f$, F1$, bb As mStiva, oldbstack As mStiva, nowtotal As Long
Dim bstack As basetask
Set bstack = New basetask
Set bstack.Owner = Form1.DIS
bstack.IamAnEvent = True
Dim i As Long
If a Is Nothing Then GoTo conthere0
i = a.VarIndex
F1$ = gui.modulename$
Set oldbstack = bstack.soros
Dim j As Long, k As Long, s1$, klm As Long, s2$
Dim ohere$
ohere$ = here$
'For j = 0 To a.Count - 1
here$ = "EV" + CStr(i)
If a.enabled Then
a.ReadVar 0, n$, f$
If f$ <> "" Then
Set bb = New mStiva
Set bstack.Sorosref = bb
PushStage bstack, False
For k = LBound(vrs()) To UBound(vrs()) - 1
If VarType(vrs(k)) = vbString Then
GlobalVar "EV" + CStr(i + k) + "$", vrs(k)
bb.DataStr here$ + "." + "EV" + CStr(i + k) + "$"
Else
GlobalVar "EV" + CStr(i + k), vrs(k)
bb.DataStr here$ + "." + "EV" + CStr(i + k)
End If
Next k
bb.DataObj gui
IsLabelOnly (aString$), f$
n$ = Mid$(aString$, Len(f$) + 1)
If Len(n$) > 0 Then
n$ = Left$(n$, Len(n$) - 1)
If n$ <> "" Then n$ = "Push " + n$ + vbCrLf
End If
If F1$ <> "" Then f$ = myUcase(F1$ + "." + f$ + ")", True) Else f$ = myUcase(f$ + ")", True)
If Not GetSub(f$, klm) Then PopStage bstack: bb.Flush: CallEventFromGuiNow = False: GoTo conthere
'' look for '11001EDIT
s1$ = sbf(klm).sb
If Left$(s1$, 10) = "'11001EDIT" Then
SetNextLine s1$
End If
If F1$ <> "" Then s1$ = n$ + "Module " + F1$ + vbCrLf + sbf(klm).sb Else s1$ = n$ + sbf(klm).sb
If Execute(bstack, s1$, False, False) <> 1 Then
PopStage bstack
bb.Flush
GoTo conthere
End If
here$ = "EV" + CStr(i)
For k = LBound(vrs()) To UBound(vrs()) - 1
If VarType(vrs(k)) = vbString Then
GetlocalVar "EV" + CStr(i + k) + "$", j
vrs(k) = var(j)
Else
GetlocalVar "EV" + CStr(i + k), j
vrs(k) = var(j)
End If
Next k
PopStage bstack
bb.Flush
End If
End If
conthere:
Set bstack.Sorosref = oldbstack
here$ = ohere$
conthere0:
Set oldbstack = Nothing
Set bb = Nothing
If tr Then
'If STEXIT Then trace = tr
trace = tr
End If
extreme = extr
escok = olescok
RaiseEvent Complete(1)
End Function