20 #include "os_helpers.h"
29 static unsigned int ux_flow_check_valid(
void)
31 unsigned int top_stack_slot =
G_ux.stack_count - 1;
43 unsigned int top_stack_slot =
G_ux.stack_count - 1;
44 if (!ux_flow_check_valid() ||
G_ux.flow_stack[top_stack_slot].steps == NULL
45 || (
G_ux.flow_stack[top_stack_slot].index == 0
46 &&
G_ux.flow_stack[top_stack_slot].steps[
G_ux.flow_stack[top_stack_slot].length - 1]
52 if (
G_ux.flow_stack[top_stack_slot].length > 0
53 &&
G_ux.flow_stack[top_stack_slot].index <
G_ux.flow_stack[top_stack_slot].length
54 &&
G_ux.flow_stack[top_stack_slot].steps[
G_ux.flow_stack[top_stack_slot].index - 1]
66 unsigned int top_stack_slot =
G_ux.stack_count - 1;
68 if (!ux_flow_check_valid() ||
G_ux.flow_stack[top_stack_slot].steps == NULL
69 ||
G_ux.flow_stack[top_stack_slot].length == 0
70 ||
G_ux.flow_stack[top_stack_slot].index >=
G_ux.flow_stack[top_stack_slot].length - 1) {
75 if (
G_ux.flow_stack[top_stack_slot].length > 0
76 &&
G_ux.flow_stack[top_stack_slot].index <
G_ux.flow_stack[top_stack_slot].length - 2
77 &&
G_ux.flow_stack[top_stack_slot].steps[
G_ux.flow_stack[top_stack_slot].index + 1]
88 unsigned int top_stack_slot =
G_ux.stack_count - 1;
90 if (
G_ux.stack_count) {
91 if (
G_ux.flow_stack[top_stack_slot].index >
G_ux.flow_stack[top_stack_slot].prev_index) {
94 else if (
G_ux.flow_stack[top_stack_slot].index
95 <
G_ux.flow_stack[top_stack_slot].prev_index) {
104 unsigned int top_stack_slot =
G_ux.stack_count - 1;
106 if (!ux_flow_check_valid() ||
G_ux.flow_stack[top_stack_slot].steps == NULL
107 ||
G_ux.flow_stack[top_stack_slot].index >=
G_ux.flow_stack[top_stack_slot].length
108 ||
G_ux.flow_stack[top_stack_slot].steps[
G_ux.flow_stack[top_stack_slot].index]
110 ||
G_ux.flow_stack[top_stack_slot].steps[
G_ux.flow_stack[top_stack_slot].index] ==
FLOW_LOOP
111 ||
G_ux.flow_stack[top_stack_slot].steps[
G_ux.flow_stack[top_stack_slot].index]
115 return STEPPIC(
G_ux.flow_stack[top_stack_slot].steps[
G_ux.flow_stack[top_stack_slot].index]);
118 static void ux_flow_engine_init_step(
unsigned int stack_slot)
129 if (
G_ux.flow_stack[stack_slot].steps[
G_ux.flow_stack[stack_slot].index] ==
FLOW_LOOP) {
133 if (
STEPPIC(
G_ux.flow_stack[stack_slot].steps[
G_ux.flow_stack[stack_slot].index])->init) {
144 STEPPIC(
G_ux.flow_stack[stack_slot].steps[
G_ux.flow_stack[stack_slot].index])
149 static void ux_flow_next_internal(
unsigned int display_step)
151 unsigned int top_stack_slot =
G_ux.stack_count - 1;
154 if (!ux_flow_check_valid() ||
G_ux.flow_stack[top_stack_slot].steps == NULL
155 ||
G_ux.flow_stack[top_stack_slot].length <= 1
156 ||
G_ux.flow_stack[top_stack_slot].index >=
G_ux.flow_stack[top_stack_slot].length - 1) {
161 if (
G_ux.flow_stack[top_stack_slot].index <=
G_ux.flow_stack[top_stack_slot].length - 2) {
162 if (
G_ux.flow_stack[top_stack_slot].steps[
G_ux.flow_stack[top_stack_slot].index + 1]
168 if (
G_ux.flow_stack[top_stack_slot].steps[
G_ux.flow_stack[top_stack_slot].index + 1]
171 G_ux.flow_stack[top_stack_slot].prev_index =
G_ux.flow_stack[top_stack_slot].index = 0;
172 ux_flow_engine_init_step(top_stack_slot);
178 G_ux.flow_stack[top_stack_slot].prev_index =
G_ux.flow_stack[top_stack_slot].index;
179 G_ux.flow_stack[top_stack_slot].index++;
181 ux_flow_engine_init_step(top_stack_slot);
187 ux_flow_next_internal(0);
192 ux_flow_next_internal(1);
197 unsigned int top_stack_slot =
G_ux.stack_count - 1;
200 if (!ux_flow_check_valid() ||
G_ux.flow_stack[top_stack_slot].steps == NULL
201 ||
G_ux.flow_stack[top_stack_slot].length <= 1
202 || (
G_ux.flow_stack[top_stack_slot].index == 0
203 &&
G_ux.flow_stack[top_stack_slot].steps[
G_ux.flow_stack[top_stack_slot].length - 1]
209 if (
G_ux.flow_stack[top_stack_slot].index == 0
210 &&
G_ux.flow_stack[top_stack_slot].steps[
G_ux.flow_stack[top_stack_slot].length - 1]
214 G_ux.flow_stack[top_stack_slot].index =
G_ux.flow_stack[top_stack_slot].length - 2;
216 G_ux.flow_stack[top_stack_slot].prev_index =
G_ux.flow_stack[top_stack_slot].index + 1;
217 ux_flow_engine_init_step(top_stack_slot);
222 if (
G_ux.flow_stack[top_stack_slot].steps[
G_ux.flow_stack[top_stack_slot].index - 1]
228 G_ux.flow_stack[top_stack_slot].prev_index =
G_ux.flow_stack[top_stack_slot].index;
229 G_ux.flow_stack[top_stack_slot].index--;
231 ux_flow_engine_init_step(top_stack_slot);
236 unsigned int top_stack_slot =
G_ux.stack_count - 1;
239 if (!ux_flow_check_valid() ||
G_ux.flow_stack[top_stack_slot].steps == NULL
240 ||
G_ux.flow_stack[top_stack_slot].length == 0
241 ||
G_ux.flow_stack[top_stack_slot].index >=
G_ux.flow_stack[top_stack_slot].length) {
246 if (
STEPPIC(
G_ux.flow_stack[top_stack_slot].steps[
G_ux.flow_stack[top_stack_slot].index])
252 .steps[
G_ux.flow_stack[top_stack_slot].index])
260 if (
G_ux.flow_stack[top_stack_slot].length > 0
261 &&
G_ux.flow_stack[top_stack_slot].index
262 <=
G_ux.flow_stack[top_stack_slot].length - 2) {
263 if (
G_ux.flow_stack[top_stack_slot].steps[
G_ux.flow_stack[top_stack_slot].index + 1]
266 while (
G_ux.flow_stack[top_stack_slot].length > 0
267 &&
G_ux.flow_stack[top_stack_slot].index
268 <=
G_ux.flow_stack[top_stack_slot].length - 2
269 &&
G_ux.flow_stack[top_stack_slot]
270 .steps[
G_ux.flow_stack[top_stack_slot].index + 1]
272 G_ux.flow_stack[top_stack_slot].index++;
275 G_ux.flow_stack[top_stack_slot].prev_index =
G_ux.flow_stack[top_stack_slot].index;
276 G_ux.flow_stack[top_stack_slot].index++;
279 ux_flow_engine_init_step(top_stack_slot);
282 else if (
G_ux.flow_stack[top_stack_slot]
283 .steps[
G_ux.flow_stack[top_stack_slot].index + 1]
286 G_ux.flow_stack[top_stack_slot].prev_index =
G_ux.flow_stack[top_stack_slot].index
289 ux_flow_engine_init_step(top_stack_slot);
299 unsigned int top_stack_slot =
G_ux.stack_count - 1;
301 if (
G_ux.flow_stack[top_stack_slot].steps == NULL ||
G_ux.flow_stack[top_stack_slot].length == 0
302 ||
G_ux.flow_stack[top_stack_slot].index >=
G_ux.flow_stack[top_stack_slot].length) {
306 if (
STEPPIC(
G_ux.flow_stack[top_stack_slot].steps[
G_ux.flow_stack[top_stack_slot].index])
311 .steps[
G_ux.flow_stack[top_stack_slot].index])
328 G_ux.flow_stack[stack_slot].length =
G_ux.flow_stack[stack_slot].prev_index
329 =
G_ux.flow_stack[stack_slot].index = 0;
330 G_ux.flow_stack[stack_slot].steps = NULL;
333 memset(&
G_ux.layout_paging, 0,
sizeof(
G_ux.layout_paging));
337 while (
G_ux.flow_stack[stack_slot].steps[
G_ux.flow_stack[stack_slot].length]
339 G_ux.flow_stack[stack_slot].length++;
341 if (start_step != NULL) {
343 while (
G_ux.flow_stack[stack_slot].steps[
G_ux.flow_stack[stack_slot].index]
345 &&
STEPPIC(
G_ux.flow_stack[stack_slot].steps[
G_ux.flow_stack[stack_slot].index])
347 G_ux.flow_stack[stack_slot].prev_index =
G_ux.flow_stack[stack_slot].index;
348 G_ux.flow_stack[stack_slot].index++;
353 ux_flow_engine_init_step(stack_slot);
360 memset(&
G_ux.flow_stack[stack_slot], 0,
sizeof(
G_ux.flow_stack[stack_slot]));
366 UNUSED(button_mask_counter);
367 switch (button_mask) {
387 if (
G_ux.flow_stack[stack_slot].length == 0) {
391 if (
G_ux.flow_stack[stack_slot].index >=
G_ux.flow_stack[stack_slot].length) {
402 unsigned int top_stack_slot =
G_ux.stack_count - 1;
411 unsigned int top_stack_slot =
G_ux.stack_count - 1;
413 ux_flow_engine_init_step(top_stack_slot);
#define UX_STACK_SLOT_COUNT
#define BUTTON_EVT_RELEASED
void ux_flow_init(unsigned int stack_slot, const ux_flow_step_t *const *steps, const ux_flow_step_t *const start_step)
@ FLOW_DIRECTION_BACKWARD
ux_flow_direction_t ux_flow_direction(void)
unsigned int ux_flow_is_first(void)
void ux_flow_error(unsigned int error)
const void * ux_stack_get_step_params(unsigned int stack_slot)
void ux_flow_next_no_display(void)
const ux_flow_step_t * ux_flow_get_current(void)
const void * ux_stack_get_current_step_params(void)
void ux_flow_uninit(unsigned int stack_slot)
unsigned int ux_flow_button_callback(unsigned int button_mask, unsigned int button_mask_counter)
unsigned int ux_flow_is_last(void)
void ux_flow_validate(void)
unsigned int ux_flow_relayout(void)