queryInterrupt - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


queryInterrupt

interrupt a computation in OpenMaple

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

queryInterrupt(data)

Parameters

data

-

user_data pointer passed to StartMaple ()

Description

• 

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.

Examples

Public ShouldStop As Boolean

ShouldStop = False

Public Function QueryInterrupt(ByVal data As Long) As Long

   If ShouldStop Then

       MainForm.StopButton.Caption = "Stop"

       ShouldStop = False

       QueryInterrupt = True

   Else

       QueryInterrupt = False

   End If

End Function

Private Sub StopButton_Click()

   If Screen.MousePointer = vbHourglass Then

       ShouldStop = True

       StopButton.Caption = "Stopping ..."

   End If

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