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 __switch_h
00028 #define __switch_h
00029
00030 #include <stddef.h>
00031 #include <regex.h>
00032
00033 #include "route_struct.h"
00034
00035
00036 struct case_stms{
00037 struct rval_expr* ct_rve;
00038 struct action* actions;
00039 struct case_stms* next;
00040 struct case_stms** append;
00041 int type;
00042 int re_flags;
00043 int is_default;
00044 union {
00045 int match_int;
00046 str match_str;
00047 regex_t* match_re;
00048 } label;
00049 };
00050
00051
00052 struct switch_cond_table{
00053 int n;
00054 int* cond;
00055 struct action** jump;
00056 struct action* def;
00057 };
00058
00059
00060 struct switch_jmp_table{
00061 int first;
00062 int last;
00063 struct action** tbl;
00064 struct switch_cond_table rest;
00065 };
00066
00067
00068 enum match_str_type { MATCH_UNKNOWN, MATCH_INT, MATCH_STR, MATCH_RE };
00069
00070 struct match_str{
00071 enum match_str_type type;
00072 int flags;
00073 union{
00074 str s;
00075 regex_t* regex;
00076 }l;
00077 };
00078
00079 struct match_cond_table{
00080 int n;
00081 struct match_str* match;
00082 struct action** jump;
00083 struct action* def;
00084 };
00085
00086 int fix_switch(struct action* t);
00087
00088 #endif
00089
00090