;ELC   
;;; Compiled
;;; in Emacs version 31.0.50
;;; with all optimizations.


#@1102 Defines a state machine with name NAME, STATES and TRANSITIONS between
them. If INITIAL-STATE is nil, the first state will be used.

Arguments are specified as keyword/argument pairs. The following
arguments are defined:

:states LIST -- LIST should be a list of symbols each representing a
state. LIST will not be evaluated.

:transitions ALIST -- ALIST should be an alist of the form (FROM . TO)
where both FROM and TO are names of states available in the :states LIST.

:handlers ALIST -- ALIST should be an alist of the form (STATE .
HANDLER) where STATE is one of the states in the :states LIST and
HANDLER is a function that can be called by funcall. It is advised to
provide a handler for all of the state, because an error will be
signalled if you try to step on a state with no handler.

The following optional arguments are defined:

:initial-state SYMBOL -- If SYMBOL is non-nil and present in the :states
LIST, it will be set as the initial state of this state machine.
Otherwise, the first state in the :states LIST will be used.

(fn NAME &key INITIAL-STATE STATES TRANSITIONS HANDLERS)
(require 'cl-lib)
(defalias 'ssm-defstate-machine '(macro . #[385 "\300!\301\302\"\301\303\"\301\304\"\301\305\"\211\204 \210@\306\"\204+ \307\310\311D\312$\210\211\203D \211@\306@\"\204? \307\313!\210\210A\202, \210\211\203j \211@\306@\"\203^ \306A\"\204e \307\314\315\312\211$\210\210A\202F \210\316\317P!\316\320P!\316\321P!\316\322P!\316	\323P!\316\n\324P!\316\325P!\326\327\330D\331\332QF\327\330D\333\334QF\327\330D\335\332QF\327\312\336\332QF\327\330D\337\340QF\341\342!\341\343!\344\312\345\346\300!\347\300!\350\260\351\352EDDD\353\354BB\355	\330DE\353\306\356E\357BBB\360BB\257\257\344\361\362\363\300!\364\260\353\306\356\365BB\357BBB\366BB\367\370\371BBBB\257D\266\202BBBBBB\207" [symbol-name plist-get :states :transitions :handlers :initial-state cl-find cl--assertion-failed (cl-find initial-state states) "Cannot find the initial state in the state list." nil (cl-find (car entry) states) (and (cl-find (car entry) states) (cl-find (cdr entry) states)) "Invalid transition: Either the source or the target state does not exist." intern "-state-table" "-transition-table" "-current-state" "-state-data" "-step" "-set-state" "-state-handlers" progn defvar quote "The state table of the " " state machine." "The transitions table of the " " state machine.\n\nEach entry of this alist has the form (FROM . TO)." "The current state of the " "The data of the current state of the " "An alist mapping states of the " " state machine to their respective handlers." make-symbol "handler" "prev-state" defun "The stepping function of the " " state machine.\n\nIt tries to find a handler for the current state (see `" "' and\n`" "'),and then call it with the name of this state machine\nas its only argument." let alist-get cl-assert (nil "There is no handler for the current state") funcall cons (:test 'equal) ("Invalid state transition. State machine is now in inconsistent state.") (state &optional new-data) "Sets the state of " " state machine. Signals an error if the state transition\nis invalid, see `" "' for a list of valid transitions." (state) (t "Invalid state transition.") setq state (new-data)] 35 (#$ . 88)]))#@135 Updates the state of the state machine MACHINE. Signals an error if the
state transition is invalid.

(fn MACHINE NEW-STATE NEW-DATA)
(byte-code "\300\301\302\303#\300\207" [function-put ssm-defstate-machine lisp-indent-function defun] 4)
(defalias 'ssm-update-state #[771 "\300\301!\302P!\211\"\207" [intern-soft symbol-name "-set-state"] 7 (#$ . 3438)])#@59 Returns the state of the specified machine.

(fn MACHINE)
(defalias 'ssm-get-state #[257 "\300\301!\302P!\211J\207" [intern-soft symbol-name "-current-state"] 4 (#$ . 3802)])#@64 Returns the state data of the specified machine.

(fn MACHINE)
(defalias 'ssm-get-state-data #[257 "\300\301!\302P!\211J\207" [intern-soft symbol-name "-state-data"] 4 (#$ . 3983)])#@78 Steps the specified MACHINE until it enters state STATE.

(fn MACHINE STATE)
(defalias 'ssm-run-until-state #[514 "\300\301!\302P!\303!\232?\205 \211 \210\202 \207" [intern-soft symbol-name "-step" ssm-get-state] 5 (#$ . 4171)])
(provide 'simple-state-machines)
