-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpattern.h
70 lines (50 loc) · 1.24 KB
/
pattern.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
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef _PATTERN
#define _PATTERN
#include <stdlib.h>
#include <stdio.h>
typedef struct pattern
{
int* values;
int size;
}pattern;
typedef struct rule
{
pattern* left;
pattern* right;
}rule;
typedef struct statef
{
pattern* label;
pattern* output;
int nb;
}statef;
typedef struct transition
{
pattern* st_state;
pattern* en_state;
int input;
pattern* output;
}transition;
/* Functions to operate on patterns */
int incPat(pattern* p, const int alph_max);
pattern* append(const pattern* p, const int i);
int compLexPat(const pattern* p, const pattern* o);
pattern* subPattern(const pattern* p, const int start,const int end);
pattern** getPrefixes(const pattern* p);
pattern** getSuffixes(const pattern* p);
pattern* getPrefix(const pattern* p, const int sizeOfSuffix);
pattern* getSuffix(const pattern* p, const pattern* prefix);
pattern* copyPattern(const pattern* p);
int getMax(const pattern* p);
int getMin(const pattern* p);
/* Print functions */
void printPattern(const pattern* p);
void printRule(const rule* r);
void printTransition(const transition* t);
void printStatef(statef* s);
/* Free functions */
void freePattern(pattern* p);
void freeRule(rule* r);
void freeTransition(transition* t);
void freeStatef(statef* s);
#endif