queryInterrupt
interrupt a computation in OpenMaple
Calling Sequence
Parameters
Description
Examples
queryInterrupt(data)
data
-
user_data pointer passed to StartMaple ()
This OpenMaple function is part of the MapleCallBack structure passed as an argument to StartMaple.
The queryInterrupt function allows the user to halt computation. This function is called before each Maple statement is executed. In general, this occurs hundreds of times per second. For some operations (notably large integer manipulations), the queryInterrupt function is called only every few seconds.
The prototype for the function that you can assign to the entry in the MapleCallBack must look like the following.
Function QueryInterrupt(ByVal data As Long) As Long
To halt the computation, the function must return True. To continue the computation, the function must return False.
The data parameter contains the same data as passed to StartMaple in the user_data parameter.
Public ShouldStop As Boolean
ShouldStop = False
Public Function QueryInterrupt(ByVal data As Long) As Long
If ShouldStop Then
MainForm.StopButton.Caption = "Stop"
QueryInterrupt = True
Else
QueryInterrupt = False
End If
End Function
Private Sub StopButton_Click()
If Screen.MousePointer = vbHourglass Then
ShouldStop = True
StopButton.Caption = "Stopping ..."
End Sub
' assignment to MapleCallback entry
cb.lpQueryInterrupt = GetProc(AddressOf QueryInterrupt)
' test statement that will invoke the CallBackCallBack
EvalMapleStatement kv, "do end do;" 'infinite loop
See Also
callBackCallBack
errorCallBack
OpenMaple
OpenMaple/VB/API
OpenMaple/VB/Examples
readLineCallBack
redirectCallBack
StartMaple
statusCallBack
streamCallBack
textCallBack
Download Help Document