%%s 3/3/151 %%d D 1.2 15-Jun-83 11:23:09 sventek 2 1 %%c Removed trailing periods from quoted strings, as they are no longer needed. %%s 0/0/0 %%d D 1.1 25-Mar-82 12:07:42 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- cisam 211 asc 25-mar-82 08:02:52 v1.1 (sw-tools v1.1) common / cisam / dif, width, justfy integer dif # number of records between isam'ed records integer width # width of key field in index integer justfy # type of justification desired on key; init = LEFT %%D 2 #-h- isam.r 2321 asc 25-mar-82 08:02:52 v1.1 (sw-tools v1.1) %%E 2 %%I 2 #-h- isam.r 2324 asc 15-jun-83 11:22:53 sventek (joseph sventek) %%E 2 #-h- defns 111 asc 25-mar-82 08:02:40 v1.1 (sw-tools v1.1) define(DEFAULT_WIDTH,25) define(DEFAULT_DIF,1) define(DEFAULT_JUSTFY,LEFT) define(LEFT,0) define(RIGHT,1) %%D 2 #-h- main 732 asc 25-mar-82 08:02:40 v1.1 (sw-tools v1.1) %%E 2 %%I 2 #-h- main 731 asc 15-jun-83 11:22:17 sventek (joseph sventek) %%E 2 DRIVER(isam) linepointer oldadr, addr integer n, status, i, junk integer getlin, getwrd, doline, ptreq, note character oldwrd(MAXLINE), buf(MAXLINE), word(MAXLINE) include cisam %%D 2 call query("usage: isam [-d] [-w] [-j].") %%E 2 %%I 2 call query("usage: isam [-d] [-w] [-j]") %%E 2 call getcmd # crack command line oldwrd(1) = EOS call ptrcpy(NULLPOINTER, oldadr) n = 0 repeat { junk = note(addr, STDIN) status = getlin(buf, STDIN) if (status != EOF) { n = n + 1 i = 1 junk = getwrd(buf, i, word) if (doline(n) == YES) call outlin(word, addr) call strcpy(word, oldwrd) call ptrcpy(addr, oldadr) } } until (status == EOF) if (doline(n) == NO & ptreq(oldadr, NULLPOINTER) == NO) call outlin(oldwrd, oldadr) DRETURN end #-h- doline 159 asc 25-mar-82 08:02:41 v1.1 (sw-tools v1.1) integer function doline(n) integer n include cisam if (dif == 1) return(YES) else if (mod(n, dif) == 1) return(YES) else return(NO) end #-h- getcmd 689 asc 25-mar-82 08:02:41 v1.1 (sw-tools v1.1) subroutine getcmd character arg(FILENAMESIZE) integer getarg, ctoi integer i, j include cisam dif = DEFAULT_DIF width = DEFAULT_WIDTH justfy = DEFAULT_JUSTFY for (i=1; getarg(i, arg, FILENAMESIZE) != EOF; i=i+1) { call fold(arg) if (arg(1) == '-') if (arg(2) == 'd') { j = 3 dif = ctoi(arg, j) if (dif <= 0) dif = DEFAULT_DIF } else if (arg(2) == 'w') { j = 3 width = ctoi(arg, j) if (width <= 0) width = DEFAULT_WIDTH } else if (arg(2) == 'j') { if (arg(3) == 'l') justfy = LEFT else if (arg(3) == 'r') justfy = RIGHT } else call badarg(arg) else call badarg(arg) } return end #-h- outlin 265 asc 25-mar-82 08:02:42 v1.1 (sw-tools v1.1) subroutine outlin(word, addr) character word(ARB) linepointer addr include cisam if (justfy == RIGHT) call putstr(word, width, STDOUT) else call putstr(word, -width, STDOUT) call putc(' ') call putptr(addr, STDOUT) call putc('@n') return end #-h- isam.fmt 870 asc 25-mar-82 08:02:54 v1.1 (sw-tools v1.1) .so ~bin/manhdr .hd Isam (1) 29-Oct-80 generate index for pseudo-indexed-sequential access .sy isam [-d] [-w] [-j] .ds isam is used to generate an index for a text file such that the index may be used later to permit indexed-sequential access to the file. isam reads every `dif'th line (default is 1) from the standard input, noting its disk address with a call to note. It uses getwrd to retrieve the first "word" from the line and uses this as the primary key to the record. This key is then output to standard output in a field `width' wide (default is 25) and justified according to the -j switch (default left). The two-word address from note is then output as decimal integers before the index record is flushed. .fl .sa spell - spelling error finder; uses an isam-generated index .br asam - generate index for archives .di .au Joe Sventek .bu %%E 1