Changeset e187445 for filterelement.c
- Timestamp:
- Jun 22, 2003, 1:40:49 PM (21 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 53f421b
- Parents:
- a6560fe
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
filterelement.c
r1aee7d9 re187445 14 14 15 15 16 void owl_filterelement_create_null(owl_filterelement *fe) { 16 void owl_filterelement_create_null(owl_filterelement *fe) 17 { 17 18 fe->type=OWL_FILTERELEMENT_NULL; 18 19 fe->field=NULL; 19 20 } 20 21 21 void owl_filterelement_create_openbrace(owl_filterelement *fe) { 22 void owl_filterelement_create_openbrace(owl_filterelement *fe) 23 { 22 24 fe->type=OWL_FILTERELEMENT_OPENBRACE; 23 25 fe->field=NULL; 24 26 } 25 27 26 void owl_filterelement_create_closebrace(owl_filterelement *fe) { 28 void owl_filterelement_create_closebrace(owl_filterelement *fe) 29 { 27 30 fe->type=OWL_FILTERELEMENT_CLOSEBRACE; 28 31 fe->field=NULL; 29 32 } 30 33 31 void owl_filterelement_create_and(owl_filterelement *fe) { 34 void owl_filterelement_create_and(owl_filterelement *fe) 35 { 32 36 fe->type=OWL_FILTERELEMENT_AND; 33 37 fe->field=NULL; 34 38 } 35 39 36 void owl_filterelement_create_or(owl_filterelement *fe) { 40 void owl_filterelement_create_or(owl_filterelement *fe) 41 { 37 42 fe->type=OWL_FILTERELEMENT_OR; 38 43 fe->field=NULL; 39 44 } 40 45 41 void owl_filterelement_create_not(owl_filterelement *fe) { 46 void owl_filterelement_create_not(owl_filterelement *fe) 47 { 42 48 fe->type=OWL_FILTERELEMENT_NOT; 43 49 fe->field=NULL; 44 50 } 45 51 46 void owl_filterelement_create_true(owl_filterelement *fe) { 52 void owl_filterelement_create_true(owl_filterelement *fe) 53 { 47 54 fe->type=OWL_FILTERELEMENT_TRUE; 48 55 fe->field=NULL; 49 56 } 50 57 51 void owl_filterelement_create_false(owl_filterelement *fe) { 58 void owl_filterelement_create_false(owl_filterelement *fe) 59 { 52 60 fe->type=OWL_FILTERELEMENT_FALSE; 53 61 fe->field=NULL; 54 62 } 55 63 56 void owl_filterelement_create_re(owl_filterelement *fe, char *field, char *re) { 64 void owl_filterelement_create_re(owl_filterelement *fe, char *field, char *re) 65 { 57 66 fe->type=OWL_FILTERELEMENT_RE; 58 67 fe->field=owl_strdup(field); … … 60 69 } 61 70 62 void owl_filterelement_free(owl_filterelement *fe) { 71 void owl_filterelement_free(owl_filterelement *fe) 72 { 63 73 if (fe->field) owl_free(fe->field); 64 74 } 65 75 66 int owl_filterelement_is_null(owl_filterelement *fe) { 76 int owl_filterelement_is_null(owl_filterelement *fe) 77 { 67 78 if (fe->type==OWL_FILTERELEMENT_NULL) return(1); 68 79 return(0); 69 80 } 70 81 71 int owl_filterelement_is_openbrace(owl_filterelement *fe) { 82 int owl_filterelement_is_openbrace(owl_filterelement *fe) 83 { 72 84 if (fe->type==OWL_FILTERELEMENT_OPENBRACE) return(1); 73 85 return(0); 74 86 } 75 87 76 int owl_filterelement_is_closebrace(owl_filterelement *fe) { 88 int owl_filterelement_is_closebrace(owl_filterelement *fe) 89 { 77 90 if (fe->type==OWL_FILTERELEMENT_CLOSEBRACE) return(1); 78 91 return(0); 79 92 } 80 93 81 int owl_filterelement_is_and(owl_filterelement *fe) { 94 int owl_filterelement_is_and(owl_filterelement *fe) 95 { 82 96 if (fe->type==OWL_FILTERELEMENT_AND) return(1); 83 97 return(0); 84 98 } 85 99 86 int owl_filterelement_is_or(owl_filterelement *fe) { 100 int owl_filterelement_is_or(owl_filterelement *fe) 101 { 87 102 if (fe->type==OWL_FILTERELEMENT_OR) return(1); 88 103 return(0); 89 104 } 90 105 91 int owl_filterelement_is_not(owl_filterelement *fe) { 106 int owl_filterelement_is_not(owl_filterelement *fe) 107 { 92 108 if (fe->type==OWL_FILTERELEMENT_NOT) return(1); 93 109 return(0); 94 110 } 95 111 96 int owl_filterelement_is_true(owl_filterelement *fe) { 112 int owl_filterelement_is_true(owl_filterelement *fe) 113 { 97 114 if (fe->type==OWL_FILTERELEMENT_TRUE) return(1); 98 115 return(0); 99 116 } 100 117 101 int owl_filterelement_is_false(owl_filterelement *fe) { 118 int owl_filterelement_is_false(owl_filterelement *fe) 119 { 102 120 if (fe->type==OWL_FILTERELEMENT_FALSE) return(1); 103 121 return(0); 104 122 } 105 123 106 int owl_filterelement_is_re(owl_filterelement *fe) { 124 int owl_filterelement_is_re(owl_filterelement *fe) 125 { 107 126 if (fe->type==OWL_FILTERELEMENT_RE) return(1); 108 127 return(0); 109 128 } 110 129 111 owl_regex *owl_filterelement_get_re(owl_filterelement *fe) { 130 owl_regex *owl_filterelement_get_re(owl_filterelement *fe) 131 { 112 132 return(&(fe->re)); 113 133 } 114 134 115 char *owl_filterelement_get_field(owl_filterelement *fe) { 135 char *owl_filterelement_get_field(owl_filterelement *fe) 136 { 116 137 return(fe->field); 117 138 } 118 139 119 int owl_filterelement_is_value(owl_filterelement *fe) { 140 int owl_filterelement_is_value(owl_filterelement *fe) 141 { 120 142 if ( (fe->type==OWL_FILTERELEMENT_TRUE) || 121 143 (fe->type==OWL_FILTERELEMENT_FALSE) || … … 127 149 128 150 129 char *owl_filterelement_to_string(owl_filterelement *fe) { 151 char *owl_filterelement_to_string(owl_filterelement *fe) 152 { 130 153 /* return must be freed by caller */ 131 154
Note: See TracChangeset
for help on using the changeset viewer.