| 386 | } |
| 387 | |
| 388 | void sort_actions() |
| 389 | { |
| 390 | register int i; |
| 391 | register int j; |
| 392 | register int k; |
| 393 | register int t; |
| 394 | register int w; |
| 395 | |
| 396 | order = NEW2(nvectors, Yshort); |
| 397 | nentries = 0; |
| 398 | |
| 399 | for (i = 0; i < nvectors; i++) |
| 400 | { |
| 401 | if (tally[i] > 0) |
| 402 | { |
| 403 | t = tally[i]; |
| 404 | w = width[i]; |
| 405 | j = nentries - 1; |
| 406 | |
| 407 | while (j >= 0 && (width[order[j]] < w)) |
| 408 | j--; |
| 409 | |
| 410 | while (j >= 0 && (width[order[j]] == w) && (tally[order[j]] < t)) |
| 411 | j--; |
| 412 | |
| 413 | for (k = nentries - 1; k > j; k--) |
| 414 | order[k + 1] = order[k]; |
| 415 | |
| 416 | order[j + 1] = i; |
| 417 | nentries++; |
| 418 | } |
| 419 | } |
| 420 | } |
| 421 | |
| 422 | |
| 423 | void pack_table() |