| * reorder the tuple to put x's line first in the entry and x fitst in its line |
| ndbreorder(Ndbtuple *t, Ndbtuple *x) |
| /* if x is first, we're done */ |
| /* find end of x's line */ |
| for(last = x; last->line == last->entry; last = last->line) |
| /* rotate to make this line first */ |
| /* detach this line and everything after it from the entry */ |
| for(nt = t; nt->entry != last->line; nt = nt->entry) |
| for(nt = last; nt->entry != nil; nt = nt->entry) |
| /* rotate line to make x first */ |
| /* find entry before x */ |
| for(prev = last; prev->line != x; prev = prev->line); |
| last->entry = last->line; |