|
|
1.1 root 1: < ../ADM/defns
2: <../index/defns
3:
4: all:V: index.out
5:
6: pg: index.out
7: count index.ms index.out
8:
9: spell:VQ:
10: dospell index.ms
11:
12: lp: index.out
13: $LP $newprereq && touch $target
14:
15: index.out:D: index.ms
16: $PREFER $prereq | pic | troff -mpm > $target
17:
18: index:V:
19: touch index.ind
20: pindex:V:
21: touch index.ind
22:
23: PAPERS=`cd /usr/vol2;echo [a-z]*`
24: INDEX=${PAPERS:%=%.index}
25: incindex:V: $INDEX
26:
27: %.index:VQ:
28: cd ../$stem; mk index
29: PINDEX=${PAPERS:%=%.pindex}
30: pincindex:V: $PINDEX
31:
32: %.pindex:VQ:
33: cd ../$stem; mk pindex
34:
35: restart:V:
36: for i in ../[a-z]*
37: do
38: cd $i
39: mk index
40: done
41:
42: sindex:VQ:
43: wc sindex
44: awk '
45: /^\.XX/ {
46: if($2 ~ /[a-z]/){
47: name=$2
48: first=$3
49: str = "..\/" $4 ".pg"
50: getline <str
51: last=$1 + first -1
52: print name " " first " " last
53: close(str)
54: }
55: }' ../contents/contents.ms >contents
56: sed -e 's/\\f(..//g' -e 's/\\f[a-z0-9A-Z]//g' -e 's/\\em//' -e 's/ ,/,/' -e 's/\\\&//g' -e 's/,/ /' -e 's/^ //' ../[a-z]*/*.ind|sort -f|
57: awk '
58: BEGIN {
59: while((getline<"contents") > 0){
60: names[$1] = $2
61: last[$1] = $3
62: }
63: FS=" "
64: mult = .2
65: }
66: {if($1 == term){
67: ck = global = substr($2,2,index($2,",")-2)
68: if(ck in names){
69: sub(/^ /, " \\fI", $2)
70: sub(/,/,"\\fP,", $2)
71: control = 6
72: }
73: else control=0
74: if($2 ~ /[A-Z_$][A-Z_$][A-Z_$0-9& ]*/){
75: if($2 !~ /\\s/)
76: control += 8*gsub(/[A-Z_$][A-Z_$][A-Z_$0-9& ]*/,"\\s-2&\\s+2")
77: }
78: sub(/^ /,"",$2)
79: if(NF == 3){
80: rside = ckcw($2,0,$NF)
81: if(global in names){
82: if( $3~ /[gGPR]/)
83: printit(" \\fI" global "\\fP, " names[global] "-" last[global],1,control)
84: else printit(" " $2, 1, control)
85: next
86: }
87: }
88: else rside = $2
89: printit(" " rside, 1, control) #removed space
90: }
91: else {
92: term = $1
93: control=0
94: if(term in names){
95: newt="\\fI" term "\\fP, " names[term] "-" last[term]
96: printit(newt, 0, 0)
97: if($2 ~ /[A-Z_$][A-Z_$][A-Z_$0-9& ]*/){
98: if($2 !~ /\\s/)control=8*gsub(/[A-Z_$][A-Z_$][A-Z_$0-9& ]*/,"\\s-2&\\s+2")
99: }
100: sub(/^ /,"",$2)
101: if(NF == 3)
102: rside = ckcw($2,0,$NF)
103: else rside = $2
104: printit(" " rside, 1, control) #removed space
105: }
106: else {
107: if($1 ~ /[A-Z_$][A-Z_$][A-Z_$0-9& ]*/){
108: if($1 !~ /\\s/)control=8*gsub(/[A-Z_$][A-Z_$][A-Z_$0-9& ]*/,"\\s-2&\\s+2")
109: }
110: lside = $1
111: if(NF == 3){
112: lside = ckcw($1,1,$NF)
113: if($NF ~ /[gGPR]/){
114: r = substr($2,2,index($2,",")-2)
115: if(r in names ){
116: printit(lside ", \\fI" r "\\fP, " names[r] "-" last[r],0,control)
117: next
118: }
119: else {
120: print "term not in names:" r|"cat 1>&2"
121: sub(/ ./,"")
122: }
123: }
124: }
125: sub(",","\\fP,",$2)
126: printit(lside ",\\fI" $2, 0, control)
127: }
128: }}
129: function ckcw(rterm,first,code){
130: if(rterm ~ /^-/){
131: sub(/^-/,"\\(em",rterm)
132: control += 3
133: }
134: if(rterm ~ /^\./){
135: sub(/^\./,"\\\\&&",rterm)
136: control += 2
137: }
138: if(code ~ /[GcS]/){
139: if(first)rterm = addcw( rterm,0)
140: else {
141: control -= length(rterm)*mult
142: rterm = "\\f(CW" rterm
143: sub(/,/,"\\fP,",rterm)
144: }
145: }
146: else if(code ~ /[pPf]/){
147: control -= length(rterm)*mult
148: rterm = "\\f(CW" rterm
149: sub(/ /,"\\fP ", rterm)
150: }
151: else{
152: n=split(rterm, arr, " ")
153: if(code ~ /y/)rterm = addcw( arr[1],0)
154: else rterm = arr[1]
155: for(i=2;i<=n;i++){
156: if(i==2 && code~/[rRz]/)rterm = rterm addcw( arr[i],1)
157: else if(i==3 && code~/[qy]/)rterm=rterm addcw( arr[i],1)
158: else if(i==4 && code~/[txz]/)rterm=rterm addcw( arr[i],1)
159: else if(i==6 && code~/x/)rterm=rterm addcw( arr[i],1)
160: else rterm = rterm " " arr[i]
161: }
162: }
163: if(code ~ /[xyz]/)control += 16
164: control += 8
165: return(rterm)
166: }
167: function addcw(term,adds,hidden){
168: control -= length(term)*mult
169: hidden = "\\f(CW" term "\\fP"
170: if(adds) hidden = " " hidden
171: return(hidden)
172: }
173: function printit(line, space, caps){
174: limit=46+caps
175: if(space == 0)limit += 2
176: if(length(line)< limit)print line
177: else {
178: n=split(line, a, ",")
179: if(length(a[1])>=limit){
180: m=split(a[1],b," ")
181: nline=b[1]
182: if(space)nline = " " b[1]
183: for(i=2;i<=m;i++){
184: nline = nline " " b[i]
185: if(length(nline)>=limit){
186: print nline
187: nline = " "
188: }
189: }
190: for(i=2; i<=n;i++){
191: if(nline == " ")nline = nline a[i]
192: else nline = nline "," a[i]
193: }
194: print nline
195: return
196: }
197: nline=a[1]
198: for(i=2;i<=n;i++){
199: nline = nline "," a[i]
200: if(length(nline)>= limit-6){
201: if(i < n)print nline ","
202: else print nline
203: if(i < n)nline = " " a[++i]
204: else nline = ""
205: }
206: }
207: if(length(nline) > 0)print nline
208: }
209: }' |finddups >sindex
210: wc sindex
211: # troff -ms sindex.ms >tr.out
212:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.