TIP: Click on subject to list as thread! ANSI
echo: qedit
to: MORTEN CHRISTENSEN
from: GEORGE DE BRUIN
date: 1995-06-16 14:26:00
subject: TSEpro macro inserting li

 From | MORTEN CHRISTENSEN
/---------------------------------------
> But this cannot be the solution. It creates a large swap-file (on
> my largest HD it reached 54 MB) and stops the program.
\---------------------------------------
   To | ALL
You'll never get out of your loop...  the loop...endloop construct
never terminates.  Since the loop never stops, it keeps inserting lines
at the end of the file until it becomes too large for the editor to
handle.
Also, I can see several things that you can do to speed this macro up.
Try something like this:
proc ManyLines()
    string  sParaTitle[255] = ""
    integer iParaStartLine, iParaEndLine
    PushPosition()                                 // Save start position
    PushBlock()                                    // Save starting block
    BegFile()                                      // Start at top of file
    BegLine()
    UnMarkBlock()
    While lFind("^<<{.*}\c$","X")                  // Find Paragraph Title
        MarkFoundText(1)
        sParaTitle = GetMarkedText()               // Get title
        iParaStartLine = CurrLine()                // Get paragraph start
        UnMarkBlock()                              // UnMark() title
        PushPosition()                             // Save position
        if lFind("^<<{.*}\c$","X")                 // Find next paragraph
           iParaEndLine = CurrLine() -2            // Find paragraph end
        else
            iParaEndLine = NumLines()              // If not another
                                                   // paragraph, assume
                                                   // end of file
        endif
        PopPosition()                              // Goto paragraph start
        while iParaStartLine + 100 < iParaEndLine  // While not outside
                                                   // of current paragraph
            iParaStartLine = iParaStartLine + 100
            GotoLine(iParaStartLine)               // Go down 100 lines
            InsertLine(">> "+sParaTitle)           // Insert Title Line
        endwhile
    endWhile
    PopPosition()                                  // Restore start position
    PopBlock()                                     // Restore start block
    message("Macro Complete.")
end
 ManyLines()
----------------------------------------------------------------------
Ran this here on my 486-66 with a 1.25 meg file.  Took about 5-10
seconds to complete...  But I only had five or six paragraph titles.
Hopefully, the comments along side the code will help you to understand
how this macro works. If you have any questions about it, please ask.
 -- SPEED 2.0h #10: TSE Jr, MEM-RES, OS/2 & The SemWare Editor Professional
--- FidoPCB v1.4 [ff151/a]
---------------
* Origin: SemWare Support BBS * 404-641-8968 * (1:133/314)

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™.