-
Notifications
You must be signed in to change notification settings - Fork 20
/
stringswitch_impl_lcm_cmdaimove.c
118 lines (117 loc) · 4.28 KB
/
stringswitch_impl_lcm_cmdaimove.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
typedef enum {
stringswitch_enumerator_default_member_name(lcm_cmdaimove),
stringswitch_enumerator_member_name(lcm_cmdaimove, star),
stringswitch_enumerator_member_name(lcm_cmdaimove, bomb),
stringswitch_enumerator_member_name(lcm_cmdaimove, chase),
stringswitch_enumerator_member_name(lcm_cmdaimove, avoid),
stringswitch_enumerator_member_name(lcm_cmdaimove, biker),
stringswitch_enumerator_member_name(lcm_cmdaimove, arrow),
stringswitch_enumerator_member_name(lcm_cmdaimove, normal),
stringswitch_enumerator_member_name(lcm_cmdaimove, chasex),
stringswitch_enumerator_member_name(lcm_cmdaimove, chasez),
stringswitch_enumerator_member_name(lcm_cmdaimove, avoidx),
stringswitch_enumerator_member_name(lcm_cmdaimove, avoidz),
stringswitch_enumerator_member_name(lcm_cmdaimove, wander),
stringswitch_enumerator_member_name(lcm_cmdaimove, nomove),
} stringswitch_enumerator_name(lcm_cmdaimove);
static int stringswitch_enumerator_eval_func(lcm_cmdaimove) (char* str, size_t l) {
switch(l) {
case 4:
switch(str[0]) {
case 's':
if(str[1]!='t') goto main_default;
if(str[2]!='a') goto main_default;
if(str[3]!='r') goto main_default;
return stringswitch_enumerator_member_name(lcm_cmdaimove, star);
case 'b':
if(str[1]!='o') goto main_default;
if(str[2]!='m') goto main_default;
if(str[3]!='b') goto main_default;
return stringswitch_enumerator_member_name(lcm_cmdaimove, bomb);
default: goto main_default;
}
case 5:
switch(str[0]) {
case 'c':
if(str[1]!='h') goto main_default;
if(str[2]!='a') goto main_default;
if(str[3]!='s') goto main_default;
if(str[4]!='e') goto main_default;
return stringswitch_enumerator_member_name(lcm_cmdaimove, chase);
case 'a':
switch(str[1]) {
case 'v':
if(str[2]!='o') goto main_default;
if(str[3]!='i') goto main_default;
if(str[4]!='d') goto main_default;
return stringswitch_enumerator_member_name(lcm_cmdaimove, avoid);
case 'r':
if(str[2]!='r') goto main_default;
if(str[3]!='o') goto main_default;
if(str[4]!='w') goto main_default;
return stringswitch_enumerator_member_name(lcm_cmdaimove, arrow);
default: goto main_default;
}
case 'b':
if(str[1]!='i') goto main_default;
if(str[2]!='k') goto main_default;
if(str[3]!='e') goto main_default;
if(str[4]!='r') goto main_default;
return stringswitch_enumerator_member_name(lcm_cmdaimove, biker);
default: goto main_default;
}
case 6:
switch(str[0]) {
case 'n':
if(str[1]!='o') goto main_default;
switch(str[2]) {
case 'r':
if(str[3]!='m') goto main_default;
if(str[4]!='a') goto main_default;
if(str[5]!='l') goto main_default;
return stringswitch_enumerator_member_name(lcm_cmdaimove, normal);
case 'm':
if(str[3]!='o') goto main_default;
if(str[4]!='v') goto main_default;
if(str[5]!='e') goto main_default;
return stringswitch_enumerator_member_name(lcm_cmdaimove, nomove);
default: goto main_default;
}
case 'c':
if(str[1]!='h') goto main_default;
if(str[2]!='a') goto main_default;
if(str[3]!='s') goto main_default;
if(str[4]!='e') goto main_default;
switch(str[5]) {
case 'x':
return stringswitch_enumerator_member_name(lcm_cmdaimove, chasex);
case 'z':
return stringswitch_enumerator_member_name(lcm_cmdaimove, chasez);
default: goto main_default;
}
case 'a':
if(str[1]!='v') goto main_default;
if(str[2]!='o') goto main_default;
if(str[3]!='i') goto main_default;
if(str[4]!='d') goto main_default;
switch(str[5]) {
case 'x':
return stringswitch_enumerator_member_name(lcm_cmdaimove, avoidx);
case 'z':
return stringswitch_enumerator_member_name(lcm_cmdaimove, avoidz);
default: goto main_default;
}
case 'w':
if(str[1]!='a') goto main_default;
if(str[2]!='n') goto main_default;
if(str[3]!='d') goto main_default;
if(str[4]!='e') goto main_default;
if(str[5]!='r') goto main_default;
return stringswitch_enumerator_member_name(lcm_cmdaimove, wander);
default: goto main_default;
}
default:
main_default:
return stringswitch_enumerator_default_member_name(lcm_cmdaimove);
}
}