%%s 0/0/0 %%d D 1.1 25-Mar-82 12:07:48 v1.1 1 0 %%c Version 1.1 is the Spring 1982 Distribution of the LBL/Hughes release %%c of the Software Tools Virtual Operating System software and documentation. %%T %%I 1 #-h- kwicsym 179 asc 25-mar-82 08:03:24 v1.1 (sw-tools v1.1) ## definitions for kwic and unrot tools # put on a filed called 'kwicsym' define(FOLD,'$') #character to indicate beginning of folded line define(MAXOUT,80) #width of index #-h- kwic.r 1478 asc 25-mar-82 08:03:24 v1.1 (sw-tools v1.1) #-h- main 571 asc 25-mar-82 08:03:14 v1.1 (sw-tools v1.1) ## kwic - make keyword in context index include kwicsym DRIVER(kwic) character buf(MAXLINE) integer getarg, open, getlin integer i, int call query("usage: kwic [file] ...") for (i=1; getarg(i,buf,MAXLINE)!=EOF; i=i+1) { if (buf(1) == '-' & buf(2) == EOS) int = STDIN else { int = open(buf,READ) if (int == ERR) call cant(buf) } while(getlin(buf,int) != EOF) call putrot(buf, STDOUT) if (int != STDIN) call close(int) } if (i==1) #Read from standard input while (getlin(buf,STDIN) != EOF) call putrot(buf, STDOUT) DRETURN end #-h- putrot 396 asc 25-mar-82 08:03:14 v1.1 (sw-tools v1.1) ## putrot - create lines with keyword at front subroutine putrot (buf, outfil) character type character buf(ARB), t integer i, outfil for (i=1; buf(i) != '@n'; i=i+1) { t = type(buf(i)) if (t == LETTER | t == DIGIT) #alpha { call rotate(buf, i, outfil) #token starts at 'i' t = type(buf(i+1)) for (; t==LETTER | t==DIGIT; t=type(buf(i+1))) i = i + 1 } } return end #-h- rotate 292 asc 25-mar-82 08:03:15 v1.1 (sw-tools v1.1) ## rotate - output rotated line subroutine rotate(buf, n, outfil) character buf(ARB) integer i, n, outfil for (i=n; buf(i) != '@n'; i=i+1) call putch(buf(i), outfil) call putch(FOLD, outfil) for (i=1; i