[Oberon] Re: n-o: Rx.Tool ? span multiple lines

easlab at absamail.co.za easlab at absamail.co.za
Sun Nov 2 11:19:52 CET 2003

> > I'm getting emails like this (from win users) :-----------
> > <p class=3DMsoPlainText><font size=3D2 face=3D"Courier New"><span lang=3D=
> > EN-ZA
> > style=3D'font-size:10.0pt'>
> > I have made some remarks for you. You are welc=
> > ome to
> > phone me anytime.<o:p></o:p></span></font></p>
> > -----------
> > And it is politically incorrect for me to tell the sender to "do it properly".
> > I suspect they feel they must have a spell checker available ?

Edgar wrote:
> So we have a similar problem at the moment.
> I now do it like this:
> 	(* For scanner *)
> 	TagClass* = 8;
> 	ArrClass* = 9;
--- <snip spource code> ---

Yes I use something similar to 'clean-up' the headers of the News articles.
As I remember, a 2-pass process. 1st pass:
*  WHILE counting lines
    Scan for the critical Tokens {"From:" , "Newsgroups:", "Subject:"}
2nd pass:
*  Step-Read by char while counting lines
    to set the counters at the boundries of the parts to be deleted.
*   Delete the parts from the end backwards.

I don't like programing n-o.  Perhaps I'm too old now ? 
My excuse is that n-o lacks a good IDE.  I do like USING it.

cg> How would I add 5 spaces with RX ?

Peter E. wrote:
> 	RX.SetSearch  ({~c} c) X1
> 	RX.SetReplace "     " X1
> Set the insertion mark where you want to start.
> 	RX.Search
> Repeat RX.Replace as many times as you want.
> cg> I think RX needs to use Desktops.OpenDoc  frames ?
> Originally RX needed Gadgets and for a few 
> years now it has worked on a Text.  A history is
> at the head of RX.Mod in Native 05.01.2003.  This 
> might be another motivation to install Native 
> 05.01.2003.
> cg> I vaguely remember that Rx.* can't span 
> multiple lines.
> As I understand that restriction remains; don't 
> understand the algorithm well enough to know 
> whether it could be removed.
OK, on my 2001 ver., I found that ET.Do RXmargin5
      where RXmargin5 == 3 line Script-file:
RX.SetSearch  ({~c} c) X1
RX.SetReplace "     " X1
RX.ReplaceAll *
 ===  does it also for Edit.Open texts.   Thanks !

I hate RX.Tool ! Since I couldn't get it to delete
    "=>" <text to line end>
of a text and had to manually delete some 100 files.

<Some trivial user-tips>:
Related to RX.Tool , when I want to search a big partition for a
phrase which I've used/seen the last few days, I do:
1. to restict to last 3 days == SmartDir.Directory <partn>:*\r 3
    which gives a dir listing {I don't think SmartDir.Directory is yet
   included in the n-o package. I find it useful and use it daily.}
2. Store the dirlist from 1.
3. remove the redundant *.Bak by:  RX.Grep SmartDir.Directory \i   ".Bak"
4. head the list with Find.Domain [and tail with ~]
5. select the 'searchString' & Find.All ^

Sounds like a lot of work, but it could reduce the file-search-space 
by 95%.

I though I'd extend this trick to answer the following question:
 recently my News article numbers were invalid, and the fetch time
was longer and some previously unavailable groups were available.

I guessed that my ISP was using a different News server.
I noticed that the news-headers were:
  <something>aus1<someting> ..."

So I'm guessing that the news is coming from australia !
Inteligence can be added to the 'guess' by noting the 'office hours' of
aus ...etc re. response time.
But still I'd like to see an old header from before things changed.
Probably I should have some old file with:
somewhere in my SYS: partition.

Now lets see if RX.Grep can list all files except:
  *.Tool , *.Pict , *.Scn.Fnt , *.Mod , *.Obj , *.Bak , *.Arc 

1. System.Directory SYS:*   == 1395 files  {in a flash !}

2. Store the Directory

3. RX.Grep Directory  \i   ".Bak"
    == quiet slowly list files in Text = RX.Grep   & 
TRAP 7  Index out of range (PC Native 11.10.2001)
RXA.SearchRX  PC = 9366
	subexp = FALSE
RXA.Search  PC = 9626
  But strangely the last entry is the last entry of Directory , so apparently
  the complete Directory was processed; removing each *.Bak == OK.
*  Store RX.Grep & Miscellaneous.CountLines RX.Grep ~ 
   ==>  RX.Grep	1151 CR  

 4.  RX.Grep RX.Grep  \i  ( ".Obj" | ".Scn.Fnt" ) 
== no trap  NB don't use ~ to terminate these commands !!
*  Store RX.Grep & Miscellaneous.CountLines RX.Grep ~ 
   ==>  RX.Grep	670 CR  ==> reduced to 670 files	
I'm guessing the TRAP 7 comes from a 1000 dimensioned array overflow ?
This is another bug for the TODO list - for someone.

5.   RX.Grep RX.Grep  \i  (".Mod"| ".Text" | ".Arc" | ".Pict" )
*  Store RX.Grep & Miscellaneous.CountLines RX.Grep ~ 
   ==>  RX.Grep	481 CR  ==> reduced to 481 files
6.   RX.Grep RX.Grep  \i  (".Tool" | ".Panel" | ".zip" )
*  Store RX.Grep & Miscellaneous.CountLines RX.Grep ~ 
   ==> RX.Grep	365 CR

7. RX.Grep RX.Grep  \i  (".Fig" | ".html" | ".Lib" | ".Bin" | ".Config" )
*  Store RX.Grep & Miscellaneous.CountLines RX.Grep ~ 
   ==>  RX.Grep	315 CR

8. RX.Grep Directory  \i (".Bak"|".Obj"|".Scn.Fnt"|".Mod"|".Text"|".Arc"|".Pict"|".Tool"|".Panel"|".zip"|".Fig"|".html"|".Lib"|".Bin"|".Config" )
*  Store RX.Grep & Miscellaneous.CountLines RX.Grep ~ 
   ==>  RX.Grep	315 CR
It seems that nothing was lost during the Trap 7 ?

BTW this reducing the 'attention space' of the SYS: partiton from 1395 files 
to 315  makes it much more manageable, altho' I didn't find an old News
header.   So I still don't know if my newsServer is in australia ?

I think it's best to move ALL *.Mod out of SYS: to SrcModls: ?
The secret of computing (and life ) is to reduce the complexity.

IMO a main reason why RX.Tool is problematic (as evidenced by the
previous flurry of posts) is that it breaks the convention of n-o:
  RX.Tool commands are terminated by <line-ternination> .
The instinctive command termination by "~" (possibly followed by
comments) is disasterous !   I don't see a technical solution to this,
but the "human" solution is to note this fact at the start of RX.Tool

==  Chris Glur.

More information about the Oberon mailing list