gv_fsm 0.3.0 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/templates.rb +46 -43
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f34dd73aaf8611ca0a8b68cc0aee0865882d7c1076042cc4c5c2c08467cee438
|
4
|
+
data.tar.gz: bd19a372f3b1203517a4df93ec180c71497aea2191c771a79113a166cda0c249
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5fc2326e49e95d653bf643e7aae2ae240947def1a67738eade81bb202840e59d3e6f0fdb5dd4d056f5b987b23f565fdff9c40da62feecfe719adafc0aba59c5
|
7
|
+
data.tar.gz: 2a21bd10846daee821d0c43ef1244f0b4a982f0e89c182459711c542e20e1c1ae576bfc595b84ce4724a27378ce1152bce51599721468d1b9b772b460f7a3ffa
|
data/lib/templates.rb
CHANGED
@@ -49,7 +49,7 @@ module GV_FSM
|
|
49
49
|
} <%= @prefix %>state_t;
|
50
50
|
|
51
51
|
// State human-readable names
|
52
|
-
extern const char
|
52
|
+
extern const char *<%= @prefix %>state_names[];
|
53
53
|
|
54
54
|
<% if transition_functions_list.count > 0 then %>
|
55
55
|
// State function and state transition prototypes
|
@@ -115,9 +115,11 @@ module GV_FSM
|
|
115
115
|
#include <signal.h>
|
116
116
|
static int _exit_request = 0;
|
117
117
|
static void signal_handler(int signal) {
|
118
|
-
if (signal == SIGINT)
|
119
|
-
|
120
|
-
|
118
|
+
if (signal == SIGINT) {
|
119
|
+
_exit_request = 1;<% if log == :syslog then %>
|
120
|
+
syslog(LOG_WARNING, "[FSM] SIGINT transition to <%= sigint %>");<% elsif log == :ino then %>
|
121
|
+
Serial.println("[FSM] SIGINT transition to <%= sigint %>");<% end %>
|
122
|
+
}
|
121
123
|
}
|
122
124
|
|
123
125
|
<% end %>
|
@@ -126,7 +128,7 @@ module GV_FSM
|
|
126
128
|
|
127
129
|
// GLOBALS
|
128
130
|
// State human-readable names
|
129
|
-
const char
|
131
|
+
const char *<%= @prefix %>state_names[] = {<%= states_list.map {|sn| '"'+sn+'"'}.join(", ") %>};
|
130
132
|
|
131
133
|
// List of state functions
|
132
134
|
<% fw = state_functions_list.max {|a, b| a.length <=> b.length}.length %>
|
@@ -151,18 +153,18 @@ module GV_FSM
|
|
151
153
|
// No transition functions
|
152
154
|
<% end %>
|
153
155
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
156
|
+
/* ____ _ _
|
157
|
+
* / ___|| |_ __ _| |_ ___
|
158
|
+
* \\___ \\| __/ _` | __/ _ \\
|
159
|
+
* ___) | || (_| | || __/
|
160
|
+
* |____/ \\__\\__,_|\\__\\___|
|
161
|
+
*
|
162
|
+
* __ _ _
|
163
|
+
* / _|_ _ _ __ ___| |_(_) ___ _ __ ___
|
164
|
+
* | |_| | | | '_ \\ / __| __| |/ _ \\| '_ \\/ __|
|
165
|
+
* | _| |_| | | | | (__| |_| | (_) | | | \\__ \\
|
166
|
+
* |_| \\__,_|_| |_|\\___|\\__|_|\\___/|_| |_|___/
|
167
|
+
*/
|
166
168
|
<% dest = destinations.dup %>
|
167
169
|
<% topo = self.topology %>
|
168
170
|
<% @states.each do |s| %>
|
@@ -194,10 +196,10 @@ module GV_FSM
|
|
194
196
|
break;
|
195
197
|
default:
|
196
198
|
<% if log == :syslog then %>
|
197
|
-
syslog(LOG_WARNING, "[FSM] Cannot pass from <%= s[:id] %> to %s, remaining in this state", state_names[next_state]);
|
199
|
+
syslog(LOG_WARNING, "[FSM] Cannot pass from <%= s[:id] %> to %s, remaining in this state", <%= @prefix %>state_names[next_state]);
|
198
200
|
<% elsif log == :ino then %>
|
199
201
|
Serial.print("[FSM] Cannot pass from <%= s[:id] %> to ");
|
200
|
-
Serial.print(state_names[next_state]);
|
202
|
+
Serial.print(<%= @prefix %>state_names[next_state]);
|
201
203
|
Serial.println(", remaining in this state");
|
202
204
|
<% end %>
|
203
205
|
next_state = <%= @prefix.upcase %>NO_CHANGE;
|
@@ -212,18 +214,18 @@ module GV_FSM
|
|
212
214
|
<% end %>
|
213
215
|
|
214
216
|
<% if transition_functions_list.count > 0 then %>
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
217
|
+
/* _____ _ _ _
|
218
|
+
* |_ _| __ __ _ _ __ ___(_) |_(_) ___ _ __
|
219
|
+
* | || '__/ _` | '_ \\/ __| | __| |/ _ \\| '_ \\
|
220
|
+
* | || | | (_| | | | \\__ \\ | |_| | (_) | | | |
|
221
|
+
* |_||_| \\__,_|_| |_|___/_|\\__|_|\\___/|_| |_|
|
222
|
+
*
|
223
|
+
* __ _ _
|
224
|
+
* / _|_ _ _ __ ___| |_(_) ___ _ __ ___
|
225
|
+
* | |_| | | | '_ \\ / __| __| |/ _ \\| '_ \\/ __|
|
226
|
+
* | _| |_| | | | | (__| |_| | (_) | | | \\__ \\
|
227
|
+
* |_| \\__,_|_| |_|\\___|\\__|_|\\___/|_| |_|___/
|
228
|
+
*/
|
227
229
|
|
228
230
|
<% transition_functions_list.each do |t| %>
|
229
231
|
<% next if t == "NULL" %>
|
@@ -244,18 +246,19 @@ module GV_FSM
|
|
244
246
|
<% end %>
|
245
247
|
<% end %>
|
246
248
|
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
249
|
+
/* ____ _ _
|
250
|
+
* / ___|| |_ __ _| |_ ___
|
251
|
+
* \\___ \\| __/ _` | __/ _ \\
|
252
|
+
* ___) | || (_| | || __/
|
253
|
+
* |____/ \\__\\__,_|\\__\\___|
|
254
|
+
*
|
255
|
+
*
|
256
|
+
* _ __ ___ __ _ _ __ __ _ __ _ ___ _ __
|
257
|
+
* | '_ ` _ \\ / _` | '_ \\ / _` |/ _` |/ _ \\ '__|
|
258
|
+
* | | | | | | (_| | | | | (_| | (_| | __/ |
|
259
|
+
* |_| |_| |_|\\__,_|_| |_|\\__,_|\\__, |\\___|_|
|
260
|
+
* |___/
|
261
|
+
*/
|
259
262
|
|
260
263
|
<%= @prefix %>state_t <%= @prefix %>run_state(<%= @prefix %>state_t cur_state, <%= @prefix %>state_data_t *data) {
|
261
264
|
<%= @prefix %>state_t new_state = <%= @prefix %>state_table[cur_state](data);
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gv_fsm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paolo Bosetti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-graphviz
|