/* * ADLookup.ced * * $VER: v1.0 Wed Apr 7 - Rick Younie * rick@emma.panam.wimsey.bc.ca 1:153/765.9 * rick@emma.tfbbs.wimsey.bc.ca * * USAGE: assign ADLookup.ced to a CED function key, then hit it when * the cursor is over the AutoDoc function name you want to look up * * SYNOPSIS: - a lookup for the C= autodocs. Must have AUTODOCS: assigned * * FILES USED: the AUTODOCS:*.doc files, INDEX * * PROGRAMS USED: ADInd (makes 'AUTODOC:INDEX') * */ /* constants */ tab = '09'x lf = '0a'x space = '20'x hardspace = 'a0'x doc_dir = 'dh0:amiga-e/docs/autodocs/' index_file = doc_dir || 'INDEX' tempfile = 't:ADLookUp.tmp' transin = '22'x'27'x'<>():;*.,|~=/+-' || hardspace || lf || tab Main: options results 'status 55'; line = translate(result,,transin) 'status 87'; cursorpos = result line = substr(line,1,pos(space,line,cursorpos+1)) command = word(line, words(line)) if ~open('INDEX_FILE', index_file, 'Read') then do 'okay1' 'ADLookup couldn''t find the index file.. aborting (Start ADInd! Hilsen DMP)' exit end index_string = readch('INDEX_FILE', 65535) do forever index_position = index(index_string, lf || upper(command) || ' ') + 1 if index_position = 1 then do /* no doc for this function */ 'getstring' '"' '"' '"'"AD: can't find >"command"<... type one in?" '"' if symbol('result') = 'LIT' then exit if (result = '') then exit command = strip(result) end else do /* yes - display it */ 'status 66' /* use the old doc view, if there is one */ views = result do i = views to 1 by -1 'status 19' if result = tempfile then leave i 'next view' end if i~=0 then 'clear 1' else 'open new' length_of_entry = index(index_string,lf,index_position)-index_position file_entry = substr(index_string,index_position,length_of_entry) doc_file = word(file_entry,2)'.doc' start = word(file_entry,3) len = word(file_entry,4) call open 'DOCFILE', doc_dir || doc_file, 'Read' call seek 'DOCFILE', start doc = readch('DOCFILE', len) call open 'TMP', tempfile, 'Write' call writech 'TMP', doc call close 'TMP' 'open' tempfile call delete tempfile exit 0 end end