This repository has been archived by the owner on Sep 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.c
65 lines (60 loc) · 1.42 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* @todo define how config will work with the system and the basic structure
* @todo get a basic libevent implementation working
*/
#include "fsm.h"
#include "confpar.h"
#include<stdio.h>
void abc(struct fsm_object *obj, int val,void **arg)
{
#ifdef DEBUG
fprintf(stderr,"In default State\n");
#endif
// state -> default
printf("%d\n",val);
printf("%s\n",obj->fsm_cur_state_name);
fsm_to_state(obj,"hello",0,NULL);
}
void pqr(struct fsm_object *obj, int val,void **arg)
{
#ifdef DEBUG
fprintf(stderr,"In qwerty State\n");
#endif
// state -> qwerty
printf("%d\n",val);
printf("%s\n",obj->fsm_cur_state_name);
fsm_to_state(obj,"default",0,NULL);
}
void xyz(struct fsm_object *obj, int val,void **arg)
{
#ifdef DEBUG
fprintf(stderr,"In hello State\n");
#endif
// state -> hello
printf("%d\n",val);
printf("%s\n",obj->fsm_cur_state_name);
// fsm_terminate(obj);
fsm_to_state(obj,"qwerty",0,NULL);
}
/*
int main()
{
// create FSM object
struct fsm_object obj;
// initialize it
fsm_init(&obj);
// set default function
fsm_default(&obj,abc);
// add more states
fsm_add(&obj,"qwerty",pqr);
fsm_add(&obj,"hello",xyz);
// starte the main FSM loop
//fsm_main(&obj);
fsm_main(NULL);
confpar_t conf;
confpar_object_init(&conf);
conf.filepath = "abc.xml";
confpar_update(&conf);
return 0;
}
*/