TIP: Click on subject to list as thread! ANSI
echo: qedit
to: GEORGE DE BRUIN
from: MORTEN CHRISTENSEN
date: 1995-06-05 16:05:00
subject: lFind() in TSEpro macro

Hej George!
Wednesday May 31 1995 kl.14:08 skrev George De Bruin til Morten Christensen 
om lFind() in TSEpro macro:
 MC>> The unique identifiers wil be the spaces combined with, that the lines
 MC>> are empty after column 51. Other lines will have the spaces in the
 MC>> beginning, but not be empty after column 51.
 GDB> What you will want to do in your macro is use lFind() to find all lines
 GDB> that start with 4 spaces:
 GDB>     if lFind("    ","^I")
 GDB>         // ... rest of code ...
 GDB>     endif
There is one more identifier. Column number 15 must be a space.
 GDB> Inside the if, you will want to test the value of the character at
 GDB> column 51:
 GDB>     GotoColumn(51)
 GDB>     if CurrChar() == _AT_EOL_ or CurrChar() == _BEYOND_EOL_
 GDB>         // ... Whatever processing you need to do here ...
 GDB>     endif
This is a fine tool.
 GDB> Now, your message indicates that you need to do this for all matching
 GDB> lines in your file.  So, instead of using an "if lFind()", you could 
se
 GDB> a 'while' statement:
 GDB>     BegFile()
 GDB>     while lFind("    ","^I")
 GDB>         GotoColumn(51)
 GDB>         if CurrChar() == _AT_EOL_ or CurrChar() == _BEYOND_EOL_
 GDB>             // ...  Whatever other processing you need to do here ...
 GDB>         endif
 GDB>     endwhile
 GDB> I hope this helps!  Let me know if you need any more help.
The macro shall work in a 4 MB, 30,000 lines-file on a notebook with a Cyrix 
486SLC 33 Mhz processor and do about 6 different tests. So speed is a 
problem. Does speed differ between "while lFind", "GotoColumn/if CurrChar" or 
a "lReplace"?
Is it possible to insert the time in the file after each test, so I can se, 
which part takes up most time.
Morten
--- GoldED/2 2.50.Beta5+
---------------
* Origin: From Denmark, explaining the bad language (2:235/200.23)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.