diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2016-02-18 19:51:19 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2016-02-18 19:51:19 +0200 |
commit | d72ecc9b4250d05b7ed635815515c3816fbde8fb (patch) | |
tree | b63feca1c64d88bf23a3f8c70bd8c7c41cf583e0 | |
parent | eaec4c7a7ca63e0123ee8bddba7aef632c5e47ef (diff) | |
parent | 8635225f337cc96b28b411a7599962503059cc25 (diff) | |
download | egawk-d72ecc9b4250d05b7ed635815515c3816fbde8fb.tar.gz egawk-d72ecc9b4250d05b7ed635815515c3816fbde8fb.tar.bz2 egawk-d72ecc9b4250d05b7ed635815515c3816fbde8fb.zip |
Merge branch 'gawk-4.1-stable'
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | profile.c | 109 | ||||
-rw-r--r-- | test/ChangeLog | 4 | ||||
-rw-r--r-- | test/profile2.ok | 154 | ||||
-rw-r--r-- | test/profile5.ok | 648 |
5 files changed, 407 insertions, 518 deletions
@@ -1,3 +1,13 @@ +2016-02-18 Arnold D. Robbins <arnold@skeeve.com> + + Fix profile / pretty-printing to chain else-ifs. + + * profile.c (pprint): Change third argument into a set of flags + for in the for header or in an else if. Adjust case Op_K_else to + make the right checks and format the code properly. In Op_K_if + clear the flag so that any following else gets indented properly. + Adjust all calls. + 2016-02-14 Arnold D. Robbins <arnold@skeeve.com> * README, NEWS: Updated to reflect use of Texinfo 6.1. @@ -25,7 +25,7 @@ #include "awk.h" -static void pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool in_for_header); +static void pprint(INSTRUCTION *startp, INSTRUCTION *endp, int flags); static void end_line(INSTRUCTION *ip); static void pp_parenthesize(NODE *n); static void parenthesize(int type, NODE *left, NODE *right); @@ -39,7 +39,6 @@ static bool is_scalar(int type); static int prec_level(int type); static void pp_push(int type, char *s, int flag); static NODE *pp_pop(void); -static void pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool in_for_header); static void print_comment(INSTRUCTION *pc, long in); const char *redir2str(int redirtype); @@ -61,9 +60,12 @@ static FILE *prof_fp; /* where to send the profile */ static long indent_level = 0; - #define SPACEOVER 0 +#define NO_PPRINT_FLAGS 0 +#define IN_FOR_HEADER 1 +#define IN_ELSE_IF 2 + /* set_prof_file --- set the output file for profiling or pretty-printing */ void @@ -193,7 +195,7 @@ pp_free(NODE *n) /* pprint --- pretty print a program segment */ static void -pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool in_for_header) +pprint(INSTRUCTION *startp, INSTRUCTION *endp, int flags) { INSTRUCTION *pc; NODE *t1; @@ -250,7 +252,7 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool in_for_header) ip1 = pc->nexti; indent(ip1->exec_count); if (ip1 != (pc + 1)->firsti) { /* non-empty pattern */ - pprint(ip1->nexti, (pc + 1)->firsti, false); + pprint(ip1->nexti, (pc + 1)->firsti, NO_PPRINT_FLAGS); /* Allow for case where the "pattern" is just a comment */ if (ip1->nexti->nexti->nexti != (pc +1)->firsti || ip1->nexti->opcode != Op_comment) { @@ -274,7 +276,7 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool in_for_header) ip1 = ip1->nexti; } indent_in(); - pprint(ip1, ip2, false); + pprint(ip1, ip2, NO_PPRINT_FLAGS); indent_out(); if (do_profile) indent(0); @@ -363,7 +365,7 @@ pprint(INSTRUCTION *startp, INSTRUCTION *endp, bool in_for_header) cleanup: pp_free(t2); pp_free(t1); - if (! in_for_header) + if ((flags & IN_FOR_HEADER) == 0) end_line(pc); break; @@ -385,7 +387,7 @@ cleanup: case Op_and: case Op_or: - pprint(pc->nexti, pc->target_jmp, in_for_header); + pprint(pc->nexti, pc->target_jmp, flags); t2 = pp_pop(); t1 = pp_pop(); parenthesize(pc->opcode, t1, t2); @@ -489,7 +491,7 @@ cleanup: fprintf(prof_fp, "$%s%s%s", t1->pp_str, op2str(pc->opcode), t2->pp_str); pp_free(t2); pp_free(t1); - if (! in_for_header) + if ((flags & IN_FOR_HEADER) == 0) end_line(pc); break; @@ -510,7 +512,7 @@ cleanup: efree(sub); } else fprintf(prof_fp, "%s %s", op2str(Op_K_delete), array); - if (! in_for_header) + if ((flags & IN_FOR_HEADER) == 0) end_line(pc); pp_free(t1); } @@ -622,7 +624,7 @@ cleanup: } else fprintf(prof_fp, "%s%s", op2str(pc->opcode), tmp); efree(tmp); - if (! in_for_header) + if ((flags & IN_FOR_HEADER) == 0) end_line(pc); break; @@ -748,15 +750,15 @@ cleanup: case Op_pop: t1 = pp_pop(); fprintf(prof_fp, "%s", t1->pp_str); - if (! in_for_header) + if ((flags & IN_FOR_HEADER) == 0) end_line(pc); pp_free(t1); break; case Op_line_range: ip1 = pc + 1; - pprint(pc->nexti, ip1->condpair_left, false); - pprint(ip1->condpair_left->nexti, ip1->condpair_right, false); + pprint(pc->nexti, ip1->condpair_left, NO_PPRINT_FLAGS); + pprint(ip1->condpair_left->nexti, ip1->condpair_right, NO_PPRINT_FLAGS); t2 = pp_pop(); t1 = pp_pop(); str = pp_group3(t1->pp_str, ", ", t2->pp_str); @@ -770,12 +772,12 @@ cleanup: ip1 = pc + 1; indent(ip1->while_body->exec_count); fprintf(prof_fp, "%s (", op2str(pc->opcode)); - pprint(pc->nexti, ip1->while_body, false); + pprint(pc->nexti, ip1->while_body, NO_PPRINT_FLAGS); t1 = pp_pop(); fprintf(prof_fp, "%s) {\n", t1->pp_str); pp_free(t1); indent_in(); - pprint(ip1->while_body->nexti, pc->target_break, false); + pprint(ip1->while_body->nexti, pc->target_break, NO_PPRINT_FLAGS); indent_out(); indent(SPACEOVER); fprintf(prof_fp, "}\n"); @@ -787,9 +789,9 @@ cleanup: indent(pc->nexti->exec_count); fprintf(prof_fp, "%s {\n", op2str(pc->opcode)); indent_in(); - pprint(pc->nexti->nexti, ip1->doloop_cond, false); + pprint(pc->nexti->nexti, ip1->doloop_cond, NO_PPRINT_FLAGS); indent_out(); - pprint(ip1->doloop_cond, pc->target_break, false); + pprint(ip1->doloop_cond, pc->target_break, NO_PPRINT_FLAGS); indent(SPACEOVER); t1 = pp_pop(); fprintf(prof_fp, "} %s (%s)\n", op2str(Op_K_while), t1->pp_str); @@ -808,24 +810,24 @@ cleanup: && pc->target_continue->opcode == Op_jmp) { fprintf(prof_fp, ";;"); } else { - pprint(pc->nexti, ip1->forloop_cond, true); + pprint(pc->nexti, ip1->forloop_cond, IN_FOR_HEADER); fprintf(prof_fp, "; "); if (ip1->forloop_cond->opcode == Op_no_op && ip1->forloop_cond->nexti == ip1->forloop_body) fprintf(prof_fp, "; "); else { - pprint(ip1->forloop_cond, ip1->forloop_body, true); + pprint(ip1->forloop_cond, ip1->forloop_body, IN_FOR_HEADER); t1 = pp_pop(); fprintf(prof_fp, "%s; ", t1->pp_str); pp_free(t1); } - pprint(pc->target_continue, pc->target_break, true); + pprint(pc->target_continue, pc->target_break, IN_FOR_HEADER); } fprintf(prof_fp, ") {\n"); indent_in(); - pprint(ip1->forloop_body->nexti, pc->target_continue, false); + pprint(ip1->forloop_body->nexti, pc->target_continue, NO_PPRINT_FLAGS); indent_out(); indent(SPACEOVER); fprintf(prof_fp, "}\n"); @@ -850,7 +852,7 @@ cleanup: item, op2str(Op_in_array), array); indent_in(); pp_free(t1); - pprint(ip1->forloop_body->nexti, pc->target_break, false); + pprint(ip1->forloop_body->nexti, pc->target_break, NO_PPRINT_FLAGS); indent_out(); indent(SPACEOVER); fprintf(prof_fp, "}\n"); @@ -861,11 +863,11 @@ cleanup: case Op_K_switch: ip1 = pc + 1; fprintf(prof_fp, "%s (", op2str(pc->opcode)); - pprint(pc->nexti, ip1->switch_start, false); + pprint(pc->nexti, ip1->switch_start, NO_PPRINT_FLAGS); t1 = pp_pop(); fprintf(prof_fp, "%s) {\n", t1->pp_str); pp_free(t1); - pprint(ip1->switch_start, ip1->switch_end, false); + pprint(ip1->switch_start, ip1->switch_end, NO_PPRINT_FLAGS); indent(SPACEOVER); fprintf(prof_fp, "}\n"); pc = pc->target_break; @@ -881,13 +883,13 @@ cleanup: } else fprintf(prof_fp, "%s:\n", op2str(pc->opcode)); indent_in(); - pprint(pc->stmt_start->nexti, pc->stmt_end->nexti, false); + pprint(pc->stmt_start->nexti, pc->stmt_end->nexti, NO_PPRINT_FLAGS); indent_out(); break; case Op_K_if: fprintf(prof_fp, "%s (", op2str(pc->opcode)); - pprint(pc->nexti, pc->branch_if, false); + pprint(pc->nexti, pc->branch_if, NO_PPRINT_FLAGS); t1 = pp_pop(); fprintf(prof_fp, "%s) {", t1->pp_str); pp_free(t1); @@ -897,22 +899,47 @@ cleanup: fprintf(prof_fp, " # %ld", ip1->exec_count); end_line(pc); indent_in(); - pprint(ip1->nexti, pc->branch_else, false); + pprint(ip1->nexti, pc->branch_else, NO_PPRINT_FLAGS); indent_out(); pc = pc->branch_else; - if (pc->nexti->opcode == Op_no_op) { + if (pc->nexti->opcode == Op_no_op) { /* no following else */ indent(SPACEOVER); fprintf(prof_fp, "}\n"); } + /* + * See next case; turn off the flag so that the + * following else is correctly indented. + */ + flags &= ~IN_ELSE_IF; break; case Op_K_else: - fprintf(prof_fp, "} %s {\n", op2str(pc->opcode)); - indent_in(); - pprint(pc->nexti, pc->branch_end, false); - indent_out(); - indent(SPACEOVER); - fprintf(prof_fp, "}\n"); + /* + * If possible, chain else-if's together on the + * same line. + * + * See awkgram.y:mk_condition to understand + * what is being checked here. + * + * Op_exec_count follows Op_K_else, check the + * opcode of the following instruction. + * Additionally, check that the subsequent if + * terminates where this else does; in that case + * it's ok to compact the if to follow the else. + */ + + fprintf(prof_fp, "} %s ", op2str(pc->opcode)); + if (pc->nexti->nexti->opcode == Op_K_if + && pc->branch_end == pc->nexti->nexti->branch_else->lasti) { + pprint(pc->nexti, pc->branch_end, IN_ELSE_IF); + } else { + fprintf(prof_fp, "{\n", op2str(pc->opcode)); + indent_in(); + pprint(pc->nexti, pc->branch_end, NO_PPRINT_FLAGS); + indent_out(); + indent(SPACEOVER); + fprintf(prof_fp, "}\n"); + } pc = pc->branch_end; break; @@ -921,14 +948,14 @@ cleanup: NODE *f, *t, *cond; size_t len; - pprint(pc->nexti, pc->branch_if, false); + pprint(pc->nexti, pc->branch_if, NO_PPRINT_FLAGS); ip1 = pc->branch_if; - pprint(ip1->nexti, pc->branch_else, false); + pprint(ip1->nexti, pc->branch_else, NO_PPRINT_FLAGS); ip1 = pc->branch_else->nexti; pc = ip1->nexti; assert(pc->opcode == Op_cond_exp); - pprint(pc->nexti, pc->branch_end, false); + pprint(pc->nexti, pc->branch_end, NO_PPRINT_FLAGS); f = pp_pop(); t = pp_pop(); @@ -947,7 +974,7 @@ cleanup: break; case Op_exec_count: - if (! in_for_header) + if (flags == NO_PPRINT_FLAGS) indent(pc->exec_count); break; @@ -1097,7 +1124,7 @@ dump_prog(INSTRUCTION *code) if (do_profile) fprintf(prof_fp, _("\t# gawk profile, created %s\n"), ctime(& now)); print_lib_list(prof_fp); - pprint(code, NULL, false); + pprint(code, NULL, NO_PPRINT_FLAGS); } /* prec_level --- return the precedence of an operator, for paren tests */ @@ -1708,7 +1735,7 @@ pp_func(INSTRUCTION *pc, void *data ATTRIBUTE_UNUSED) indent(0); fprintf(prof_fp, "{\n"); indent_in(); - pprint(fp, NULL, false); /* function body */ + pprint(fp, NULL, NO_PPRINT_FLAGS); /* function body */ indent_out(); if (do_profile) indent(0); diff --git a/test/ChangeLog b/test/ChangeLog index cc8b93e4..66bed645 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2016-02-18 Arnold D. Robbins <arnold@skeeve.com> + + * profile2.ok, profile5.ok: Adjust after code changes. + 2016-02-05 Arnold D. Robbins <arnold@skeeve.com> * badargs.ok: Update after adding Yet Another Command Line Option. diff --git a/test/profile2.ok b/test/profile2.ok index 938d6858..1db4c2f0 100644 --- a/test/profile2.ok +++ b/test/profile2.ok @@ -12,62 +12,46 @@ 571 nextstate = substr(machine[state symb], 1, 1) 571 act = substr(machine[state symb], 2, 1) 571 if (act == "0") { # 12 - 559 } else { - 559 if (act == "1") { # 8 - 8 if (! inarray(tok, names)) { # 3 - 3 names[++nnames] = tok + 559 } else if (act == "1") { # 8 + 8 if (! inarray(tok, names)) { # 3 + 3 names[++nnames] = tok + } + 8 lines[tok, ++xnames[tok]] = NR + 551 } else if (act == "2") { # 426 + 426 if (tok in local) { # 309 + 309 tok = tok "(" funcname ")" + 309 if (! inarray(tok, names)) { # 22 + 22 names[++nnames] = tok + } + 309 lines[tok, ++xnames[tok]] = NR + 117 } else { + 117 tok = tok "()" + 117 if (! inarray(tok, names)) { # 22 + 22 names[++nnames] = tok } - 8 lines[tok, ++xnames[tok]] = NR - 551 } else { - 551 if (act == "2") { # 426 - 426 if (tok in local) { # 309 - 309 tok = tok "(" funcname ")" - 309 if (! inarray(tok, names)) { # 22 - 22 names[++nnames] = tok - } - 309 lines[tok, ++xnames[tok]] = NR - 117 } else { - 117 tok = tok "()" - 117 if (! inarray(tok, names)) { # 22 - 22 names[++nnames] = tok - } - 117 lines[tok, ++xnames[tok]] = NR - } - 125 } else { - 125 if (act == "3") { # 4 - 4 funcname = tok - 4 flines[tok] = NR - 121 } else { - 121 if (act == "4") { # 49 - 49 braces++ - 72 } else { - 72 if (act == "5") { # 49 - 49 braces-- - 49 if (braces == 0) { # 4 - 22 for (temp in local) { - 22 delete local[temp] - } - 4 funcname = "" - 4 nextstate = 1 - } - 23 } else { - 23 if (act == "6") { # 22 - 22 local[tok] = 1 - 1 } else { - 1 if (act == "7") { # 1 - 1 break - } else { - if (act == "8") { - print("error: xref.awk: line " NR ": aborting") > "/dev/con" - exit 1 - } - } - } - } - } - } + 117 lines[tok, ++xnames[tok]] = NR + } + 125 } else if (act == "3") { # 4 + 4 funcname = tok + 4 flines[tok] = NR + 121 } else if (act == "4") { # 49 + 49 braces++ + 72 } else if (act == "5") { # 49 + 49 braces-- + 49 if (braces == 0) { # 4 + 22 for (temp in local) { + 22 delete local[temp] } + 4 funcname = "" + 4 nextstate = 1 } + 23 } else if (act == "6") { # 22 + 22 local[tok] = 1 + 1 } else if (act == "7") { # 1 + 1 break + } else if (act == "8") { + print("error: xref.awk: line " NR ": aborting") > "/dev/con" + exit 1 } 570 state = nextstate } @@ -127,44 +111,34 @@ 4 tok = "function" 4 line = substr(line, 9) 4 return 1 - 1697 } else { - 1697 if (line ~ /^{/) { # 53 - 53 tok = "{" - 53 line = substr(line, 2) - 53 return 2 - 1644 } else { - 1644 if (line ~ /^}/) { # 53 - 53 tok = "}" - 53 line = substr(line, 2) - 53 return 3 - 1591 } else { - 1591 if (match(line, /^[[:alpha:]_][[:alnum:]]*\[/)) { # 43 - 43 tok = substr(line, 1, RLENGTH - 1) - 43 line = substr(line, RLENGTH + 1) - 43 return 5 - 1548 } else { - 1548 if (match(line, /^[[:alpha:]_][[:alnum:]]*\(/)) { # 87 - 87 tok = substr(line, 1, RLENGTH - 1) - 87 line = substr(line, RLENGTH + 1) - 87 if (! (tok in keywords)) { # 12 - 12 return 6 - } - 1461 } else { - 1461 if (match(line, /^[[:alpha:]_][[:alnum:]]*/)) { # 525 - 525 tok = substr(line, 1, RLENGTH) - 525 line = substr(line, RLENGTH + 1) - 525 if (! (tok in keywords)) { # 405 - 405 return 4 - } - 936 } else { - 936 match(line, /^[^[:alpha:]_{}]/) - 936 tok = substr(line, 1, RLENGTH) - 936 line = substr(line, RLENGTH + 1) - } - } - } - } + 1697 } else if (line ~ /^{/) { # 53 + 53 tok = "{" + 53 line = substr(line, 2) + 53 return 2 + 1644 } else if (line ~ /^}/) { # 53 + 53 tok = "}" + 53 line = substr(line, 2) + 53 return 3 + 1591 } else if (match(line, /^[[:alpha:]_][[:alnum:]]*\[/)) { # 43 + 43 tok = substr(line, 1, RLENGTH - 1) + 43 line = substr(line, RLENGTH + 1) + 43 return 5 + 1548 } else if (match(line, /^[[:alpha:]_][[:alnum:]]*\(/)) { # 87 + 87 tok = substr(line, 1, RLENGTH - 1) + 87 line = substr(line, RLENGTH + 1) + 87 if (! (tok in keywords)) { # 12 + 12 return 6 + } + 1461 } else if (match(line, /^[[:alpha:]_][[:alnum:]]*/)) { # 525 + 525 tok = substr(line, 1, RLENGTH) + 525 line = substr(line, RLENGTH + 1) + 525 if (! (tok in keywords)) { # 405 + 405 return 4 } + 936 } else { + 936 match(line, /^[^[:alpha:]_{}]/) + 936 tok = substr(line, 1, RLENGTH) + 936 line = substr(line, RLENGTH + 1) } } } diff --git a/test/profile5.ok b/test/profile5.ok index d6e8d1b5..95c77401 100644 --- a/test/profile5.ok +++ b/test/profile5.ok @@ -773,15 +773,11 @@ function _BASE(c, t, P, A) if (match(t, /^((--([Vv])ersion)|(-([Vv])))[ \t]*/, A)) { t = substr(t, RLENGTH + 1) _cmdln_version = A[3] A[5] - } else { - if (match(t, /^((-?\?)|(--help))[ \t]*/)) { - t = substr(t, RLENGTH + 1) - _cmdln_help = 1 - } else { - if (match(t, /^--[ \t]*/)) { - return _endpass(substr(t, RLENGTH + 1)) - } - } + } else if (match(t, /^((-?\?)|(--help))[ \t]*/)) { + t = substr(t, RLENGTH + 1) + _cmdln_help = 1 + } else if (match(t, /^--[ \t]*/)) { + return _endpass(substr(t, RLENGTH + 1)) } return t #___________________________________________________________ @@ -1389,11 +1385,9 @@ function _Zimport(t, p, A, c, i, n, B) _tLOG[n = _wLCHLD(p, _N())][""] delete _tLOG[n][""] _Zimparr(_tLOG[n], substr(t, 10)) - } else { - if ((t = _pass(_IMPORT, t, p, A)) != "") { - gsub(/\x1B\x3B/, "\033", t) - _wLCHLD(p, _N(_tSTR, t)) - } + } else if ((t = _pass(_IMPORT, t, p, A)) != "") { + gsub(/\x1B\x3B/, "\033", t) + _wLCHLD(p, _N(_tSTR, t)) } } return p @@ -1622,10 +1616,8 @@ function _cfguid(p, optr, pfx, sfx, hstrcnt, lstrchr) if (optr == p) { delete _UIDOBLV[p] delete _UIDOBLV[_UIDOBLV[_UIDOBL[p] = p][""] = p][""] - } else { - if (optr in _UIDOBL) { - _UIDOBL[p] = _UIDOBL[optr] - } + } else if (optr in _UIDOBL) { + _UIDOBL[p] = _UIDOBL[optr] } } _UIDPFX[p] = (_istr(pfx) ? pfx : "") @@ -1723,11 +1715,9 @@ function _cmparr(A0, A1, R, a, i) if (! (i in A1)) { a++ R[i] = 0 - } else { - if (A0[i] != A1[i]) { - a++ - R[i] = 2 - } + } else if (A0[i] != A1[i]) { + a++ + R[i] = 2 } } for (i in A1) { @@ -1909,10 +1899,8 @@ function _defescarr(D, r, S, i, c, t) if ((c = _CHR[i]) ~ r) { D[c] = "\\" S[c] t = t c - } else { - if (D[c] == "") { - D[c] = c - } + } else if (D[c] == "") { + D[c] = c } } } else { @@ -1922,10 +1910,8 @@ function _defescarr(D, r, S, i, c, t) if (S != "") { t = t c } - } else { - if (D[c] == "") { - D[c] = c - } + } else if (D[c] == "") { + D[c] = c } } } @@ -2106,10 +2092,8 @@ function _dirtree_i0(B, i, c, A, f, lf, a, C) } else { return i } - } else { - if (match(B[i++], /^([^ \t\-]+)\-([^ \t\-]+)\-([^ \t]+)[ \t]+([^ \t]+)[ \t]+([0-9]+)[ \t]+(.+)$/, C)) { - A[f][f C[6]] = C[5] " " C[1] "/" _CHR["MONTH"][C[2]] "/" C[3] " " C[4] - } + } else if (match(B[i++], /^([^ \t\-]+)\-([^ \t\-]+)\-([^ \t]+)[ \t]+([^ \t]+)[ \t]+([0-9]+)[ \t]+(.+)$/, C)) { + A[f][f C[6]] = C[5] " " C[1] "/" _CHR["MONTH"][C[2]] "/" C[3] " " C[4] } } return i @@ -2125,13 +2109,11 @@ function _dll_check(pp) if (_dllchktv != _[pp][".Product Version"]) { _dllerr(_[pp]["AGENT"], "agent version (" _[pp][".Product Version"] ") do not match all lib versions: " _dllchktv "'") } + } else if (! _missfl) { + _creport(pp, "agent not detected in registry") } else { - if (! _missfl) { - _creport(pp, "agent not detected in registry") - } else { - _dllerr(pp, "agent not detected in registry but some registry entries exist:") - _tframe("_dll_check_i1", pp, pp) - } + _dllerr(pp, "agent not detected in registry but some registry entries exist:") + _tframe("_dll_check_i1", pp, pp) } } @@ -2168,10 +2150,8 @@ function _dll_check_i0(p, R, pp, p2, i, i2, r, f, v, rs, d, tv, tf) } else { if (_dllchktv == "") { _dllchktv = v - } else { - if (v != _dllchktv) { - return _dllerr(p, "different versions detected: " _dllchktv "!=" v "'") - } + } else if (v != _dllchktv) { + return _dllerr(p, "different versions detected: " _dllchktv "!=" v "'") } ERRNO = "" if (_th1(_[p]["DATA"] = _rdfile(f), ERRNO)) { @@ -2652,13 +2632,11 @@ function _file_check_i0(p, pp, p1, p2, f, v) return _dllerr(p, " file version mismatch: ==`" _[p]["VERSION"] "'; !=`" v "'", f) } _creport(p, substr("OK: FILE DETECTED" ((v == "" ? "" : "(" v ")")) ": " f, 1, 122)) - } else { - if (_[p]["TYPE"] == "defdir") { - if (_filexist(f = _[p]["DIR"])) { - _creport(p, substr("OK: DIR DETECTED: " f, 1, 112)) - } else { - _dllerr(p, "directory " f " is not detected") - } + } else if (_[p]["TYPE"] == "defdir") { + if (_filexist(f = _[p]["DIR"])) { + _creport(p, substr("OK: DIR DETECTED: " f, 1, 112)) + } else { + _dllerr(p, "directory " f " is not detected") } } } @@ -3450,14 +3428,12 @@ function _inituid(p, cs, dptr, pfx, sfx, hstr, lstr, A) lstr = A[3] "+" hstr = "" } + } else if (match(cs, /^(([^'\xB4\|]*\xB4.)*[^'\xB4\|]*)(\|(.*))?/, A)) { + hstr = A[1] + lstr = A[4] } else { - if (match(cs, /^(([^'\xB4\|]*\xB4.)*[^'\xB4\|]*)(\|(.*))?/, A)) { - hstr = A[1] - lstr = A[4] - } else { - ERRNO = "_inituid(): bad parameters" - return - } + ERRNO = "_inituid(): bad parameters" + return } _conl(dptr ":" pfx "'" hstr "|" lstr "'" sfx) return _cfguid(p, dptr, pfx, sfx, hstr, lstr) @@ -3831,24 +3807,18 @@ function _nN_i0(p, F, v) F[p][""] delete F[p][""] _copyarr(F[p], v) - } else { - if (! (v == 0 && v == "")) { - F[p] = v - } + } else if (! (v == 0 && v == "")) { + F[p] = v } - } else { - if (! (F == 0 && F == "")) { - if (isarray(v)) { - _[p][F][""] - delete _[p][F][""] - _copyarr(_[p][F], v) - } else { - if (v == 0 && v == "") { - _mpu(F, p) - } else { - _[p][F] = v - } - } + } else if (! (F == 0 && F == "")) { + if (isarray(v)) { + _[p][F][""] + delete _[p][F][""] + _copyarr(_[p][F], v) + } else if (v == 0 && v == "") { + _mpu(F, p) + } else { + _[p][F] = v } } return p @@ -4049,24 +4019,22 @@ function _patharr0(D, q, i, h, A, B) if (RLENGTH > 0) { D["type"] = toupper(substr(A[1], 1, RLENGTH - 1)) _patharr0_i0(i, D, "site", "port") - } else { - if (A[1] == "") { - D["type"] = "UNC" - if (h > 2) { - D["host"] - A[2] = _patharr0_i0(A[2], D, "drive", "", "FILE") - return _patharr0_i1(D, A, 2, q) - } - if (i == "") { - return 1 - } - D["host"] = i - A[3] = _patharr0_i0(A[3], D, "drive", "", "FILE") - } else { - D["type"] = "FILE" - A[1] = _patharr0_i0(A[1], D, "drive") - return _patharr0_i1(D, A, 1, q) + } else if (A[1] == "") { + D["type"] = "UNC" + if (h > 2) { + D["host"] + A[2] = _patharr0_i0(A[2], D, "drive", "", "FILE") + return _patharr0_i1(D, A, 2, q) + } + if (i == "") { + return 1 } + D["host"] = i + A[3] = _patharr0_i0(A[3], D, "drive", "", "FILE") + } else { + D["type"] = "FILE" + A[1] = _patharr0_i0(A[1], D, "drive") + return _patharr0_i1(D, A, 1, q) } return _patharr0_i1(D, A, 3, q) } @@ -4086,10 +4054,8 @@ function _patharr0_i0(t, D, l, r, d, i) D[r] = t } return t - } else { - if (t && r) { - D[l] = t - } + } else if (t && r) { + D[l] = t } return t } @@ -4113,10 +4079,8 @@ function _patharr0_i1(D, A, i, q, t, c) D["name"] = substr(t, 1, RSTART - 1) } D["ext"] = substr(t, RSTART, RLENGTH) - } else { - if (t != "") { - D["name"] = t - } + } else if (t != "") { + D["name"] = t } } return 1 @@ -4244,12 +4208,10 @@ function _qparam(qm, p0, p1, p2, p3, p4, p5, p6, p7) { if (qm == qm + 0 && qm > 0) { _qparamim = substr(" ", 1, qm) + } else if (qm != "") { + _qparamim = qm } else { - if (qm != "") { - _qparamim = qm - } else { - _qparamim = " " - } + _qparamim = " " } _qparamask = "" return _qparam_i0(p0, p1, p2, p3, p4, p5, p6, p7) @@ -4266,16 +4228,12 @@ function _qparam_i0(p0, p1, p2, p3, p4, p5, p6, p7) default: if (isarray(p0)) { _qparama0 = "A" + } else if (p0 == "" && p0 == 0) { + _qparama0 = " " + } else if (_isptr(p0)) { + _qparama0 = "P" } else { - if (p0 == "" && p0 == 0) { - _qparama0 = " " - } else { - if (_isptr(p0)) { - _qparama0 = "P" - } else { - _qparama0 = "S" - } - } + _qparama0 = "S" } case ".": _qparamask = _qparamask _qparama0 @@ -4593,11 +4551,9 @@ function _rdreg_i0(D, A) } else { break } - } else { - if (_rdregp0 ~ /^HK/) { - ++_rdregkey - return D[_rdregp0 = _rdregp0 "\\"] - } + } else if (_rdregp0 ~ /^HK/) { + ++_rdregkey + return D[_rdregp0 = _rdregp0 "\\"] } } return 1 @@ -4686,12 +4642,10 @@ function _reg_check_i0(p, pp, p1, p2) } else { _dllerr(p, substr("REGENTRY NOT MATCH(!=" _[p]["VALUE"] "): " _[p]["REGPATH"], 1, 126)) } + } else if (_VAR[_[p]["REGPATH"]] == _REG[_[p]["REGPATH"]]) { + _creport(p, substr("OK: REGPATH MATCH(==" _VAR[_[p]["REGPATH"]] "): " _[p]["REGPATH"], 1, 126)) } else { - if (_VAR[_[p]["REGPATH"]] == _REG[_[p]["REGPATH"]]) { - _creport(p, substr("OK: REGPATH MATCH(==" _VAR[_[p]["REGPATH"]] "): " _[p]["REGPATH"], 1, 126)) - } else { - _dllerr(p, substr("REGPATH NOT MATCH(!=" _VAR[_[p]["REGPATH"]] "): " _[p]["REGPATH"], 1, 126)) - } + _dllerr(p, substr("REGPATH NOT MATCH(!=" _VAR[_[p]["REGPATH"]] "): " _[p]["REGPATH"], 1, 126)) } } else { _dllerr(p, substr("REGPATH NOT FOUND: " _[p]["REGPATH"], 1, 126)) @@ -4952,26 +4906,24 @@ function _rrdreg(DD, p, k, t, v, c, i, q, tT, A, B, C, D) if (D[7]) { t = "STR" v = _unstr(D[8]) + } else if (D[10]) { + t = "W32" + v = D[11] } else { - if (D[10]) { - t = "W32" - v = D[11] - } else { - v = D[15] - if (D[13]) { - switch (D[14]) { - case "2": - t = "XSZ" - break - case "7": - t = "MSZ" - break - default: - t = "W64" - } - } else { - t = "BIN" + v = D[15] + if (D[13]) { + switch (D[14]) { + case "2": + t = "XSZ" + break + case "7": + t = "MSZ" + break + default: + t = "W64" } + } else { + t = "BIN" } } DD[gensub(/(\\)\\+/, "\\1", "G", p "\\" _unstr(D[3] ((D[5] ? "(Default)" : ""))) "." t)] = v @@ -5202,56 +5154,34 @@ function _shortcut(D, S) if (isarray(D)) { if (isarray(S)) { _addarrmask(D, S, _SHORTCUTWSTRUC) - } else { - if (S == 0 && S == "") { - _addarrmask(D, _SHORTCUTDEFAULT, _SHORTCUTWSTRUC) - } else { - if (_isnotfileptr(S)) { - _addarrmask(D, _[S], _SHORTCUTWSTRUC) - } else { - if (_rd_shortcut(D, S)) { - return - } - } - } + } else if (S == 0 && S == "") { + _addarrmask(D, _SHORTCUTDEFAULT, _SHORTCUTWSTRUC) + } else if (_isnotfileptr(S)) { + _addarrmask(D, _[S], _SHORTCUTWSTRUC) + } else if (_rd_shortcut(D, S)) { + return + } + } else if (D == 0 && D == "") { + return _NOP + } else if (_isnotfileptr(D)) { + if (isarray(S)) { + _addarrmask(_[D], S, _SHORTCUTWSTRUC) + } else if (S == 0 && S == "") { + _addarrmask(_[D], _SHORTCUTDEFAULT, _SHORTCUTWSTRUC) + } else if (_isnotfileptr(S)) { + _addarrmask(_[D], _[S], _SHORTCUTWSTRUC) + } else if (_rd_shortcut(_[D], S)) { + return } } else { - if (D == 0 && D == "") { - return _NOP - } else { - if (_isnotfileptr(D)) { - if (isarray(S)) { - _addarrmask(_[D], S, _SHORTCUTWSTRUC) - } else { - if (S == 0 && S == "") { - _addarrmask(_[D], _SHORTCUTDEFAULT, _SHORTCUTWSTRUC) - } else { - if (_isnotfileptr(S)) { - _addarrmask(_[D], _[S], _SHORTCUTWSTRUC) - } else { - if (_rd_shortcut(_[D], S)) { - return - } - } - } - } - } else { - if (isarray(S) && _wr_shortcut(D, S)) { - return - } else { - if (S == 0 && S == "" && _wr_shortcut(D, _SHORTCUTDEFAULT)) { - return - } else { - if (_isnotfileptr(S) && _wr_shortcut(D, _[S])) { - return - } else { - if (_rd_shortcut(_SHRTCUTA1, S) || _wr_shortcut(D, _SHRTCUTA1)) { - return - } - } - } - } - } + if (isarray(S) && _wr_shortcut(D, S)) { + return + } else if (S == 0 && S == "" && _wr_shortcut(D, _SHORTCUTDEFAULT)) { + return + } else if (_isnotfileptr(S) && _wr_shortcut(D, _[S])) { + return + } else if (_rd_shortcut(_SHRTCUTA1, S) || _wr_shortcut(D, _SHRTCUTA1)) { + return } } return 1 @@ -5273,14 +5203,12 @@ function _shortcut_init(A, B, q) if (match(_SHRTCUTA0[q], /^([^\t]+)\t+([^\t]+)(\t+([^\t]+)(\t+([^\t]+))?)?/, B)) { if (B[3] == "") { _SHORTCUTRSTRUC[B[2]] = B[1] + } else if (B[5] == "") { + _SHORTCUTWSTRUC[_SHORTCUTRSTRUC[B[4]] = B[1]] = B[2] + delete _SHORTCUTDEFAULT[B[1]] } else { - if (B[5] == "") { - _SHORTCUTWSTRUC[_SHORTCUTRSTRUC[B[4]] = B[1]] = B[2] - delete _SHORTCUTDEFAULT[B[1]] - } else { - _SHORTCUTWSTRUC[_SHORTCUTRSTRUC[B[4]] = B[1]] = B[2] - _SHORTCUTDEFAULT[B[1]] = B[6] - } + _SHORTCUTWSTRUC[_SHORTCUTRSTRUC[B[4]] = B[1]] = B[2] + _SHORTCUTDEFAULT[B[1]] = B[6] } } else { _fatal("_shortcut.init: _shortcut_struc: syntax error: `" _SHRTCUTA0[q] "'") @@ -5825,46 +5753,38 @@ function _tbrochld(p, f, pp) } return f } - } else { - if (p in _tPARENT) { - pp = _tPARENT[p] - delete _tPARENT[p] - if (p in _tPREV) { - if (p in _tNEXT) { - _tNEXT[_tPREV[f] = _tPREV[p]] = f = _tNEXT[p] - delete _tNEXT[p] - } else { - delete _tNEXT[_tLCHLD[pp] = _tPREV[p]] - } - delete _tPREV[p] - _tQCHLD[pp]-- + } else if (p in _tPARENT) { + pp = _tPARENT[p] + delete _tPARENT[p] + if (p in _tPREV) { + if (p in _tNEXT) { + _tNEXT[_tPREV[f] = _tPREV[p]] = f = _tNEXT[p] + delete _tNEXT[p] } else { - if (p in _tNEXT) { - delete _tPREV[_tFCHLD[pp] = _tNEXT[p]] - delete _tNEXT[p] - _tQCHLD[pp]-- - } else { - delete _tFCHLD[pp] - delete _tLCHLD[pp] - delete _tQCHLD[pp] - } + delete _tNEXT[_tLCHLD[pp] = _tPREV[p]] } + delete _tPREV[p] + _tQCHLD[pp]-- + } else if (p in _tNEXT) { + delete _tPREV[_tFCHLD[pp] = _tNEXT[p]] + delete _tNEXT[p] + _tQCHLD[pp]-- } else { - if (p in _tPREV) { - if (p in _tNEXT) { - _tNEXT[_tPREV[f] = _tPREV[p]] = f = _tNEXT[p] - delete _tNEXT[p] - } else { - delete _tNEXT[_tPREV[p]] - } - delete _tPREV[p] - } else { - if (p in _tNEXT) { - delete _tPREV[_tNEXT[p]] - delete _tNEXT[p] - } - } + delete _tFCHLD[pp] + delete _tLCHLD[pp] + delete _tQCHLD[pp] + } + } else if (p in _tPREV) { + if (p in _tNEXT) { + _tNEXT[_tPREV[f] = _tPREV[p]] = f = _tNEXT[p] + delete _tNEXT[p] + } else { + delete _tNEXT[_tPREV[p]] } + delete _tPREV[p] + } else if (p in _tNEXT) { + delete _tPREV[_tNEXT[p]] + delete _tNEXT[p] } } return p @@ -5902,10 +5822,8 @@ function _tdel(p, i) for (i in _ptr[p]) { if (isarray(_ptr[p][i])) { _tdel_i1(_ptr[p][i]) - } else { - if (i = _ptr[p][i]) { - _tdel(i) - } + } else if (i = _ptr[p][i]) { + _tdel(i) } } if (p in _tFCHLD) { @@ -5925,10 +5843,8 @@ function _tdel_i0(p, i) for (i in _ptr[p]) { if (isarray(_ptr[p][i])) { _tdel_i1(_ptr[p][i]) - } else { - if (i = _ptr[p][i]) { - _tdel(i) - } + } else if (i = _ptr[p][i]) { + _tdel(i) } } if (p in _tFCHLD) { @@ -5947,10 +5863,8 @@ function _tdel_i1(A, i) for (i in A) { if (isarray(A[i])) { _tdel_i1(A[i]) - } else { - if (i = A[i]) { - _tdel(i) - } + } else if (i = A[i]) { + _tdel(i) } } } @@ -6001,33 +5915,27 @@ function _texclude(p, v, pp) delete _tNEXT[_tLCHLD[pp] = _tPREV[p]] } delete _tPREV[p] + } else if (p in _tNEXT) { + delete _tPREV[_tFCHLD[pp] = _tNEXT[p]] + delete _tNEXT[p] } else { - if (p in _tNEXT) { - delete _tPREV[_tFCHLD[pp] = _tNEXT[p]] - delete _tNEXT[p] - } else { - delete _tFCHLD[pp] - delete _tLCHLD[pp] - delete _tQCHLD[pp] - return p - } + delete _tFCHLD[pp] + delete _tLCHLD[pp] + delete _tQCHLD[pp] + return p } --_tQCHLD[pp] - } else { - if (p in _tPREV) { - if (p in _tNEXT) { - _tPREV[_tNEXT[v] = _tNEXT[p]] = v = _tPREV[p] - delete _tNEXT[p] - } else { - delete _tNEXT[_tPREV[p]] - } - delete _tPREV[p] + } else if (p in _tPREV) { + if (p in _tNEXT) { + _tPREV[_tNEXT[v] = _tNEXT[p]] = v = _tPREV[p] + delete _tNEXT[p] } else { - if (p in _tNEXT) { - delete _tPREV[_tNEXT[p]] - delete _tNEXT[p] - } + delete _tNEXT[_tPREV[p]] } + delete _tPREV[p] + } else if (p in _tNEXT) { + delete _tPREV[_tNEXT[p]] + delete _tNEXT[p] } return p } @@ -6403,14 +6311,12 @@ function _tframex_p1(A, v, i, r, B) if (r != "") { A[".~"] = A["`~"] = A["^~"] = r } + } else if (match(v, /!/)) { + delete A[i] } else { - if (match(v, /!/)) { - delete A[i] - } else { - A[i] = v - if (r != "") { - A[i "~"] = r - } + A[i] = v + if (r != "") { + A[i "~"] = r } } } @@ -7344,16 +7250,14 @@ function _wFBRO(p, v, a) } --_tQCHLD[a] } - } else { - if (v in _tPARENT) { - if (p == (a = _tPARENT[v])) { - return v - } - delete _tPREV[_tFCHLD[a] = _tNEXT[v]] - --_tQCHLD[a] - } else { - delete _tPREV[_tNEXT[v]] + } else if (v in _tPARENT) { + if (p == (a = _tPARENT[v])) { + return v } + delete _tPREV[_tFCHLD[a] = _tNEXT[v]] + --_tQCHLD[a] + } else { + delete _tPREV[_tNEXT[v]] } ++_tQCHLD[p] return (_tFCHLD[p] = _tPREV[_tNEXT[v] = _tFCHLD[_tPARENT[v] = p]] = v) @@ -7370,15 +7274,13 @@ function _wFBRO(p, v, a) delete _tNEXT[_tPREV[v]] } delete _tPREV[v] - } else { - if (v in _tPARENT) { - if (p == (a = _tPARENT[v])) { - return v - } - delete _tFCHLD[a] - delete _tLCHLD[a] - delete _tQCHLD[a] + } else if (v in _tPARENT) { + if (p == (a = _tPARENT[v])) { + return v } + delete _tFCHLD[a] + delete _tLCHLD[a] + delete _tQCHLD[a] } ++_tQCHLD[p] return (_tFCHLD[p] = _tPREV[_tNEXT[v] = _tFCHLD[_tPARENT[v] = p]] = v) @@ -7396,12 +7298,10 @@ function _wFBRO(p, v, a) } else { delete _tNEXT[_tLCHLD[a] = _tPREV[v]] } + } else if (v in _tNEXT) { + _tNEXT[_tPREV[a] = _tPREV[v]] = a = _tNEXT[v] } else { - if (v in _tNEXT) { - _tNEXT[_tPREV[a] = _tPREV[v]] = a = _tNEXT[v] - } else { - delete _tNEXT[_tPREV[v]] - } + delete _tNEXT[_tPREV[v]] } delete _tPREV[v] } else { @@ -7418,10 +7318,8 @@ function _wFBRO(p, v, a) delete _tQCHLD[a] } delete _tPARENT[v] - } else { - if (v in _tNEXT) { - delete _tPREV[_tNEXT[v]] - } + } else if (v in _tNEXT) { + delete _tPREV[_tNEXT[v]] } } return (_tPREV[_tNEXT[v] = p] = v) @@ -7466,16 +7364,14 @@ function _wFCHLD(p, v, a) } --_tQCHLD[a] } - } else { - if (v in _tPARENT) { - if (p == (a = _tPARENT[v])) { - return v - } - delete _tPREV[_tFCHLD[a] = _tNEXT[v]] - --_tQCHLD[a] - } else { - delete _tPREV[_tNEXT[v]] + } else if (v in _tPARENT) { + if (p == (a = _tPARENT[v])) { + return v } + delete _tPREV[_tFCHLD[a] = _tNEXT[v]] + --_tQCHLD[a] + } else { + delete _tPREV[_tNEXT[v]] } if (p in _tFCHLD) { ++_tQCHLD[p] @@ -7495,15 +7391,13 @@ function _wFCHLD(p, v, a) delete _tNEXT[_tPREV[v]] } delete _tPREV[v] - } else { - if (v in _tPARENT) { - if (p == (a = _tPARENT[v])) { - return v - } - delete _tFCHLD[a] - delete _tLCHLD[a] - delete _tQCHLD[a] + } else if (v in _tPARENT) { + if (p == (a = _tPARENT[v])) { + return v } + delete _tFCHLD[a] + delete _tLCHLD[a] + delete _tQCHLD[a] } if (p in _tFCHLD) { ++_tQCHLD[p] @@ -7556,16 +7450,14 @@ function _wLBRO(p, v, a) } --_tQCHLD[a] } - } else { - if (v in _tPARENT) { - if (p == (a = _tPARENT[v])) { - return v - } - delete _tNEXT[_tLCHLD[a] = _tPREV[v]] - --_tQCHLD[a] - } else { - delete _tNEXT[_tPREV[v]] + } else if (v in _tPARENT) { + if (p == (a = _tPARENT[v])) { + return v } + delete _tNEXT[_tLCHLD[a] = _tPREV[v]] + --_tQCHLD[a] + } else { + delete _tNEXT[_tPREV[v]] } ++_tQCHLD[p] return (_tLCHLD[p] = _tNEXT[_tPREV[v] = _tLCHLD[_tPARENT[v] = p]] = v) @@ -7582,15 +7474,13 @@ function _wLBRO(p, v, a) delete _tPREV[_tNEXT[v]] } delete _tNEXT[v] - } else { - if (v in _tPARENT) { - if (p == (a = _tPARENT[v])) { - return v - } - delete _tLCHLD[a] - delete _tFCHLD[a] - delete _tQCHLD[a] + } else if (v in _tPARENT) { + if (p == (a = _tPARENT[v])) { + return v } + delete _tLCHLD[a] + delete _tFCHLD[a] + delete _tQCHLD[a] } ++_tQCHLD[p] return (_tLCHLD[p] = _tNEXT[_tPREV[v] = _tLCHLD[_tPARENT[v] = p]] = v) @@ -7608,12 +7498,10 @@ function _wLBRO(p, v, a) } else { delete _tPREV[_tFCHLD[a] = _tNEXT[v]] } + } else if (v in _tPREV) { + _tPREV[_tNEXT[a] = _tNEXT[v]] = a = _tPREV[v] } else { - if (v in _tPREV) { - _tPREV[_tNEXT[a] = _tNEXT[v]] = a = _tPREV[v] - } else { - delete _tPREV[_tNEXT[v]] - } + delete _tPREV[_tNEXT[v]] } delete _tNEXT[v] } else { @@ -7630,10 +7518,8 @@ function _wLBRO(p, v, a) delete _tQCHLD[a] } delete _tPARENT[v] - } else { - if (v in _tPREV) { - delete _tNEXT[_tPREV[v]] - } + } else if (v in _tPREV) { + delete _tNEXT[_tPREV[v]] } } return (_tNEXT[_tPREV[v] = p] = v) @@ -7678,16 +7564,14 @@ function _wLCHLD(p, v, a) } --_tQCHLD[a] } - } else { - if (v in _tPARENT) { - if (p == (a = _tPARENT[v])) { - return v - } - delete _tNEXT[_tLCHLD[a] = _tPREV[v]] - --_tQCHLD[a] - } else { - delete _tNEXT[_tPREV[v]] + } else if (v in _tPARENT) { + if (p == (a = _tPARENT[v])) { + return v } + delete _tNEXT[_tLCHLD[a] = _tPREV[v]] + --_tQCHLD[a] + } else { + delete _tNEXT[_tPREV[v]] } if (p in _tLCHLD) { ++_tQCHLD[p] @@ -7707,15 +7591,13 @@ function _wLCHLD(p, v, a) delete _tPREV[_tNEXT[v]] } delete _tNEXT[v] - } else { - if (v in _tPARENT) { - if (p == (a = _tPARENT[v])) { - return v - } - delete _tLCHLD[a] - delete _tFCHLD[a] - delete _tQCHLD[a] + } else if (v in _tPARENT) { + if (p == (a = _tPARENT[v])) { + return v } + delete _tLCHLD[a] + delete _tFCHLD[a] + delete _tQCHLD[a] } if (p in _tLCHLD) { ++_tQCHLD[p] @@ -7781,21 +7663,17 @@ function _wNEXT(p, v, a, b) --_tQCHLD[b] } } - } else { - if (v in _tNEXT) { - if (v in _tPARENT) { - delete _tPREV[_tFCHLD[a = _tPARENT[v]] = _tNEXT[v]] - --_tQCHLD[a] - } else { - delete _tPREV[_tNEXT[v]] - } + } else if (v in _tNEXT) { + if (v in _tPARENT) { + delete _tPREV[_tFCHLD[a = _tPARENT[v]] = _tNEXT[v]] + --_tQCHLD[a] } else { - if (v in _tPARENT) { - delete _tFCHLD[a = _tPARENT[v]] - delete _tLCHLD[a] - delete _tQCHLD[a] - } + delete _tPREV[_tNEXT[v]] } + } else if (v in _tPARENT) { + delete _tFCHLD[a = _tPARENT[v]] + delete _tLCHLD[a] + delete _tQCHLD[a] } if (p in _tNEXT) { _tPREV[_tNEXT[v] = _tNEXT[p]] = v @@ -7865,21 +7743,17 @@ function _wPREV(p, v, a, b) --_tQCHLD[b] } } - } else { - if (v in _tPREV) { - if (v in _tPARENT) { - delete _tNEXT[_tLCHLD[a = _tPARENT[v]] = _tPREV[v]] - --_tQCHLD[a] - } else { - delete _tNEXT[_tPREV[v]] - } + } else if (v in _tPREV) { + if (v in _tPARENT) { + delete _tNEXT[_tLCHLD[a = _tPARENT[v]] = _tPREV[v]] + --_tQCHLD[a] } else { - if (v in _tPARENT) { - delete _tLCHLD[a = _tPARENT[v]] - delete _tFCHLD[a] - delete _tQCHLD[a] - } + delete _tNEXT[_tPREV[v]] } + } else if (v in _tPARENT) { + delete _tLCHLD[a = _tPARENT[v]] + delete _tFCHLD[a] + delete _tQCHLD[a] } if (p in _tPREV) { _tNEXT[_tPREV[v] = _tPREV[p]] = v |