X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.simulation.sequences%2Fscl%2FSimantics%2FSequences.scl;h=e84ca61953d53eba37c1eee7a4d7bc0f1efcc9c0;hp=b2f9ba5fcb99ef1eaaa3ccf32274b64de356f8cf;hb=2dd0e97bbe55e691d86a4254e1495ebddd7d494a;hpb=8bdce2fdc0052ec15c8fb6e5e21173aa325f5c54 diff --git a/bundles/org.simantics.simulation.sequences/scl/Simantics/Sequences.scl b/bundles/org.simantics.simulation.sequences/scl/Simantics/Sequences.scl index b2f9ba5fc..e84ca6195 100644 --- a/bundles/org.simantics.simulation.sequences/scl/Simantics/Sequences.scl +++ b/bundles/org.simantics.simulation.sequences/scl/Simantics/Sequences.scl @@ -5,6 +5,13 @@ effect Action "sequenceAction" "org.simantics.simulation.sequences.action.ActionContext" +importJava "org.simantics.simulation.sequences.action.StopReason" where + data StopReason + STOPPED :: StopReason + SIMULATION_DID_NOT_START :: StopReason + DIVERGED :: StopReason + INTERRUPTED :: StopReason + importJava "org.simantics.simulation.sequences.action.ActionContext" where data ActionContext @@ -21,6 +28,7 @@ importJava "org.simantics.simulation.sequences.action.ActionContext" where scheduleNow :: (() -> a) -> () scheduleNextStep :: (() -> a) -> () scheduleAt :: Double -> (() -> a) -> () + scheduleWhenStopped :: (StopReason -> a) -> () @JavaName stop stop_ :: () @@ -62,6 +70,10 @@ The sequence `execute action` is an instantious sequence that executes the opera execute :: ( a) -> Sequence a execute action = Sequence (\cont -> cont action) +@inline +executeWhenStopped :: (StopReason -> a) -> Sequence () +executeWhenStopped handler = execute (scheduleWhenStopped handler) + """ The sequence `fork seq` is an instantious sequence that creates a new sequence thread behaving like the sequence `seq`. """