-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvui_fragment.h
58 lines (42 loc) · 1.23 KB
/
vui_fragment.h
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
#ifndef VUI_FRAGMENT_H
#define VUI_FRAGMENT_H
#ifdef __cplusplus
extern "C"
{
#endif
#include "vui_stack.h"
#include "vui_statemachine.h"
typedef struct vui_frag
{
vui_state* entry;
vui_stack* exits;
} vui_frag;
// Create a fragment given an entry point and a stack of exit points
vui_frag* vui_frag_new(vui_state* entry, vui_stack* exits);
// Destroy a fragment
void vui_frag_kill(vui_frag* frag);
// Clone a fragment
vui_frag* vui_frag_dup(vui_frag* orig);
// Fill in the exit points of a fragment and release the completed state machine
// Destroys the fragment, since it isn't useful anymore
vui_state* vui_frag_release(vui_frag* frag, vui_state* exit);
// constructors for various useful fragments
vui_frag* vui_frag_new_string_t(char* s, vui_transition* t);
static inline vui_frag* vui_frag_new_string(char* s)
{
return vui_frag_new_string_t(s, vui_transition_new0());
}
vui_frag* vui_frag_new_regexp_t(char* s, vui_transition* t);
static inline vui_frag* vui_frag_new_regexp(char* s)
{
return vui_frag_new_regexp_t(s, vui_transition_new0());
}
vui_frag* vui_frag_new_any_t(vui_transition* t);
static inline vui_frag* vui_frag_new_any(void)
{
return vui_frag_new_any_t(vui_transition_new0());
}
#ifdef __cplusplus
}
#endif
#endif