TIP: Click on subject to list as thread! ANSI
echo: qedit
to: ALL
from: `CARLO HOGEVEEN`
date: 1998-05-11 11:44:00
subject: Re: Spanning Lines

From: "Carlo Hogeveen" 
This is a multi-part message in MIME format.
------=_NextPart_000_001F_01BD7C8A.E15C5E20
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hello Skip
I've wished for a way to search across lines this way too,
and FindEOL won't do it, because there is no way to tell 
FindEOL that there can be an arbitrary number of spaces
on the next line before the next word, and FindEOL doesn't 
do regular expressions.
What you and I need, methinks, is a Find that allows 
an arbitrary number of whitespaces between the 
search words, including end_of_lines.
The attached macro Findws should do just that.
(Another solution to your problem might be to
search for "Great Britain" instead of "Great Briton" :-)
Carlo
------=_NextPart_000_001F_01BD7C8A.E15C5E20
Content-Type: application/octet-stream;
	name="findws.s"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="findws.s"
/*
   Macro.         Findws.
   Author.        Carlo Hogeveen (hyphen@xs4all.nl)
   Date-written.  11 may 1998.
   This macro finds a sequence of words separated by whitespace.
   A whitespace is any combination of spaces, horizontal_tabs and =
end_of_lines.
   The words may not contain spaces and are searched using =
case-insensitive
   regular expressions starting right from the cursor position.
   Findws can be started from the menu with Macro Execute, or from =
another
   macro or using a key definition with ExecMacro().
   It can be started with or without parameters.
   Examples:
      begfile()
      ecexmacro("findws")
      execmacro("findws great britain")
*/
#define horizontal_tab 9
#define space 32
integer find_history =3D 0
proc main()
   string word[255] =3D ""
   string searching[255] =3D query(macrocmdline)
   integer found =3D false
   integer found_line =3D 0
   integer found_column =3D 0
   integer counter =3D 0
   set(break, on)
   if searching =3D=3D ""
      ask("Enter words separated by spaces", searching, find_history)
   endif
   pushposition()
   repeat
      counter =3D 0
      repeat
         counter =3D counter + 1
         word =3D gettoken(searching, " ", counter)
         if word  ""
            if counter =3D=3D 1
               if lfind(word, "ix+")
                  found =3D true
                  found_line =3D currline()
                  found_column =3D currcol()
               else
                  found =3D false
                  word  =3D ""
               endif
            else
               while currchar()  space
               and   currchar()  horizontal_tab
               and   currchar()  _at_eol_
                  nextchar()
               endwhile
               while currchar() =3D=3D space
               or    currchar() =3D=3D horizontal_tab
               or    currchar() =3D=3D _at_eol_
                  nextchar()
               endwhile
               if not lfind(word, "cix")
                  found =3D false
               endif
            endif
         endif
      until found =3D=3D false
      or    word  =3D=3D ""
   until word =3D=3D ""
   if found
      killposition()
      gotoline(found_line)
      gotocolumn(found_column)
   else
      alarm()
      popposition()
      message(searching, " not found.")
   endif
end
proc whenloaded()
    find_history =3D getfreehistory("findws:find")
end
------=_NextPart_000_001F_01BD7C8A.E15C5E20--
---
---------------
* 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™.