1 | #include "madx.h" |
---|
2 | |
---|
3 | static int |
---|
4 | get_select_ex_ranges(struct sequence* sequ, struct command_list* select, struct node_list* s_ranges) |
---|
5 | /* makes a list of nodes of an expanded sequence that pass the range |
---|
6 | selection */ |
---|
7 | { |
---|
8 | /*returns 0 if invalid sequence pointer |
---|
9 | 1 if nodes in s_ranges (including 0) */ |
---|
10 | struct name_list* nl; |
---|
11 | struct command* cd; |
---|
12 | struct command_parameter_list* pl; |
---|
13 | char* name; |
---|
14 | int full = 0, i, pos; // k, // not used |
---|
15 | struct node* c_node; |
---|
16 | struct node* nodes[2]; |
---|
17 | if (sequ == NULL) return 0; |
---|
18 | s_ranges->curr = 0; |
---|
19 | s_ranges->list->curr = 0; |
---|
20 | for (i = 0; i < select->curr; i++) |
---|
21 | { |
---|
22 | cd = select->commands[i]; |
---|
23 | nl = cd->par_names; |
---|
24 | pl = cd->par; |
---|
25 | pos = name_list_pos("full", nl); |
---|
26 | if ((pos = name_list_pos("full", nl)) > -1 && nl->inform[pos] |
---|
27 | && command_par_value("full", cd) != zero) full = 1; |
---|
28 | if (full == 0 && (pos = name_list_pos("range", nl)) > -1 |
---|
29 | && nl->inform[pos]) |
---|
30 | { |
---|
31 | name = pl->parameters[pos]->string; |
---|
32 | if (get_ex_range(name, sequ, nodes) == 0) return 0; // (k = not used |
---|
33 | } |
---|
34 | else |
---|
35 | { |
---|
36 | if ((nodes[0] = sequ->ex_start) == NULL || |
---|
37 | (nodes[1] = sequ->ex_end) == NULL) return 0; |
---|
38 | } |
---|
39 | c_node = nodes[0]; |
---|
40 | while (c_node != NULL) |
---|
41 | { |
---|
42 | if (full != 0 || pass_select(c_node->p_elem->name, cd) != 0) |
---|
43 | add_to_node_list(c_node, 0, s_ranges); |
---|
44 | if (c_node == nodes[1]) break; |
---|
45 | c_node = c_node->next; |
---|
46 | } |
---|
47 | if (full != 0) break; |
---|
48 | } |
---|
49 | return 1; |
---|
50 | } |
---|
51 | |
---|
52 | // public interface |
---|
53 | |
---|
54 | int |
---|
55 | pass_select(char* name, struct command* sc) |
---|
56 | /* checks name against class (if element) and pattern that may |
---|
57 | (but need not) be contained in command sc; |
---|
58 | 0: does not pass, 1: passes */ |
---|
59 | { |
---|
60 | struct name_list* nl = sc->par_names; |
---|
61 | struct command_parameter_list* pl = sc->par; |
---|
62 | struct element* el = find_element(strip(name), element_list); |
---|
63 | int pos, in = 0, any = 0; |
---|
64 | char *class, *pattern; |
---|
65 | pos = name_list_pos("class", nl); |
---|
66 | if (pos > -1 && nl->inform[pos]) /* parameter has been read */ |
---|
67 | { |
---|
68 | el = find_element(strip(name), element_list); |
---|
69 | if (el != NULL) |
---|
70 | { |
---|
71 | class = pl->parameters[pos]->string; |
---|
72 | in = belongs_to_class(el, class); |
---|
73 | if (in == 0) return 0; |
---|
74 | } |
---|
75 | } |
---|
76 | any = in = 0; |
---|
77 | pos = name_list_pos("pattern", nl); |
---|
78 | if (pos > -1 && nl->inform[pos]) /* parameter has been read */ |
---|
79 | { |
---|
80 | any = 1; |
---|
81 | pattern = stolower(pl->parameters[pos]->string); |
---|
82 | if(myregex(pattern, strip(name)) == 0) in = 1; |
---|
83 | } |
---|
84 | if (any == 0) return 1; |
---|
85 | else return in; |
---|
86 | } |
---|
87 | |
---|
88 | int |
---|
89 | pass_select_list(char* name, struct command_list* cl) |
---|
90 | /* returns 0 (does not pass) or 1 (passes) for a list of selects */ |
---|
91 | { |
---|
92 | int i, ret = 0; |
---|
93 | if (cl->curr == 0) return 1; |
---|
94 | for (i = 0; i < cl->curr; i++) |
---|
95 | { |
---|
96 | if ((ret = pass_select(name, cl->commands[i]))) break; |
---|
97 | } |
---|
98 | return ret; |
---|
99 | } |
---|
100 | |
---|
101 | int |
---|
102 | get_select_ranges(struct sequence* sequ, struct command_list* select, struct node_list* s_ranges) |
---|
103 | /* makes a list of nodes of a sequence that pass the range selection */ |
---|
104 | { |
---|
105 | struct name_list* nl; |
---|
106 | struct command_parameter_list* pl; |
---|
107 | char* name; |
---|
108 | char full_range[] = "#s/#e"; |
---|
109 | int i, pos; //, k // not used |
---|
110 | struct node* c_node; |
---|
111 | struct node* nodes[2]; |
---|
112 | for (i = 0; i < select->curr; i++) |
---|
113 | { |
---|
114 | nl = select->commands[i]->par_names; |
---|
115 | pl = select->commands[i]->par; |
---|
116 | pos = name_list_pos("range", nl); |
---|
117 | if (pos > -1 && nl->inform[pos]) /* parameter has been read */ |
---|
118 | name = pl->parameters[pos]->string; |
---|
119 | else name = full_range; |
---|
120 | if (get_range(name, sequ, nodes) > 0) // (k = not used |
---|
121 | { |
---|
122 | c_node = nodes[0]; |
---|
123 | while (c_node != NULL) |
---|
124 | { |
---|
125 | add_to_node_list(c_node, 0, s_ranges); |
---|
126 | if (c_node == nodes[1]) break; |
---|
127 | c_node = c_node->next; |
---|
128 | } |
---|
129 | } |
---|
130 | } |
---|
131 | return s_ranges->curr; |
---|
132 | } |
---|
133 | |
---|
134 | void |
---|
135 | get_select_t_ranges(struct command_list* select, struct command_list* deselect, struct table* t) |
---|
136 | /* makes a list of table rows that pass the range selection and |
---|
137 | subsequent deselection */ |
---|
138 | { |
---|
139 | int rows[2]; |
---|
140 | struct name_list* nl; |
---|
141 | struct command_parameter_list* pl; |
---|
142 | int i, pos; |
---|
143 | s_range->curr = 0; e_range->curr = 0; |
---|
144 | if (select != NULL) |
---|
145 | { |
---|
146 | for (i = 0; i < select->curr; i++) |
---|
147 | { |
---|
148 | nl = select->commands[i]->par_names; |
---|
149 | pl = select->commands[i]->par; |
---|
150 | pos = name_list_pos("range", nl); |
---|
151 | if (pos > -1 && nl->inform[pos] /* parameter has been read */ |
---|
152 | && get_table_range(pl->parameters[pos]->string, t, rows) |
---|
153 | && (rows[0] <= rows[1])) |
---|
154 | { |
---|
155 | if (s_range->max == s_range->curr) grow_int_array(s_range); |
---|
156 | if (e_range->max == e_range->curr) grow_int_array(e_range); |
---|
157 | s_range->i[s_range->curr++] = rows[0]; |
---|
158 | e_range->i[e_range->curr++] = rows[1]; |
---|
159 | } |
---|
160 | else |
---|
161 | { |
---|
162 | if (s_range->max == s_range->curr) grow_int_array(s_range); |
---|
163 | if (e_range->max == e_range->curr) grow_int_array(e_range); |
---|
164 | s_range->i[s_range->curr++] = 0; |
---|
165 | e_range->i[e_range->curr++] = t->curr - 1; |
---|
166 | } |
---|
167 | } |
---|
168 | } |
---|
169 | if (deselect != NULL) |
---|
170 | { |
---|
171 | for (i = 0; i < deselect->curr; i++) |
---|
172 | { |
---|
173 | nl = deselect->commands[i]->par_names; |
---|
174 | pl = deselect->commands[i]->par; |
---|
175 | pos = name_list_pos("range", nl); |
---|
176 | if (pos > -1 && nl->inform[pos] /* parameter has been read */ |
---|
177 | && get_table_range(pl->parameters[pos]->string, t, rows) |
---|
178 | && (rows[0] <= rows[1])) |
---|
179 | { |
---|
180 | if (sd_range->max == sd_range->curr) grow_int_array(sd_range); |
---|
181 | if (ed_range->max == ed_range->curr) grow_int_array(ed_range); |
---|
182 | sd_range->i[sd_range->curr++] = rows[0]; |
---|
183 | ed_range->i[ed_range->curr++] = rows[1]; |
---|
184 | } |
---|
185 | } |
---|
186 | } |
---|
187 | } |
---|
188 | |
---|
189 | void |
---|
190 | set_selected_errors(void) |
---|
191 | { |
---|
192 | int i; |
---|
193 | if (get_select_ex_ranges(current_sequ, error_select, selected_ranges) != 0) |
---|
194 | for (i = 0; i < selected_ranges->curr; i++) |
---|
195 | selected_ranges->nodes[i]->sel_err = 1; |
---|
196 | } |
---|
197 | |
---|
198 | void |
---|
199 | set_range(char* range, struct sequence* sequ) |
---|
200 | { |
---|
201 | struct node* nodes[2]; |
---|
202 | current_sequ->range_start = current_sequ->ex_start; |
---|
203 | current_sequ->range_end = current_sequ->ex_end; |
---|
204 | if (get_ex_range(range, sequ, nodes) == 0) return; |
---|
205 | current_sequ->range_start = nodes[0]; |
---|
206 | current_sequ->range_end = nodes[1]; |
---|
207 | } |
---|
208 | |
---|
209 | void |
---|
210 | set_sector(void) |
---|
211 | { |
---|
212 | int i; |
---|
213 | if (sector_select->curr == 0) reset_sector(current_sequ, 1); |
---|
214 | else |
---|
215 | { |
---|
216 | sector_ranges->curr = 0; sector_ranges->list->curr = 0; |
---|
217 | if (get_select_ex_ranges(current_sequ, sector_select, sector_ranges) != 0) |
---|
218 | for (i = 0; i < sector_ranges->curr; i++) |
---|
219 | sector_ranges->nodes[i]->sel_sector = 1; |
---|
220 | } |
---|
221 | } |
---|
222 | |
---|
223 | int |
---|
224 | get_ex_range(char* range, struct sequence* sequ, struct node** nodes) |
---|
225 | /* returns start and end node (nodes[0] and nodes[1]) |
---|
226 | of a range in the full expanded sequence */ |
---|
227 | { |
---|
228 | int i, n, pos; |
---|
229 | char tmp[NAME_L], buf[5*NAME_L], *c[2]; |
---|
230 | |
---|
231 | if (sequ == NULL) return 0; |
---|
232 | |
---|
233 | strcpy(buf, range); stolower(buf); |
---|
234 | c[0] = strtok(buf, "/"); |
---|
235 | |
---|
236 | if ((c[1] = strtok(NULL,"/")) == NULL) /* only one element given */ |
---|
237 | n = 1; |
---|
238 | else |
---|
239 | n = 2; |
---|
240 | |
---|
241 | for (i = 0; i < n; i++) { |
---|
242 | if (*c[i] == '#') { |
---|
243 | if (strncmp(c[i], "#s", 2) == 0) |
---|
244 | nodes[i] = sequ->ex_start; |
---|
245 | else if (strncmp(c[i], "#e", 2) == 0) |
---|
246 | nodes[i] = sequ->ex_end; |
---|
247 | else { |
---|
248 | warning("illegal expand range ignored:", range); |
---|
249 | return 0; |
---|
250 | } |
---|
251 | } |
---|
252 | else { |
---|
253 | strcpy(tmp, c[i]); |
---|
254 | if (square_to_colon(tmp) == 0) { |
---|
255 | warning("illegal expand range ignored:", range); |
---|
256 | return 0; |
---|
257 | } |
---|
258 | |
---|
259 | if ((pos = name_list_pos(tmp, sequ->ex_nodes->list)) > -1) |
---|
260 | nodes[i] = sequ->ex_nodes->nodes[pos]; |
---|
261 | else { |
---|
262 | warning("illegal expand range ignored:", range); |
---|
263 | return 0; |
---|
264 | } |
---|
265 | } |
---|
266 | } |
---|
267 | if (n == 1) nodes[1] = nodes[0]; |
---|
268 | return n; |
---|
269 | } |
---|
270 | |
---|
271 | int |
---|
272 | get_sub_range(char* range, struct sequence* sequ, struct node** nodes) |
---|
273 | { |
---|
274 | /* returns start and end node (nodes[0] and nodes[1]) |
---|
275 | of a range between range_start and range_end of an expanded sequence */ |
---|
276 | int i, n; |
---|
277 | struct node* c_node; |
---|
278 | char tmp[NAME_L], buf[5*NAME_L], *c[2]; |
---|
279 | |
---|
280 | if (sequ == NULL) return 0; |
---|
281 | strcpy(buf, range); stolower(buf); |
---|
282 | |
---|
283 | c[0] = strtok(buf, "/"); |
---|
284 | if ((c[1] = strtok(NULL,"/")) == NULL) /* only one element given */ |
---|
285 | n = 1; |
---|
286 | else |
---|
287 | n = 2; |
---|
288 | |
---|
289 | for (i = 0; i < n; i++) { |
---|
290 | if (*c[i] == '#') { |
---|
291 | if (strncmp(c[i], "#s", 2) == 0) |
---|
292 | nodes[i] = sequ->range_start; |
---|
293 | else if (strncmp(c[i], "#e", 2) == 0) |
---|
294 | nodes[i] = sequ->range_end; |
---|
295 | else { |
---|
296 | warning("illegal expand range ignored:", range); |
---|
297 | return 0; |
---|
298 | } |
---|
299 | } |
---|
300 | else { |
---|
301 | strcpy(tmp, c[i]); |
---|
302 | if (square_to_colon(tmp) == 0) { |
---|
303 | warning("illegal expand range ignored:", range); |
---|
304 | return 0; |
---|
305 | } |
---|
306 | |
---|
307 | c_node = sequ->range_start; |
---|
308 | |
---|
309 | while(c_node) { |
---|
310 | if (strcmp(c_node->name, tmp) == 0) break; |
---|
311 | |
---|
312 | if ((c_node = c_node->next) == sequ->range_end) { |
---|
313 | warning("illegal expand range ignored:", range); |
---|
314 | return 0; |
---|
315 | } |
---|
316 | } |
---|
317 | |
---|
318 | nodes[i] = c_node; |
---|
319 | } |
---|
320 | } |
---|
321 | if (n == 1) nodes[1] = nodes[0]; |
---|
322 | return n; |
---|
323 | } |
---|
324 | |
---|
325 | int |
---|
326 | get_range(char* range, struct sequence* sequ, struct node** nodes) |
---|
327 | /* returns start and end node (nodes[0] and nodes[1]) |
---|
328 | of a range in the non-expanded sequence */ |
---|
329 | { |
---|
330 | char tmp[NAME_L], buf[5*NAME_L], *c[2]; |
---|
331 | int i, n, pos; |
---|
332 | if (sequ == NULL) return 0; |
---|
333 | |
---|
334 | strcpy(buf, range); stolower(buf); |
---|
335 | c[0] = strtok(buf, "/"); |
---|
336 | |
---|
337 | if ((c[1] = strtok(NULL,"/")) == NULL) /* only one element given */ |
---|
338 | n = 1; |
---|
339 | else |
---|
340 | n = 2; |
---|
341 | |
---|
342 | for (i = 0; i < n; i++) { |
---|
343 | if (*c[i] == '#') { |
---|
344 | if (strncmp(c[i], "#s", 2) == 0) |
---|
345 | nodes[i] = sequ->start; |
---|
346 | else if (strncmp(c[i], "#e", 2) == 0) |
---|
347 | nodes[i] = sequ->end; |
---|
348 | else { |
---|
349 | warning("illegal range ignored:", range); |
---|
350 | return 0; |
---|
351 | } |
---|
352 | } |
---|
353 | else { |
---|
354 | strcpy(tmp, c[i]); |
---|
355 | if (square_to_colon(tmp) == 0) { |
---|
356 | warning("illegal range ignored:", range); |
---|
357 | return 0; |
---|
358 | } |
---|
359 | if ((pos = name_list_pos(tmp, sequ->nodes->list)) > -1) |
---|
360 | nodes[i] = sequ->nodes->nodes[pos]; |
---|
361 | else { |
---|
362 | warning("illegal range ignored:", range); |
---|
363 | return 0; |
---|
364 | } |
---|
365 | } |
---|
366 | } |
---|
367 | if (n == 1) nodes[1] = nodes[0]; |
---|
368 | return n; |
---|
369 | } |
---|
370 | |
---|
371 | void |
---|
372 | store_deselect(struct in_cmd* cmd) |
---|
373 | { |
---|
374 | char* flag_name; |
---|
375 | struct name_list* nl = cmd->clone->par_names; |
---|
376 | struct command_parameter_list* pl = cmd->clone->par; |
---|
377 | struct command_list* dscl; |
---|
378 | int pos = name_list_pos("flag", nl); |
---|
379 | if (nl->inform[pos] == 0 || |
---|
380 | (flag_name = pl->parameters[pos]->string) == NULL) |
---|
381 | { |
---|
382 | warning("no FLAG specified", "ignored"); |
---|
383 | return; |
---|
384 | } |
---|
385 | if (strcmp(flag_name, "seqedit") == 0) |
---|
386 | { |
---|
387 | } |
---|
388 | else if (strcmp(flag_name, "error") == 0) |
---|
389 | { |
---|
390 | } |
---|
391 | else if (strcmp(flag_name, "makethin") == 0) |
---|
392 | { |
---|
393 | } |
---|
394 | else if (strcmp(flag_name, "save") == 0) |
---|
395 | { |
---|
396 | } |
---|
397 | else if (strcmp(flag_name, "sectormap") == 0) |
---|
398 | { |
---|
399 | } |
---|
400 | else /* store deselect for all tables */ |
---|
401 | { |
---|
402 | if ((dscl = find_command_list(flag_name, table_deselect)) == NULL) |
---|
403 | { |
---|
404 | dscl = new_command_list("deselect", 10); |
---|
405 | add_to_command_list_list(flag_name, dscl, table_deselect); |
---|
406 | } |
---|
407 | if (log_val("clear", cmd->clone)) |
---|
408 | { |
---|
409 | dscl = new_command_list("deselect", 10); |
---|
410 | add_to_command_list_list(flag_name, dscl, table_deselect); |
---|
411 | } |
---|
412 | else |
---|
413 | { |
---|
414 | if (dscl->curr == dscl->max) grow_command_list(dscl); |
---|
415 | dscl->commands[dscl->curr++] = cmd->clone; |
---|
416 | cmd->clone_flag = 1; /* do not drop */ |
---|
417 | } |
---|
418 | } |
---|
419 | } |
---|
420 | |
---|
421 | void |
---|
422 | store_select(struct in_cmd* cmd) |
---|
423 | { |
---|
424 | #ifdef _ONLINE |
---|
425 | char *sdds_pattern; |
---|
426 | char sdum[1000]; |
---|
427 | #endif |
---|
428 | char* flag_name; |
---|
429 | struct name_list* nl = cmd->clone->par_names; |
---|
430 | struct command_parameter_list* pl = cmd->clone->par; |
---|
431 | struct command_list* scl; |
---|
432 | int pos = name_list_pos("flag", nl); |
---|
433 | if (nl->inform[pos] == 0 || |
---|
434 | (flag_name = pl->parameters[pos]->string) == NULL) |
---|
435 | { |
---|
436 | warning("no FLAG specified", "ignored"); |
---|
437 | return; |
---|
438 | } |
---|
439 | if (strcmp(flag_name, "seqedit") == 0) |
---|
440 | { |
---|
441 | if (log_val("clear", cmd->clone)) |
---|
442 | { |
---|
443 | delete_command_list(seqedit_select); |
---|
444 | seqedit_select = new_command_list("seqedit_select", 10); |
---|
445 | selected_ranges->curr = 0; |
---|
446 | selected_ranges->list->curr = 0; |
---|
447 | } |
---|
448 | else |
---|
449 | { |
---|
450 | if (seqedit_select->curr == seqedit_select->max) |
---|
451 | grow_command_list(seqedit_select); |
---|
452 | seqedit_select->commands[seqedit_select->curr++] = cmd->clone; |
---|
453 | cmd->clone_flag = 1; /* do not drop */ |
---|
454 | } |
---|
455 | } |
---|
456 | else if (strcmp(flag_name, "error") == 0) |
---|
457 | { |
---|
458 | if (log_val("clear", cmd->clone)) |
---|
459 | { |
---|
460 | delete_command_list(error_select); |
---|
461 | error_select = new_command_list("error_select", 10); |
---|
462 | selected_ranges->curr = 0; |
---|
463 | selected_ranges->list->curr = 0; |
---|
464 | reset_errors(current_sequ); |
---|
465 | } |
---|
466 | else |
---|
467 | { |
---|
468 | if (error_select->curr == error_select->max) |
---|
469 | grow_command_list(error_select); |
---|
470 | error_select->commands[error_select->curr++] = cmd->clone; |
---|
471 | cmd->clone_flag = 1; /* do not drop */ |
---|
472 | } |
---|
473 | } |
---|
474 | else if (strcmp(flag_name, "sdds") == 0) |
---|
475 | #ifdef _ONLINE |
---|
476 | { |
---|
477 | if (log_val("clear", cmd->clone)) |
---|
478 | { |
---|
479 | if (get_option("debug")) printf("here CLEAR all selected arrays\n"); |
---|
480 | if(sdds_pat != NULL) sdds_pat = delete_char_p_array(sdds_pat, 1); |
---|
481 | } |
---|
482 | else |
---|
483 | { |
---|
484 | if(sdds_pat == NULL) sdds_pat = new_char_p_array(100); |
---|
485 | if (get_option("debug")) printf("current selections %d\n",sdds_pat->curr); |
---|
486 | sdds_pattern = command_par_string("pattern",cmd->clone); |
---|
487 | if(sdds_pattern != NULL) { |
---|
488 | if (get_option("debug")) printf("pattern in select: %s\n",sdds_pattern); |
---|
489 | strcpy(sdum,sdds_pattern); |
---|
490 | sdds_pat->p[sdds_pat->curr++] = tmpbuff(sdum); |
---|
491 | } |
---|
492 | } |
---|
493 | } |
---|
494 | #else |
---|
495 | { |
---|
496 | warning("ignored, only available in ONLINE model:", "FLAG=SDDS"); |
---|
497 | } |
---|
498 | #endif |
---|
499 | |
---|
500 | else if (strcmp(flag_name, "makethin") == 0) |
---|
501 | { |
---|
502 | if (log_val("clear", cmd->clone)) |
---|
503 | { |
---|
504 | slice_select->curr = 0; |
---|
505 | } |
---|
506 | else |
---|
507 | { |
---|
508 | if (slice_select->curr == slice_select->max) |
---|
509 | grow_command_list(slice_select); |
---|
510 | slice_select->commands[slice_select->curr++] = cmd->clone; |
---|
511 | cmd->clone_flag = 1; /* do not drop */ |
---|
512 | } |
---|
513 | } |
---|
514 | else if (strcmp(flag_name, "save") == 0) |
---|
515 | { |
---|
516 | if (log_val("clear", cmd->clone)) |
---|
517 | { |
---|
518 | save_select->curr = 0; |
---|
519 | } |
---|
520 | else |
---|
521 | { |
---|
522 | if (save_select->curr == save_select->max) |
---|
523 | grow_command_list(save_select); |
---|
524 | save_select->commands[save_select->curr++] = cmd->clone; |
---|
525 | cmd->clone_flag = 1; /* do not drop */ |
---|
526 | } |
---|
527 | } |
---|
528 | else if (strcmp(flag_name, "sectormap") == 0) |
---|
529 | { |
---|
530 | if (sector_ranges == NULL) sector_ranges = new_node_list(10000); |
---|
531 | if (log_val("clear", cmd->clone)) |
---|
532 | { |
---|
533 | delete_command_list(sector_select); |
---|
534 | sector_select = new_command_list("sector_select", 10); |
---|
535 | sector_ranges->curr = 0; |
---|
536 | sector_ranges->list->curr = 0; |
---|
537 | } |
---|
538 | else |
---|
539 | { |
---|
540 | if (sector_select->curr == sector_select->max) |
---|
541 | grow_command_list(sector_select); |
---|
542 | sector_select->commands[sector_select->curr++] = cmd->clone; |
---|
543 | cmd->clone_flag = 1; /* do not drop */ |
---|
544 | } |
---|
545 | } |
---|
546 | else /* store select for all tables */ |
---|
547 | { |
---|
548 | if ((scl = find_command_list(flag_name, table_select)) == NULL) |
---|
549 | { |
---|
550 | scl = new_command_list("select", 10); |
---|
551 | add_to_command_list_list(flag_name, scl, table_select); |
---|
552 | } |
---|
553 | if (log_val("clear", cmd->clone)) |
---|
554 | { |
---|
555 | scl = new_command_list("select", 10); |
---|
556 | add_to_command_list_list(flag_name, scl, table_select); |
---|
557 | } |
---|
558 | else |
---|
559 | { |
---|
560 | if (scl->curr == scl->max) grow_command_list(scl); |
---|
561 | scl->commands[scl->curr++] = cmd->clone; |
---|
562 | cmd->clone_flag = 1; /* do not drop */ |
---|
563 | } |
---|
564 | } |
---|
565 | } |
---|
566 | |
---|
567 | |
---|