modifications for ease/pardef

This commit is contained in:
zolliker
2005-09-05 08:02:08 +00:00
parent e23dfd8097
commit 5b25f75fc9
2 changed files with 93 additions and 43 deletions

22
fsm.h
View File

@ -38,7 +38,7 @@ typedef long (*FsmFunc)(long pc, void *obj);
#define FSM_WAIT(DELTA) FsmWait(DELTA); return __LINE__; case __LINE__:
/* waiting DELTA seconds */
#define FSM_CALL(FUNC) return FsmCall(__LINE__, (FsmFunc)FUNC); case __LINE__:
#define FSM_CALL(FUNC) return FsmCallOld(__LINE__, (FsmFunc)FUNC); case __LINE__:
/* call a task subfunction */
typedef int (*FsmHandler)(void *obj);
@ -48,6 +48,9 @@ typedef int (*FsmHandler)(void *obj);
Fsm *FsmStartTask(void *obj, FsmHandler handler, FsmFunc func);
/* start a task and return a pointer to it */
void FsmRestartTask(Fsm *task, FsmFunc func);
/* restart a stopped task */
int FsmTaskHandler(Fsm *task);
/* this is the task handler.
the argument should be the pointer obtained from FsmStartTask
@ -56,11 +59,22 @@ int FsmTaskHandler(Fsm *task);
int FsmStop(Fsm *task, FsmFunc func);
/* stop a function. returns to the caller next time */
void FsmPause(Fsm *this, int pause);
void FsmStopTask(Fsm *task);
/* stops the task, it will be killed after next execution */
void FsmKill(void *task);
/* kill the task */
void FsmPause(Fsm *task, int pause);
/* pause=1: pause task, pause=0: continue task */
long FsmCall(long pc, FsmFunc func);
void FsmWait(long delay);
long FsmCallOld(long pc, FsmFunc func);
/* these functions are used in fsm macros and must not be called directly */
void FsmCall(FsmFunc func);
void FsmWait(long delay);
void FsmSpeed(Fsm *task);
#endif