TIP: Click on subject to list as thread! ANSI
echo: qedit
to: ALL
from: `DANIEL H. LUECKING`
date: 1997-11-11 14:28:00
subject: Re: Editing Ring

From: "Daniel H. Luecking" 
At 03:20 PM 11/10/97 -0500, FRED HOLMES wrote:
>
> I need a couple of clues on how to run a process successively on
> all of the files in the editing ring.  If BufferId were a simple
> integer from 1 to n, I would write something like this.
>
> /* TSEFIND.S
>    Clip the tse articles out of the MIX capture files
> */
>      String S01[25]="tsepro"
>      String Outfile[20]="TSEPRO.LOG"
>      Integer n=0
>      Integer i
>
> Proc Main()
>      GoToBufferId(1)  // be sure you are at the beginning.
>      PrevFile()   //  go to last file in ring
>      n=GetBufferId()  // get the Buffer ID of the last file
You could use NumFiles() to find how many files are in the ring and then
simply go from one to the next with NextFile(). You could also record the
current buffer id:
   integer curr_id=GetBufferId()
and simply change files (with NextFile()), 
   repeat
      // process current file
      NextFile()
   until GetBufferId()==curr_id
    
A buffer id is just guaranteed to be a unique integer. They do seem to be
allocated in increasing order. The first few are used internally by the 
editor. Start-up macros could allocated several more. There may be no way 
to tell for sure which is ``first'' in a ring (what's the first point on a
circle?), but if you really needed to know, you could traverse the ring 
(with successive NextFile()'s) finding which had the lowest ID.
>      for i = 1 to n     // for each file in the ring
>        GoToBufferId(n)  // perform successively on each file.
You probably meant GotoBufferID(i).
The following will traverse the ring, starting with the current file
and ending there:
proc Main()
    integer curr_id=GetBufferId()
    repeat
// and now continue with what works. But end with NextFile()
>        Begfile()  // from here to endfor works just fine.
>        Begline()
>        if lFind(S01,"i") // Don't do anything if "tsepro" nf.
>           Repeat
>              lFind(S01,"i") //  Look for tsepro message indicator
// I would use while lFind(S01,"i") ... endwhile
>              lFind("^Date:","xb")  // Look for beginning of message
>              Markline()
>              Down()
>              lFind("{Date:}|{Scanning}|{(H)elp}","x") // end of msg
>              Saveblock(Outfile, _append_)  // save message to Outfile
>              UnMarkBlock()
>                 Editfile(Outfile) // Put a separator in Outfile
>                 EndFile()
>                 BegLine()
>                 AddLine()
>                 InsertText(">>",_insert_)
//You can put this text in AddLine(">>")
>                 SaveFile()
>                 AbandonFile()
>           Until Not lFind(S01,"i")
>        else
// an else may be omitted if nothing is to be done
>        endif
         NextFile()
         until GetBufferId()==curr_id
> end  // Proc Main()
>
> /*
>
--
Jan&Dan Luecking
luecking@comp.uark.edu
---
---------------
* Origin: apana>>>>>fidonet [sawasdi.apana.org.au] (3:800/846.13)

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