home *** CD-ROM | disk | FTP | other *** search
- /* format of index file:
- (Win*, view winhelp.inf ~)
- (printf, view edchelp.inf printf)
- */
-
- defc kwhelp= call pHelp_C_identifier()
-
- defproc pHelp_C_identifier
- universal helpindex_id
- if not find_token(startcol, endcol) then
- return
- endif
- getline line
- is_class = 0; colon_pos = 0
- if substr(line, endcol+1, 2) = '::' then -- Class?
- ch = upcase(substr(line, endcol+3, 1))
- if (ch>='A' & ch<='Z') | ch='_' then
- curcol = .col
- .col = endcol+3
- call find_token(junk, endcol)
- .col = curcol
- is_class = 1
- endif
- elseif startcol>3 then
- if substr(line, startcol-2, 2) = '::' then -- Class?
- ch = upcase(substr(line, startcol-3, 1))
- if (ch>='A' & ch<='Z') | (ch>='0' & ch<='9') | ch='_' then
- curcol = .col
- .col = startcol-3
- call find_token(startcol, junk)
- .col = curcol
- is_class = 2
- endif
- endif
- endif
- identifier = substr(line, startcol, (endcol-startcol)+1)
-
- getfileid CurrentFile /* save the ID of the current file */
- if helpindex_id then
- display -2
- rc = 0
- activatefile helpindex_id
- display 2
- if rc then -- File's gone?
- helpindex_id = 0
- endif
- endif
- if not helpindex_id then
- helplist = Get_Env('HELPNDX')
- if helplist='' then
- compile if defined(KEYWORD_HELP_INDEX_FILE)
- helplist = KEYWORD_HELP_INDEX_FILE
- compile else
- helplist = 'epmkwhlp.ndx'
- compile endif
- endif
- ft = filetype()
- savelist = helplist
- do while helplist<>''
- parse value helplist with helpindex '+' helplist
-
- /* look for the help index file in current dir, EPMPATH, DPATH, and EPM.EXE's dir: */
- findfile destfilename, helpindex, '','D'
-
- if rc then
- /* If that fails, try the standard path. */
- findfile destfilename, helpindex, 'PATH'
- if rc then
- sayerror 'Help index 'helpindex' not found'
- return
- endif
- endif
- compile if EVERSION >='5.50'
- if pos(' ',destfilename) then
- destfilename = '"'destfilename'"'
- endif
- compile endif
- if helpindex_id then
- bottom
- last = .last
- 'get' destfilename
- line = upcase(textline(last+1))
- if word(line,1)='EXTENSIONS:' & wordpos(ft, line) then -- Move to top
- call psave_mark(savemark)
- call pset_mark(last+1, .last, 1, MAXCOL, 'LINE', helpindex_id)
- 0
- move_mark
- call prestore_mark(savemark)
- endif
- else
- 'xcom e /d' destfilename
- getfileid helpindex_id
- .visible = 0
- endif
- enddo
- helpindex_id.userstring = savelist
- endif
- top; .col = 1
-
-
- display -2
- getsearch savesearch
- 'xcom /('identifier',/' -- search for the exact match...
- if rc then
- do i = length(identifier) to 0 by -1
- 'xcom /('leftstr(identifier, i)'*,/'
- if not rc then
- leave
- endif
- enddo
- endif
- setsearch savesearch
- display 2
-
- if rc then
- sayerror 'Unable to find entry for 'identifier' in 'helpindex_id.userstring'.'
- else
- parse value substr(textline(.line), .col) with ',' line ')'
- /* substitute all occurrances of '~' with the original identifier */
- loop
- i = pos('~', line)
- if not i then
- leave
- endif
- line = leftstr(line, i-1)||identifier||substr(line, i+1)
- endloop
-
- if upcase(word(line,1))='VIEW' then
- sayerror 'Invoking View ...'
- endif
- 'dos 'line -- execute the command
- endif
- activatefile CurrentFile
-
-