home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR36
/
KEXX.ZIP
/
PUSH.KEX
< prev
next >
Wrap
Text File
|
1992-06-23
|
3KB
|
82 lines
************************************************
* PUSH.KEX
*
* Function: Implement the PUSH function for a simple KEDIT context stack
* To run: See PUSHPOP.DOC
* Requires: KEDIT 5.0
* Version: 1.0 (June, 1992)
*
* Parameters:
* Name - Name of the entry being pushed onto the stack
* Keydefs - List of the KEDIT Keynames to save definitions for
*
************************************************
Parse Arg Name Keydefs
Name = Upper(Name)
If Name = "" Then Name = "DEFAULT"
* Get the size of the existing stack
'NoMsg Editv Get StackSize'
* If there is no existing stack, initialize one
If \DataType(StackSize, "N") | StackSize = 0 Then StackSize = 0
* Create index to new entry
StackSize = StackSize + 1
* Save current place in file
'SOS Save'; 'Cursor CmdLine'
Call ErrorCheck "Point .stack"StackSize
'SOS Restore'
* Save context name, current fileid, current cursor position and ...
* ... the names of the keydefs being tracked
Call ErrorCheck "Editv SetL StackFID."StackSize Fileid.1() Cursor.1() Cursor.2()
Call ErrorCheck "Editv SetL StackName."StackSize Name
Call ErrorCheck "Editv SetL StackKeys."StackSize Keydefs
Call ErrorCheck 'Editv Get StackEntries.'Name
Entries = StackEntries.Name
If \DataType(Entries, 'n')
Then Entries = 1
Else Entries = Entries + 1
* Save individual keydefs
Do While Keydefs \= ""
Parse Var Keydefs NextKey Keydefs
* Lowercase to circumvent a bug handling case in Editv variable tails
NextKey = Translate(NextKey, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')
"NoMsg Define" NextKey
Call ErrorCheck "Editv SetL StackKey."StackSize"."NextKey LastMsg.1()
End
* Reflect new entry on stack
Call ErrorCheck "Editv Put StackSize"
Call ErrorCheck 'Editv Set StackEntries.'Name Entries
Return Entries
************************************************
* 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 $PUSH$'
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 LastMsg.1()
Return