home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Professional
/
OS2PRO194.ISO
/
os2
/
prgramer
/
rexx
/
rdebug
/
rhypertx.kex
< prev
next >
Wrap
Text File
|
1993-03-25
|
9KB
|
350 lines
/*H* RHYPERTX.KEX 01-09-93 12:04 */
Parse source sys .
if sys='OS/2' then sys='OS2'
else if sys='PCDOS' then sys='DOS'
if (sys='DOS') + (sys='OS2')>0 then pc?=1
trace o?r /*T*/
me='rHYPERTX'
If arg(1)=? Then Exit tell(me)
If arg(1)='' Then Exit tell(me)
arg key '/'origin
/*
if key then use it rather than word at cursor
if shortform (Xnb) then call x.rex to get fullname
if key contains a period then call up a file
if ft=EXE COM or * then search key in system.hlp
else if path coded edit file directly
else search for file on c then d drives
if key contains two words & is on cms then call up a file
if key contains two words & is on pc then call findkey on two words
for selected filetypes
if special keys then import a template,
else lookup key by language type
otherwise if not found call findkey
*/
call initialize
Select
when origin='RDEBUG' then nop
when words(key)=2&pc?=0 then call locate_file
when pos('.',key)>0 then call locate_file
When ft='REX' Then call language_rexx
When ft='KEX' Then call language_xedit
When ft='KML' Then call language_kexx
When ft='BOK' Then call note_book
When ft='LOG' Then call note_book
When ft='BAT' Then call 'hyperbat' key
When ft='C' Then call 'hyperc' key
Otherwise call findkey
End
if origin<>'RDEBUG' then if newfile?=0 then 'LOC :'here
c 'SET LINEND' linend.1
c 'SET msgm' MSGMODE.1
Exit lkey src
INITIALIZE:
if pc? then c=''
c 'EXTRACT /FT/CURSOR/LINEND/LINE/MSGM/curline/autosave'
c 'SET LINEND OFF'
c 'SET msgm OFF'
c 'set point .h off'
c 'set point .h'
case='MIXED IGNORE'
Parse Value ftype.1 line.1 0 2 With ft here newfile? src
if pc? then do
c 'extract /fileid'
if origin='RDEBUG' then o='RDBHELP.hl2'
else o=fileid.1; end
if key = '' then call get_key
pos=pos('(',key)
char1=left(key,1)
if left(key,1)="'" then key=substr(key,2)
if right(key,1)="'" then key=substr(key,1,length(key)-1)
lkey=key
key=translate(key)
if left(key,1)='X' & length(key)=3 then key=x.rex(key '/G')
return
GET_KEY:
c 'LOC :'cursor.3
here=cursor.3
/*If cursor.2<1 Then exit msg(me,10,'Cursor not in data area')*/
key=wordatcursor()
if pos(key'(',curline.3)>0 then key = key'('
if pos(key"'(",curline.3)>0 then key = key"("
if pos(key'"(',curline.3)>0 then key = key"("
if pos("'"key,curline.3)>0 then key = "'"key
if right(key,1)=':' then key=substr(key,1,length(key)-1)
key=translate(key,' ','`')
return
WORDATCURSOR:
trace o?r /*T*/
/*codes="=<>()/,-+&|\][%*;:?'"'"'*/
codes="=<>()/,-+&|][%*;?'"'"'
work=' 'translate(curline.3,' ',codes)' '
If cursor.4=-1 Then Exit MSG(me,10,'Cursor not in file area.')
If substr(work,cursor.4+1,1)=' '
Then work=substr(work,1,cursor.4)'`'substr(work,cursor.4+2)
s=lastpos(' ',work,cursor.4+1)
if cursor.4+1-s-1>0 then
Return substr(work,s+1,pos(' ',work,cursor.4+1)-s-1)
Return 0
COMMAND_REFERENCE_HOST:
f='e:\doscmd.hlp'
address command key '/? >' f
'x' f
c 'SET msgm OFF'
'+1'
if rc = 0 then address command 'del' f
else do
'quit'
msg(me,20,'Keyword:' key 'not found in:' f)
return 1; end
return 0
COMMAND_REFERENCE_KEXX:
f='\kedit\kedit.hlp'
begin='The KEXX Language'
return import("if pos('[',curline.3)> 0 | words(curline.3)=1 then rc=1")
COMMAND_REFERENCE_REXX:
if pc? then do
f='\rexx\rexx.hlp'
begin='Instructions'
case='UPPER RESPECT'
call import "if pos('[',curline.3)> 0 then rc=1"; end
return result
COMMAND_REFERENCE_XEDIT:
if pc? then do
f='\kedit\kedit.hlp'
if word(key,1)='SET' then key='[SET]' word(key,2)
if key='LOCATE' then key= '[LOCATE'
keys=key
key=' 'key
begin='* KEDIT Commands:'
call import "if pos('[',curline.3)> 0 | words(curline.3)=1 then rc=1"
if result=0 then do
key='[SET] 'substr(key,3)
begin='KEDIT SET Options'
call import "if pos('[',curline.3)> 0 | words(curline.3)=1 then rc=1"
key=keys
end
if result=0 then call language_rexx
end
return result
FIND_FILE:
arg drive
if pos(':',key)>0 then drive=''
if get_file(fn'.'ft) then return 1
'dosquiet' 'dir' drive''key '/s >' h
'x' h
c 'SET msgm OFF'
'loc /Directory/'
if rc = 0 then do
'extract /curline'
parse var curline.3 . . path .
'loc /-/&/:/'
if rc = 0 then do
'extract /curline'
parse var curline.3 fn ft .
if right(path,1)<>'\' then path=path'\'
'quit'
return get_file(path''fn'.'ft)
end
end
'quit'
return 0
FINDKEY:
if words(key)=1 then 'all' '/'key
else 'all' '/'word(key,1)'/|/'word(key,2)'/'
return rc
GET_FILE:
arg ff
c 'x' ff
c 'SET msgm OFF'
newfile?=1
'+1'
return (rc=0)
FUNCTION_REFERENCE:
f='\rexx\rexx.hlp'
begin='Built-in Functions'
call import "if pos('(',curline.3)> 0 then rc=1"
return
IMPORT:
arg termination
c 'set autosave off'
c 'x' f
c 'SET msgm OFF'
c 'loc /'begin
c 'set case' case
c 'set wrap off'
c 'loc /'key
src=rc
c 'extract /curline/line'
if src=0 then do
'x' o
c 'SET msgm OFF'
c 'input' '@@'copies('-',70)
do n=1 to 22
'x' o
c 'SET msgm OFF'
c 'input' '@@' curline.3
'x' f
c 'SET msgm OFF'
'+1'
if rc<> 0 then leave
c 'extract /curline'
interpret termination
if rc<>0 then leave
end
'x' o
c 'SET msgm OFF'
c 'input' '@@'copies('-',70)
'x' f
c 'SET msgm OFF'
end
'loc :'line.1+6
'quit'
c 'set autosave' autosave.1
if src<>0 then do
c 'EMSG Citation:' key 'not found in' f
newfile?=1; end
return src
LANGUAGE_REXX:
Select
When char1 = "'" then Call command_reference_host
When pos>0 Then Call function_reference
When key='DO' Then Call template_rexx_do
When key='IF' Then Call template_rexx_if
When key='SELECT' Then Call template_rexx_select
When key='PARSE' Then Call template_rexx_parse
When key='CALL' Then Call template_rexx_call
Otherwise do
Call command_reference_rexx
if result<>0 then call findkey; end
End
Return
LANGUAGE_XEDIT:
':1 extract /curline'
c 'loc :'here
Select
When char1 = "'" then Call command_reference_xedit
When pos>0 Then Call function_reference
When key='DO' Then Call template_rexx_do
When key='IF' Then Call template_rexx_if
When left(curline.3,1)='*' then call language_kexx
When key='SELECT' Then Call template_rexx_select
When key='PARSE' Then Call template_rexx_parse
When key='CALL' Then Call template_rexx_call
Otherwise do
call command_reference_xedit
if result<>0 then do
Call command_reference_rexx
if result<>0 then Call findkey; end
End
End
Return
LANGUAGE_KEXX:
Select
When key='IF' Then Call template_rexx_if
Otherwise do
Call command_reference_kexx
if result<> 0 then do
call command_reference_xedit
if result<>0 then Call findkey; end
end
End
Return
NOTE_BOOK:
if pc? then f='c:\let\note.log'
'x' f
c 'SET msgm OFF'
'shad off'
'all /'key'/'
newfile?=1
Return
LOCATE_FILE:
if validname(key,0) then do
parse value parsefn(key) with . . fn ft
if ft='ARC' | ft='ZIP' then do
push 'ALL /'fn
return get_file('c:\doc\disklib.hlp'); end
upper curline.3
if pos(key'*',curline.3)>0 then ft='*'
if ft='EXE' | ft='COM'|ft='*' then do
push 'ALL /'fn
return get_file('c:\doc\system.hlp'); end
h='e:hypertxt.fil'
i=pos('\',key)
if i>0 then return get_file(key)
if pos(':',key)>0 then key=substr(key,3)
if i=0 then key='\'key
if find_file('c:') then return
/* if find_file('d:') then return*/
'EMSG File:' key 'not found.'; end
else 'EMSG Invalid filename:' key
return
TEMPLATE_REXX_CALL:
c 'msg Enter Subroutine name...'
if pc? then do
c 'readv cmdline'
label=readv.1; end
c 'input Call' label
c 'add'
c 'input' translate(label)':'
c 'add'
c 'add'
c 'add'
c 'input Return'
Return
TEMPLATE_REXX_DO:
c 'input' 'Do name=expri To exprt By exprb For exprf While/Until exprw'
c 'input' 'Do expr/Forever While/Until exprw'
c 'add'
c 'input End'
Return
TEMPLATE_REXX_IF:
c 'input If expression Then Do'
c 'add'
c 'input End'
c 'input Else Do'
c 'add'
c 'input End'
Return
TEMPLATE_REXX_PARSE:
c 'input Parse Upper Arg'
c 'input Parse Upper Linein template'
c 'input Parse Upper Pull template'
c 'input Parse Upper Source template'
c 'input Parse Upper Value [expression] With template'
c 'input Parse Upper Var name'
c 'input Parse Upper Version'
Return
TEMPLATE_REXX_SELECT:
c 'input Select'
do 3
c 'input When expression Then Do'
c 'input End'
end
c 'input Otherwise Do'
c 'input End'
c 'input End'
Return