19 # ifndef SEARCH_MEMORY_LEAKS_ENABLED
20 # error SEARCH NOT ENABLED
22 # define new DEBUG_NEW
24 static char THIS_FILE[] = __FILE__;
35 list<pq_leaf*>::const_iterator
it;
36 list<pq_leaf*>::const_iterator
end = li.end();
40 for (it = li.begin(); it !=
end; ++
it) {
68 int blocked_siblings = 0;
75 list<pq_leaf*>::const_iterator
it = leaves.begin();
76 list<pq_leaf*>::const_iterator lend = leaves.end();
89 while (size + block_count + off_the_top > 1) {
113 blocked_siblings = 0;
123 }
else if (prev != end) {
135 blocked_siblings = 0;
169 while (next != end) {
190 while (prev != end) {
211 block_count -= blocked_siblings;
234 block_count += 1 - blocked_siblings;
252 list<pq_leaf*>::iterator l_it = leaves.begin();
253 list<pq_leaf*>::iterator l_end = leaves.end();
256 while (l_it != l_end ) {
266 while (!(*it)->is_endmost) {
281 (*it)->father = father;
312 l_it = leaves.begin();
314 while (l_it != l_end ) {
318 l_it = leaves.erase (l_it);
363 }
else if (le->
father == other) {
402 list<pq_leaf*>::iterator l_it = leaves.begin();
403 list<pq_leaf*>::iterator l_end = leaves.end();
405 while (l_it != l_end ) {
414 while (!qu.empty()) {
462 (*first)->father =
pseudo;
504 if (
P1 (tmp->
P(),
true)) {
506 }
else if (
P2 (tmp->
P())) {
508 }
else if (
P4 (tmp->
P())) {
510 }
else if (
P6 (tmp->
P())) {
524 }
else if (
Q1 (tmp->
Q(),
true)) {
526 }
else if (
Q2 (tmp->
Q(),
true)) {
528 }
else if (
Q3 (tmp->
Q())) {
545 while (!(*it)->is_endmost) {
594 if (
P1 (tmp->
P(),
false)) {
596 }
else if (
P3 (tmp->
P())) {
598 }
else if (
P5 (tmp->
P())) {
612 }
else if (
Q1 (tmp->
Q(),
false)) {
614 }
else if (
Q2 (tmp->
Q(),
false)) {
633 if (father == fail) {
682 list<direction_indicator>& dirs)
700 if (++tmp == ++(dir->
pos)) {
706 dirs.push_back (*dir);
723 list<pq_leaf*>::const_iterator
it;
724 list<pq_leaf*>::const_iterator
end = li.end();
728 for (it = li.begin(); it !=
end; ++
it) {
737 sons.
erase (tmp->pos);
740 ins =
new p_node(_n,
id, sons);
751 while (tmp != sons_end) {
764 while (tmp != sons_end) {
784 if (++tmp == ++(dir->
pos)) {
790 dirs->push_back (*dir);
792 dfs (*it, *em, *dirs);
852 list<direction_indicator>& dirs)
1348 if (!tree.
root)
return os;
1351 pair<pq_node*,int>
tmp;
1352 queue<pair<pq_node*,int> > qu;
1355 os <<
"graph [\n" <<
"directed 1" << endl;
1357 tmp.first = tree.
root;
1362 while (!qu.empty()) {
1370 for (; it !=
end; ++
it) {
1372 act->
write (os,
id);
1374 os <<
"edge [\n" <<
"source " << tmp.second << endl;
1375 os <<
"target " <<
id <<
"\n]" << endl;
1377 qu.push (pair<pq_node*,int> (act,
id));
1387 for (; it !=
end; ++
it) {
1389 act->
write (os,
id);
1391 os <<
"edge [\n" <<
"source " << tmp.second << endl;
1392 os <<
"target " <<
id <<
"\n]" << endl;
1394 qu.push (pair<pq_node*,int> (act,
id));
1401 for (; it !=
end; ++
it) {
1403 act->
write (os,
id);
1405 os <<
"edge [\n" <<
"source " << tmp.second << endl;
1406 os <<
"target " <<
id <<
"\n]" << endl;
1408 qu.push (pair<pq_node*,int> (act,
id));
1436 if (!
root)
return true;
1442 while (!qu.empty()) {
1452 int endmost_count = 0;
1454 for (; it !=
end; ++
it) {
1456 if ((*it)->is_endmost) {
1459 if ((*it)->father != tmp) {
1466 if ((*it)->pos != it) {
1495 if (endmost_count == 2) {