88 while (*s && *s !=
',')
123 char **feature_start_nodes,
124 int num_feature_start_nodes,
128 first_const_set,
char ***in_feature_nodes)
130 uword *index_by_name;
135 char **these_constraints;
136 char *this_constraint_c;
137 u8 **constraints = 0;
138 u8 *constraint_tuple;
140 u8 **orig, **closure;
144 int a_index, b_index;
149 char **feature_nodes = 0;
151 u8 **keys_to_delete = 0;
156 this_reg = first_reg;
164 if (
clib_strcmp (this_reg->node_name, last_in_arc))
170 constraint_tuple =
format (0,
"%s,%s%c", this_reg->node_name,
172 vec_add1 (constraints, constraint_tuple);
174 this_reg = this_reg->next_in_arc;
176 this_reg = first_reg;
182 node_name =
format (0,
"%s%c", this_reg->node_name, 0);
189 these_constraints = this_reg->runs_before;
190 while (these_constraints && these_constraints[0])
192 this_constraint_c = these_constraints[0];
194 constraint_tuple =
format (0,
"%s,%s%c", node_name,
195 this_constraint_c, 0);
196 vec_add1 (constraints, constraint_tuple);
200 these_constraints = this_reg->runs_after;
201 while (these_constraints && these_constraints[0])
203 this_constraint_c = these_constraints[0];
205 constraint_tuple =
format (0,
"%s,%s%c",
206 this_constraint_c, node_name, 0);
207 vec_add1 (constraints, constraint_tuple);
211 this_reg = this_reg->next_in_arc;
215 this_const_set = first_const_set;
216 while (this_const_set)
218 these_constraints = this_const_set->node_names;
222 while (these_constraints && these_constraints[0])
224 this_constraint_c = these_constraints[0];
229 (
"bulk constraint feature node '%s' not found for arc '%s'",
237 prev_name = this_constraint_c;
242 constraint_tuple =
format (0,
"%s,%s%c", prev_name,
243 this_constraint_c, 0);
244 vec_add1 (constraints, constraint_tuple);
245 prev_name = this_constraint_c;
249 this_const_set = this_const_set->next_in_arc;
252 n_features =
vec_len (node_names);
257 this_constraint = constraints[
i];
259 if (
comma_split (this_constraint, &a_name, &b_name))
271 clib_warning (
"feature node '%s' not found (before '%s', arc '%s')",
272 a_name, b_name, first_reg->arc_name);
280 clib_warning (
"feature node '%s' not found (after '%s', arc '%s')",
281 b_name, a_name, first_reg->arc_name);
287 orig[a_index][b_index] = 1;
296 for (
i = 0;
i < n_features;
i++)
298 for (j = 0; j < n_features; j++)
301 goto item_constrained;
306 for (k = 0; k < n_features; k++)
320 if (
vec_len (result) != n_features)
322 (0,
"Arc '%s': failed to find a suitable feature order!",
323 first_reg->arc_name);
333 for (
i = n_features - 1;
i >= 0;
i--)
338 if (this_reg->feature_index_ptr)
339 *this_reg->feature_index_ptr = n_features - (
i + 1);
340 this_reg->feature_index = n_features - (
i + 1);
341 vec_add1 (feature_nodes, this_reg->node_name);
347 num_feature_start_nodes,
348 feature_nodes,
vec_len (feature_nodes));
351 *in_feature_nodes = feature_nodes;
361 for (
i = 0;
i <
vec_len (keys_to_delete);
i++)