home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
164.lha
/
ARexx
/
TXed_ARexx
/
lookitup.txed
< prev
next >
Wrap
Text File
|
1988-04-28
|
1KB
|
47 lines
/* Look up routine for ref */
'LOCK 1' /* Prevent user input (he may get bored) */
/* We get word to look up from ref.txed. Ref opened refport for synchonization.
After we open our port (lookport), we'll tell ref to send us the word. */
call openport("lookport")
address 'refport' 'Ready'
call waitpkt('lookport')
packet = getpkt('lookport')
lookup = getarg(packet)
call reply(packet,0)
call closeport("lookport")
'MSG' lookup
found = 'false'
call open(ref,'s:txed.ref','R') /* our ref file */
do while ((found = 'false') & (~eof(ref)))
fileline = readln(ref)
if (upper(word(fileline,1)) = upper(lookup)) then found = 'true' /* found reference */
end
call close(ref)
if found = 'false' then do
'MSG' 'reference not found!'
exit
end
/* God, I love the parse command! */
parse var fileline dummy filename '@' start '@' end '@'
filename = strip(filename) /* remove blanks */
/* Solution to the speed problem was obvious! Let txed cull the file
rather than trying to do it in AREXX. Txed can jump and cut easily,
whereas AREXX had to read lines one at a time. */
'LOA' filename
'T'
'MAR 1'
'JU' start-1
'CUT'
'JU' end - start + 2
'MAR 1'
'B'
'CUT'
/* Window <- Sample ref word */