home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d7xx
/
d770
/
uedit.lha
/
Uedit
/
Jenkins2.LZH
/
ExchangeNames
< prev
next >
Wrap
Text File
|
1991-04-08
|
4KB
|
100 lines
ExchangeNames
=============================================================================
COPYRIGHT 1991
Robert A. Jenkins, Ph.D.
22901 Shagbark Lane
Miller Woods, IL 60411
(708) 758-0344
All Rights Reserved
Rick Stiles may distribute it as he pleases.
=============================================================================
I wrote this to make it easy to change names in Modula-2 programs
when you are cleaning up the code and realize that the naming
convention is not clear.
1. Use buildIndex (shftAlt-mouseDown) to compile a list of
words in buf41.
2. Save and use Amiga system sort function "sort >list.sort
list" to sort the list.
3. Use grep /~\(.*\n\)\1/\1/(see advanced examples) to
delete duplicates.
4. Use learn (ctl-s) to duplicate the words if that will help
in composing the new words. Enter the replacement on the line
with at least one space between. You might tab it if you will
use the list a lot.
=============================================================================
Exchange words in curFile as per list in buf41
<ctl-q:
equateNum(n0,0)
if(askYesNo("Confirm each replacement?")) equateNum(n0,1)
equateNum(n50,curFile) ..now use buf[n50] instead of curFile
..so debugging works
moveCursor(buf41,sFile)
while (gtLoc(buf41,eFile,atCursor)) { ..to end
..get search word
equateLoc(buf41,sHilite,atCursor) ..always at sLine
equateLoc(buf41,sInvert,atCursor)
while(!is(buf41,whiteSpace)) moveCursor(buf41,eChar)
equateLoc(buf41,eHilite,atCursor)
freeBuf(buf49)
insertRgn(buf49,sFile,buf41,hilite)
setSearch(buf49)
..editBuf(buf41)..debug
..alertUser("search word")..debug
..get replace word
moveCursor(buf41,eLine)
equateLoc(buf41,eHilite,atCursor)
equateLoc(buf41,eInvert,atCursor)
moveCursor(buf41,sWord) ..move off of eLine
while(!is(buf41,whiteSpace)) moveCursor(buf41,sChar)
if(is(buf41,whiteSpace)) moveCursor(buf41,eChar)
equateLoc(buf41,sHilite,atCursor)
freeBuf(buf48)
insertRgn(buf48,sFile,buf41,hilite)
..monitor progress
freeBuf(buf50)
insertRgn(buf50,sFile,buf41,invert)
putMsg(buf50)
..editBuf(buf41)..debug
..alertUser("search and replace word")..debug
..editBuf(buf[n50])..debug
moveCursor(buf[n50],sFile)
..alertUser("starting search from top of curFile")
while (gtLoc(buf[n50],eFile,atCursor)) {
if (not search(buf[n50],sHilite,eHilite,1)) goto label(1)
..alertUser("candidate")
..check for whole word, don't replace part of identifier
equateLoc(buf[n50],locA,sHilite)
equateLoc(buf[n50],locB,eHilite)
moveCursor(buf[n50],eWord)
..alertUser("check right")..debug
if (gtLoc(buf[n50],atCursor,locB)) {
..alertUser("alphanum on right")..debug
goto label(0) }
moveCursor(buf[n50],sWord)
..alertUser("check left")..debug
if (gtLoc(buf[n50],locA,atCursor)) {
..alertUser("alphanum on left")..debug
moveCursor(buf[n50],eWord)
goto label(0) }
..search=whole word
if(eqNum(n0,1)) {
vScroll(atCursor)
if(askYesNo("Replace as on msg line?")) {
clearRgn(buf[n50],hilite)
insertRgn(buf[n50],atCursor,buf48,all) } }
..alertUser("replaced")..debug
label(0) }
label(1) ..exchange is done
..editBuf(buf41)..debug
..go to start of next search, if any
moveCursor(buf41,sLine)
moveCursor(buf41,downLine) }
putMsg("Done")
>