1# 2# aegis - project change supervisor 3# Copyright (C) 2001, 2006-2008 Peter Miller 4# 5# This program is free software; you can redistribute it and/or modify 6# it under the terms of the GNU General Public License as published by 7# the Free Software Foundation; either version 3 of the License, or 8# (at your option) any later version. 9# 10# This program is distributed in the hope that it will be useful, 11# but WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13# GNU General Public License for more details. 14# 15# You should have received a copy of the GNU General Public License 16# along with this program. If not, see 17# <http://www.gnu.org/licenses/>. 18# 19function output_end() 20{ 21 if (start == 0) 22 return; 23 if (middle != 0) 24 printf(",") 25 middle = 1 26 printf("%d", start); 27 if (start != finish) 28 printf("-%d", finish); 29 start = 0; 30 finish = 0; 31} 32 33function output(n) 34{ 35 if (start == 0) 36 { 37 start = n 38 finish = n 39 return 40 } 41 if (n == finish + 1) 42 { 43 finish = n; 44 return 45 } 46 output_end(); 47 start = n; 48 finish = n; 49} 50 51function output_even() 52{ 53 if ((page[finish] % 2) != 0) 54 { 55 output_end(); 56 printf(",_"); 57 } 58} 59 60/Page:/ { 61 page[$3] = $2 62 if ($3 > max) 63 max = $3 64} 65END { 66 output(1); 67 output(2); 68 numtoc = 0 69 for (j = 3; j <= max; ++j) 70 { 71 if (page[j] > 1000) 72 { 73 output(j); 74 numtoc++ 75 } 76 } 77 output_even(); 78 for (j = 3; j <= max; ++j) 79 { 80 if (page[j] < 1000) 81 output(j); 82 } 83 output_even(); 84 output_end(); 85 printf("\n"); 86} 87