00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _TREE_H_
00028 #define _TREE_H_
00029 #if defined(__cplusplus)
00030 extern "C"
00031 {
00032 #endif
00033
00034 #define NODE_TOP 0
00035 #define NODE_VAR 1
00036 #define NODE_OR 2
00037 #define NODE_AND 3
00038 #define NODE_STAR 4
00039 #define NODE_PLUS 5
00040
00041 typedef struct node {
00042 int type;
00043 char var;
00044 struct node *fg;
00045 struct node *fd;
00046 int numero;
00047 int position;
00048 int annulable;
00049 int PP;
00050 int DP;
00051 } NODE;
00052
00053
00054
00055
00056 #define REGEXP_MAX 32
00057
00058
00059
00060
00061 #define RE_EPSILON (DIC_LETTERS + 0)
00062 #define RE_FINAL_TOK (DIC_LETTERS + 1)
00063 #define RE_ALL_MATCH (DIC_LETTERS + 2)
00064 #define RE_VOWL_MATCH (DIC_LETTERS + 3)
00065 #define RE_CONS_MATCH (DIC_LETTERS + 4)
00066 #define RE_USR1_MATCH (DIC_LETTERS + 5)
00067 #define RE_USR2_MATCH (DIC_LETTERS + 6)
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078 #define DIC_SEARCH_REGE_LIST (REGEXP_MAX)
00079
00080
00081
00082
00083
00084
00085 struct search_RegE_list_t {
00086
00087 int minlength;
00088
00089 int maxlength;
00090
00091 char symbl[DIC_SEARCH_REGE_LIST];
00092
00093 int valid[DIC_SEARCH_REGE_LIST];
00094
00095 char letters[DIC_SEARCH_REGE_LIST][DIC_LETTERS];
00096 };
00097
00098 #define RE_LIST_ALL_MATCH 0
00099 #define RE_LIST_VOYL_MATCH 1
00100 #define RE_LIST_CONS_MATCH 2
00101 #define RE_LIST_USER_BEGIN 3
00102 #define RE_LIST_USER_END 4
00103
00104
00105
00106
00107
00108
00109 NODE* regexp_createNODE(int type,char v,NODE *fg,NODE *fd);
00110
00111
00112
00113
00114 void regexp_delete_tree(NODE * root);
00115
00116
00117
00118
00119
00120
00121
00122
00123 void regexp_parcours(NODE* r, int *p, int *n, int ptl[]);
00124
00125
00126
00127
00128
00129
00130
00131
00132 void regexp_possuivante(NODE* r, int PS[]);
00133
00134 #define MAX_REGEXP_ERROR_LENGTH 500
00135
00136 struct regexp_error_report_t {
00137 int pos1;
00138 int pos2;
00139 char msg[MAX_REGEXP_ERROR_LENGTH];
00140 };
00141
00142 #include <stdio.h>
00143
00144 void regexp_print_letter(FILE* f, char l);
00145 void regexp_print_letter2(FILE* f, char l);
00146 void regexp_print_PS(int PS[]);
00147 void regexp_print_ptl(int ptl[]);
00148 void regexp_print_tree(NODE* n, char* name, int detail);
00149
00150 #if defined(__cplusplus)
00151 }
00152 #endif
00153 #endif