-
Notifications
You must be signed in to change notification settings - Fork 1
/
statex_123.c
104 lines (95 loc) · 2.74 KB
/
statex_123.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/***************************************************************************
* Copyright (C) 2017 - 2020, Lanka Hsu, <lankahsu@gmail.com>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "utilx9.h"
void sys_init2_cb(StateXFn_t *fn_link, void *data)
{
DBG_ER_LN(DBG_TXT_ENTER);
}
void sys_free2_cb(StateXFn_t *fn_link, void *data)
{
DBG_ER_LN(DBG_TXT_ENTER);
}
void sys_leave2_cb(StateXFn_t *fn_link, void *data)
{
DBG_ER_LN(DBG_TXT_ENTER);
}
void sys_enter2_cb(StateXFn_t *fn_link, void *data)
{
DBG_ER_LN(DBG_TXT_ENTER);
}
void sys_init1_cb(StateXFn_t *fn_link, void *data)
{
DBG_ER_LN(DBG_TXT_ENTER);
}
void sys_free1_cb(StateXFn_t *fn_link, void *data)
{
DBG_ER_LN(DBG_TXT_ENTER);
}
void sys_leave1_cb(StateXFn_t *fn_link, void *data)
{
DBG_ER_LN(DBG_TXT_ENTER);
}
void sys_enter1_cb(StateXFn_t *fn_link, void *data)
{
DBG_ER_LN(DBG_TXT_ENTER);
}
void sys_init0_cb(StateXFn_t *fn_link, void *data)
{
DBG_ER_LN(DBG_TXT_ENTER);
}
void sys_free0_cb(StateXFn_t *fn_link, void *data)
{
DBG_ER_LN(DBG_TXT_ENTER);
}
void sys_leave0_cb(StateXFn_t *fn_link, void *data)
{
DBG_ER_LN(DBG_TXT_ENTER);
}
void sys_enter0_cb(StateXFn_t *fn_link, void *data)
{
DBG_ER_LN(DBG_TXT_ENTER);
}
StateXFn_t sys_fn_links[] =
{
// action, init_cb, free_cb, leave_cb, enter_cb
{0, -1, ACTION_ID_OFF, sys_init0_cb, sys_free0_cb, sys_leave0_cb, sys_enter0_cb},
{1, -1, ACTION_ID_OFF, sys_init1_cb, sys_free1_cb, sys_leave1_cb, sys_enter1_cb},
{2, -1, ACTION_ID_OFF, sys_init2_cb, sys_free2_cb, sys_leave2_cb, sys_enter2_cb},
{3, -1, ACTION_ID_OFF, NULL, NULL, NULL, NULL}, /* terminator */
};
StateX_t statex_sys =
{
.fn_last = NULL,
.fn_links = sys_fn_links,
.dbg_more = DBG_LVL_MAX,
};
int main(int argc, char* argv[])
{
DBG_TR_LN("enter");
statex_open(&statex_sys, "sys");
statex_push(&statex_sys, 2, SUBITEM_ID_NONE, ACTION_ID_ON, ACTION_RUN_ID_NORMAL);
statex_push(&statex_sys, 0, SUBITEM_ID_NONE, ACTION_ID_ON, ACTION_RUN_ID_NORMAL);
//statex_add(&statex_sys, 1, SUBITEM_ID_NONE, ACTION_ID_ON, ACTION_RUN_ID_NORMAL);
//statex_add(&statex_sys, 0, SUBITEM_ID_NONE, ACTION_ID_OFF, ACTION_RUN_ID_NORMAL);
//statex_add(&statex_sys, 1, SUBITEM_ID_NONE, ACTION_ID_OFF, ACTION_RUN_ID_NORMAL);
int retry = 4;
while (retry>0)
{
sleep(1);
retry--;
}
statex_close(&statex_sys);
exit(0);
}