home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR36
/
KEXX.ZIP
/
BROWSE.KEX
< prev
next >
Wrap
Text File
|
1992-12-29
|
3KB
|
107 lines
************************************************
* BROWSE.KEX
*
* Function: Locate symbol definitions and references in your C source files
* To run: See BROWSE.DOC
* Requires: KEDIT 5.0, RUNCMD.KEX, PUSH.KEX, POP.KEX, and Microsoft C 6.0+
* version: 2.1 (December, 1992)
*
* Parameters:
* Switch - Switch indicating what sort of lookup is desired.
* -b - Backup one BROWSE level
* -d - Look up definition(s) of symbol
* -r - Look up reference(s) to symbol
* Symbol - (Optional) symbol to look up. If absent, the symbol under the
* cursor is looked up if possible.
*
************************************************
Parse Arg Switch Symbol
* Save some information in case we have to bail out due to an error
OriginalFid = Fileid.1()
C1 = Cursor.1()
C2 = Cursor.2()
* Determine which keys are used to navigate amongst BROWSER locations
Call ErrorCheck 'Editv Get BROWSE_NextKey BROWSE_PrevKey BROWSE_CurrKey'
If BROWSE_NextKey = '' Then BROWSE_NextKey = 'Plus'
If BROWSE_PrevKey = '' Then BROWSE_PrevKey = 'Minus'
If BROWSE_CurrKey = '' Then BROWSE_CurrKey = 'Star'
If Switch = '-b' Then Do
* Backup one BROWSER level
'Macro Pop BROWSE'
Level = RC
If Level <= 0 Then Call FatalErr 1 'No current BROWSE locations'
'Macro PrgLines br'Level
'Msg Number of browse levels is now' Level - 1
Return
End
If Switch = '-r' Then Do
MessageText = "Reference to"
MessageType = "reference"
End
Else If Switch = '-d' Then Do
MessageText = "Definition of"
MessageType = "definition"
End
Else
Call FatalErr 1 "Invalid BROWSE argument: '"Switch"'"
* Get the name of the file with BROWSER info
Call ErrorCheck 'Editv Get BrowseFile'
If BrowseFile = '' Then Do
'NoMsg Dir *.bsc'
If RC \= 0 Then
Call FatalErr 1 "Unable to locate .BSC file"
If Size.1() \= 1 Then Do
'NoMsg QQuit'
Call FatalErr 1 "Multiple .BSC files found"
End
'Locate :1'
BrowseFile = DirFileid.1()
Call ErrorCheck 'Editv Put BrowseFile'
'QQuit'
Call ErrorCheck 'Kedit' OriginalFid
'Cursor Screen' C1 C2
End
* If an argument wasn't supplied, use word under cursor as symbol
If Symbol = '' Then Symbol = FieldWord.1()
* Save the current context for backup operations
'Macro Push BROWSE' BROWSE_NextKey BROWSE_PrevKey BROWSE_CurrKey
BrowseCount = RC
* Let BROWSE.EXE and RUNCMD.KEX do all the "real work"
'Macro RunCmd /'MessageText Symbol'/ br'BrowseCount 'BROWSE.TMP' MessageType BROWSE_NextKey BROWSE_PrevKey BROWSE_CurrKey 'DOSQUIET Browse' Switch Symbol BrowseFile
'Msg Number of browse levels is now' BrowseCount
Return
************************************************
* Subroutine to bail out with error message in alert box
* Note: This subroutine never returns to it's caller
************************************************
FatalErr:
Parse Arg ReturnCode ErrorMessage
'Alert' Delimit(ErrorMessage) 'Title $BROWSE$'
* Restore screen if possible
'Kedit' OriginalFid
'Cursor Screen' C1 C2
Exit ReturnCode
************************************************
* Execute command and check for zero return code
* If RC is not 0, then bail out with FatalErr
************************************************
ErrorCheck:
Parse Arg CmdString
"NoMsg" CmdString
If RC \= 0 Then
Call FatalErr RC "From <"Word(CmdString, 1)">" LastMsg.1()
Return