home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
epm603a.zip
/
EPMSMP.ZIP
/
CBIND.E
< prev
next >
Wrap
Text File
|
1992-08-26
|
4KB
|
77 lines
/*****************************************************************************
* CBIND.E
*
* Alt-q to perform lookup of C-bindings for the word at cursor position.
* This macro is extremely useful as a kind of online quick reference for
* most of the functions included in OS2 and PM. It provides a sort of
* crude hypertext-like capability when editing OS2 C source code. At
* present, it is designed to look up C function prototype definitions.
* It could be extended to provide more comprehensive lookup on #defines
* and typedefs.
*
* CBIND works by grabbing the word at the cursor position, then doing
* a locate on the word in the appropriate .H file.
*
* INSTALLATION:
* include 'cbind.e' in your MYSTUFF.E file
* et e.e
*
* Written by David Slauson 03/25/89
***************************************************************************/
def a_q=
/**************************************************************************/
/* NOTE: You may need to change the following variables to match your */
/* subdirectory names or .H filenames. */
/**************************************************************************/
dosbind= 'D:\TOOLKT13\C\INCLUDE\BSEDOS.H' /* Dos functions */
bsebind= 'D:\TOOLKT13\C\INCLUDE\BSESUB.H' /* Mou, Kbd, Vio functs */
winbind= 'D:\TOOLKT13\C\INCLUDE\PMWIN.H' /* Win functions */
gpibind= 'D:\TOOLKT13\C\INCLUDE\PMGPI.H' /* Gpi functions */
/***************************************************************************/
call pmark_word() /* mark the word at the cursor position*/
getline line,.line /* Get marked word into variable */
getmark first_line,last_line,first_col,last_col
word_len = last_col - first_col + 1
word = Substr(line,first_col,word_len)
unmark
tempfile= ''
word= strip(word,'B','(')
word= strip(word,'B','{')
word= strip(word,'B',';')
parse value word with word1 '(' junk /* strip off anything after '(' */
if pos('Dos', word1) > 0 then
tempfile= dosbind
elseif pos('Win', word1) > 0 then
tempfile= winbind
elseif pos('Gpi', word1) > 0 then
tempfile= gpibind
elseif pos('Vio', word1) > 0 then
tempfile= bsebind
elseif pos('Mou', word1) > 0 then
tempfile= bsebind
elseif pos('Kbd', word1) > 0 then
tempfile= bsebind
endif
if tempfile > '' then /* valid function name found */
'xcom E 'tempfile /* edit the appropriate .H file */
top
cmtflag= 1; /* assume the line found is a comment */
do while cmtflag /* leave when we've located a non-cmt */
'xcom /'||word1 /* locate the marked word */
getline line,.line
line= strip(line,'L') /* strip any leading blanks */
if substr(line,1,2) <> '/*' then
cmtflag= 0 /* not a comment, probably the hit */
else /* this is a comment line, skip it */
'xcom +1'
endif
enddo
setcommand '/'||word1, 1,1 /* show the user what we've done */
else
sayerror 'Unable to look up "'word1'"...definition .H file unknown.'
endif