home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
kl.zip
/
KLRing.kex
< prev
next >
Wrap
Text File
|
1997-03-17
|
4KB
|
113 lines
** (c) Copyright International Business Machines Corporation 1997.
* All Rights Reserved.
*
* KLRING (KEDIT Ring List for KL macro) Version 1.0 1997-03-17
*
* Command Syntax: KLRING
* (No argements are required.)
* Function:
* This macro lists files on the KEDIT ring and displays filespec for
* the files in a new file(Ring List file) on the KEDIT ring.
*
* A KL list file opened by KL macro is displayed with a mark "<KL>"
* followed by file specifier for the KL list.
*
* To select a file on the KEDIT ring, locate the cursor on the line in
* the Ring List file and press the Ctrl-ENTER keys, or type the number
* prefixed to the file in the KEDIT command line and press the Ctrl-ENTER
* keys.
*
* To issue QUIT command for a file on Ring List, locate the cursor on
* the line and press F3. QQUIT command is issued by pressing S-F3.
*
* To quit from Ring List, press ESC key or just press the Ctrl-ENTER keys.
*
* Note that this macro can be used without KL macro.
*
* Customization: Edit the first KEXX instruction of this macro.
*
* Author: Shintaro Hori
*/
parse value 'ESC C-ENTER F3 S-F3 A-ENTER' with rExit rSel rQ rQQ rCmdL
title= center('KEDIT Ring List for KL macro',80)
help =rExit'=Exit 'rSel'=Slect File 'rQ'=Quit File/List 'rQQ'=QQuit 'rCmdL'=CmdLine'
'extract /ring'
do i=1 to ring.0
RL.i = right(i,3)'|' BldFileID(ring.i)
end
'EDITV GET KLDIR'; xx = kldir'_K_L_R~I.N~G'
'kedit' xx '(nomsg new'; 'set msgmode on'
'set idline off'; 'set scale off'; 'set autosave off';'set prefix off'
'set reserved 1 blue on light green' title
'set reserved -2 blue on light green' help
do i = 1 to ring.0
'input' RL.i
end
'sos tabcmd';':1'
do forever
if size.1() = 0 then do; 'qquit'; leave; end
'readv key noignoremouse'; key = readv.1
if rc \= 0 then do
'dialog /Mouse input ignored, use Esc key to Exit/ TITLE /Ring List/'
iterate
end
q =0 /* quit flag */
'extract /curline/cmdline/'
parse value strip(curline.3) with rid '|' mark . /* Ring ID */
if key=rExit then do; q=1; rid=1; end
else if key=rSel | key='NUMENTER' then do
if command() then do
if datatype(cmdline.3,'W') then do; q=1; rid=cmdline.3; end
else if cmdline.3='' then do; q=1; rid=1 ; end
else 'macro' key /* Execute Command Line */
end
else do; if rid \='' then q=1; end
end
else if key=rQ | key=rQQ then call DelList
else if key=rCmdL then do
if command() then 'cursor home'
else 'sos tabcmd'
end
else 'macro' key
if q then do;
fid = ring.rid
'QQuit';'kedit' fid '(nodefext';leave
end
end
'nomsg cursor cmdline'
Return /* Exit */
BldFileID:
parse arg fid .
'KEDIT' fid; 'EDITV GETF KLIND KLSPEC.0'
* if klind \=1 then return copies(' ',7) fid
if klind \=1 then return copies(' ',7) asisfid(fid) /* use case-respected fid */
list = '<KL>'
do j=1 to klspec.0
'EDITV GETF KLSPEC.'j ; parse var klspec.j fid '/' opt
list=list '#'j'='fid ; if opt \='' then list=list '/'opt
end
Return list
DelList:
'kedit' ring.rid '(nodefext'
if mark='<KL>' then do;'macro KL /Q';rc=0;end
else if key=rQ then 'Quit'; else 'QQUIT'
saverc = rc
'kedit' xx '(nodefext'
if saverc =0 then do; 'cursor home'; 'sos delline'; end
else 'MSG This file has been modified.'
Return
asisfid: procedure
parse arg fid
/* get file id of mixed case */
'modify fileid' ; if rc\=0 then return fid
parse value cmdline.3() with . . fid
'sos tabcmd delend' /* delete contents */
Return fid