titan-debug-yampa-1.0.0: src/FRP/Titan/Debug/Command.hs
module FRP.Titan.Debug.Command where
-- * Commands
-- | An interactive, debugging command.
data Command p = Step -- ^ Control: Execute a complete simulation cycle
| StepUntil p -- ^ Control: Execute cycles until a predicate holds
| SkipUntil p -- ^ Control: Skip cycles until a predicate holds
| SkipSense -- ^ Control: Skip cycle while sensing the input
| Redo -- ^ Control: Re-execute the last step
| SkipBack -- ^ Control: Jump one step back in the simulation
| JumpTo Int -- ^ Control: Jump to a specific frame
| TravelToFrame Int -- ^ Control: Simulate up to a particular frame (not implemented yet)
| DiscardFuture Int -- ^ Control: Simulate up to a particular frame (not implemented yet)
| Exit -- ^ Control: Stop the simulation and exit the program
| Play -- ^ Control: Start executing normally
| Pause -- ^ Control: Pause the simulation
| Stop -- ^ Control: Stop the simulation
| LoadTraceFromFile String -- ^ Control: Load the Trace from a file (not implemented yet)
| LoadTraceFromString String -- ^ Control: Load the Trace from a string (not implemented yet)
| DeleteTrace -- ^ Control: Discard the whole history
| IOSense Int -- ^ Control: Sense input (not implemented yet)
| GetInput Int -- ^ Info: Obtain input at a particular frame
| SetInput Int String -- ^ Info: Change input at a particular frame
| GetGTime Int -- ^ Info: Obtain dtime at a particular frame
| GetDTime Int -- ^ Info: Obtain dtime at a particular frame
| SetDTime Int String -- ^ Info: Change dtime at a particular frame
| GetCurrentFrame -- ^ Info: Obtain the current frame
| GetCurrentTime -- ^ Info: Obtain the current time
| GetMaxTime -- ^ Info: Obtain the last time that has been explored
| GetTrace -- ^ Info: Obtain input at a particular frame
| SummarizeHistory -- ^ Info: Print summary information about the history
| SetPrefDumpInput Bool -- ^ Preferences: Alter simulation preferences
| GetPrefDumpInput -- ^ Preferences: Obtain simulation preferences
| Ping -- ^ Debugging: send a pong back to the GUI
deriving (Eq, Read, Show)
-- | Convenince to show commands in the debug log
showCommand (LoadTraceFromString s) = "LoadTraceFromString <length: " ++ show (length s) ++ " chars>"
showCommand c = show c
-- True if the command should make the simulator stop playing
stopPlayingCommand :: Command p -> Bool
stopPlayingCommand (Step) = True
stopPlayingCommand (StepUntil p) = True
stopPlayingCommand (SkipUntil p) = True
stopPlayingCommand (SkipSense) = True
stopPlayingCommand (Redo) = True
stopPlayingCommand (SkipBack) = True
stopPlayingCommand (JumpTo _) = True
stopPlayingCommand (TravelToFrame _) = True
stopPlayingCommand (DiscardFuture _) = True
stopPlayingCommand (Exit) = True
stopPlayingCommand (Play) = False
stopPlayingCommand (Pause) = True
stopPlayingCommand (Stop) = True
stopPlayingCommand (LoadTraceFromFile _) = True
stopPlayingCommand (LoadTraceFromString _) = True
stopPlayingCommand (DeleteTrace) = True
stopPlayingCommand (IOSense _) = True
stopPlayingCommand (GetInput _ ) = False
stopPlayingCommand (SetInput _ _) = False
stopPlayingCommand (GetGTime _ ) = False
stopPlayingCommand (GetDTime _ ) = False
stopPlayingCommand (SetDTime _ _) = False
stopPlayingCommand (GetCurrentFrame) = False
stopPlayingCommand (GetCurrentTime) = False
stopPlayingCommand (GetTrace) = False
stopPlayingCommand (SummarizeHistory) = False
stopPlayingCommand (SetPrefDumpInput _) = False
stopPlayingCommand (GetPrefDumpInput) = False
stopPlayingCommand (Ping) = False
stopPlayingCommand (GetMaxTime) = False