#ifdef NEVER void fix_redirects(int p, int *fixes, int parent) { int i; int disp; int this; int kids; if (p == -1) return; if (AST[p] == -1) return; if ((astop(p) < AST_BASE) || (astop(p) > AST_TOP)) return; kids = children(p); disp = op[astop(p)-AST_BASE].Display_Children; this = 1<<(kids-1); for (i = 0; i < kids; i++) { if ((nthchild(p, i) != -1) && (disp&this)) { if (astop(nthchild(p, i)) == AST_REDIRECT) { // if (p == leftchild(nthchild(p, i))) return; // HACK IN LIEU OF BUGFIX fprintf(stderr, "%d: redirect from %d to %d (parent=%d)\n", p, nthchild(p, i), leftchild(nthchild(p, i)), parent); (*fixes) = (*fixes) + 1; nthchild(p, i) = leftchild(nthchild(p, i)); return; } fix_redirects(nthchild(p, i), fixes, p); } this = this>>1; } } //Call the above like this: // for (;;) { // fixes = 0; fix_redirects(p, &fixes, -1); fprintf(stdout, "C: %d fixes\n", fixes); // if (fixes == 0) break; // } #endif void tweak_booleans(int p) { int fixes; tweak_booleans1(p); fixup(p); tweak_booleans2(p); fixup(p); tweak_booleans3(p, FALSE); fixup(p); } #undef fixup