<div dir="ltr">so that is what I did. Here is the modified module<div><br></div><div>Nomore matchprefix. New Match and 2 changed lines calling those modules in Enumerate.</div><div><br></div><div>Does anybody feel the need for the '+' globbing char? I am willing to implement it, but personally I do not remember when I used it last.</div><div><br></div><div><br></div><div>----------------------------------------------snip</div><div><br></div><div><div><br></div><div><div>(* ETH Oberon, Copyright 2001 ETH Zuerich Institut fuer Computersysteme, ETH Zentrum, CH-8092 Zuerich.</div><div>Refer to the "General ETH Oberon System Source License" contract available at: <a href="http://www.oberon.ethz.ch/">http://www.oberon.ethz.ch/</a> *)</div><div><br></div><div>MODULE FileDir;<span class="" style="white-space:pre"> </span>(* pjm *)</div><div><br></div><div>(* Linux FileDir module not based on OFS </div><div><br></div><div><span class="" style="white-space:pre">               </span>2014-11-25<span class="" style="white-space:pre">        </span>p.m.: MLO version, not tested</div><div><span class="" style="white-space:pre">              </span>2014-11-28<span class="" style="white-space:pre">                </span>made Enumerate work with qemu-mips</div><div><span class="" style="white-space:pre">         </span>2015-04-13<span class="" style="white-space:pre">                </span>added PathChar; made  interface compatible to latest alpha</div><div><br></div><div>ToDo: test make interface compatible to latest alpha, add OFSenumerate</div><div><br></div><div>*)</div><div><br></div><div>IMPORT Kernel, Files, SYSTEM;</div><div><br></div><div>CONST</div><div><span class="" style="white-space:pre">      </span>EnumSize*=0; EnumTime*=1; EnumRecursive*=2; EnumStop*=15; EnumUserMin*=16; EnumUserMax*=31;</div><div><br></div><div>TYPE</div><div><br></div><div><span class="" style="white-space:pre">   </span>EntryHandler* = PROCEDURE (name: ARRAY OF CHAR; time, date, size: LONGINT; VAR flags: SET);</div><div><br></div><div><span class="" style="white-space:pre">       </span>FileName* = Files.FileName;</div><div><br></div><div><span class="" style="white-space:pre">       </span>DirEntP= POINTER TO RECORD</div><div><span class="" style="white-space:pre">                                 </span>dino: LONGINT;</div><div><span class="" style="white-space:pre">                                     </span>doff: LONGINT;</div><div><span class="" style="white-space:pre">                                     </span>dreclen: INTEGER;</div><div><span class="" style="white-space:pre">                                  </span>dname: FileName;</div><div>(*<span class="" style="white-space:pre">                                 </span>pad, type: CHAR;  pad, type do it manually manually *)</div><div><span class="" style="white-space:pre">                            </span>END;</div><div><br></div><div>VAR</div><div><span class="" style="white-space:pre">    </span>PathChar*: CHAR;</div><div><br></div><div><br></div><div>PROCEDURE Match(VAR mask, name: ARRAY OF CHAR): BOOLEAN;</div><div>VAR m,n, om, on: LONGINT;</div><div><span class="" style="white-space:pre">  </span>f: BOOLEAN;</div><div>BEGIN</div><div><span class="" style="white-space:pre">    </span>m := 0; n := 0; om := -1;</div><div><span class="" style="white-space:pre">  </span>f := TRUE;</div><div><span class="" style="white-space:pre"> </span>LOOP</div><div><span class="" style="white-space:pre">               </span>IF (mask[m] = "*") THEN</div><div><span class="" style="white-space:pre">                  </span>om := m; INC(m);</div><div><span class="" style="white-space:pre">                   </span>WHILE (name[n] # 0X) & (name[n] # mask[m]) DO INC(n) END;</div><div><span class="" style="white-space:pre">                      </span>on := n</div><div><span class="" style="white-space:pre">            </span>ELSIF (mask[m] = "?") THEN</div><div><span class="" style="white-space:pre">                       </span>INC(m); INC(n)</div><div><span class="" style="white-space:pre">             </span>ELSE</div><div><span class="" style="white-space:pre">                       </span>IF (mask[m] # name[n]) THEN</div><div><span class="" style="white-space:pre">                                </span>IF (om = -1) THEN f := FALSE; EXIT</div><div><span class="" style="white-space:pre">                         </span>ELSE (* try the next position *)</div><div><span class="" style="white-space:pre">                                   </span>m := om; n := on + 1;</div><div><span class="" style="white-space:pre">                                      </span>IF (name[n] = 0X) THEN f := FALSE; EXIT END</div><div><span class="" style="white-space:pre">                                </span>END</div><div><span class="" style="white-space:pre">                        </span>ELSE INC(m); INC(n)</div><div><span class="" style="white-space:pre">                        </span>END</div><div><span class="" style="white-space:pre">                </span>END;</div><div><span class="" style="white-space:pre">               </span>IF (mask[m] = 0X) & ((name[n] = 0X) OR (om=-1)) THEN EXIT END</div><div><span class="" style="white-space:pre">  </span>END;</div><div><span class="" style="white-space:pre">       </span>RETURN f & (name[n] = 0X)</div><div>END Match;</div><div><br></div><div><br></div><div>(** Enumerate files matching the mask.  proc is upcalled for every file.  Iff detail is TRUE, the time, date and size parameters will be valid.  Recursive calls to Enumerate are not allocated in proc. *)</div><div>PROCEDURE Enumerate*(mask: ARRAY OF CHAR; flags: SET; proc: EntryHandler);</div><div>VAR res, time, date, size: LONGINT;</div><div><span class="" style="white-space:pre">   </span>diff, pos: LONGINT;</div><div><span class="" style="white-space:pre">        </span>status: Kernel.Status;</div><div><span class="" style="white-space:pre">     </span>i, j, num, min, dir, rbytes: LONGINT;</div><div><span class="" style="white-space:pre">      </span>buf: ARRAY 128000 OF CHAR;</div><div><span class="" style="white-space:pre"> </span>i1: ARRAY 10000 OF DirEntP;</div><div><span class="" style="white-space:pre">        </span>de: DirEntP;</div><div>BEGIN</div><div><span class="" style="white-space:pre">   </span>buf[0]:="."; buf[1]:= 0X;</div><div><span class="" style="white-space:pre">        </span>dir:=Kernel.Open0(SYSTEM.ADR(buf), Kernel.RDonly, 0);</div><div><span class="" style="white-space:pre">      </span>rbytes:= Kernel.GetDents0( dir, SYSTEM.ADR( buf), LEN( buf));</div><div><span class="" style="white-space:pre">      </span>IF rbytes<=0 THEN rbytes:=-rbytes; Kernel.WriteString(" error "); END;</div><div><span class="" style="white-space:pre">        </span>res:=Kernel.Close0( dir);</div><div><span class="" style="white-space:pre">  </span>i:=0; num:=0;</div><div><span class="" style="white-space:pre">      </span>de:=SYSTEM.VAL( DirEntP, SYSTEM.ADR( buf[ i]));</div><div><span class="" style="white-space:pre">    </span>WHILE (i<rbytes) & (num<LEN(i1)) DO</div><div><span class="" style="white-space:pre">              </span>IF Match (mask, de.dname) THEN</div><div><span class="" style="white-space:pre">                     </span>i1[ num]:= de;</div><div><span class="" style="white-space:pre">                     </span>INC( num);</div><div><span class="" style="white-space:pre">         </span>END;</div><div><span class="" style="white-space:pre">               </span>i:=i+de.dreclen;</div><div><span class="" style="white-space:pre">           </span>de:=SYSTEM.VAL( DirEntP, SYSTEM.ADR( buf[ i]));</div><div><span class="" style="white-space:pre">    </span>END;</div><div><span class="" style="white-space:pre">       </span>IF num>=LEN(i1) THEN num:=0 END;</div><div><span class="" style="white-space:pre">        </span>i1[ num]:=NIL;</div><div><span class="" style="white-space:pre">     </span>(* using cripplesort, might be fast enough*)</div><div><span class="" style="white-space:pre">       </span>i:=0;</div><div><span class="" style="white-space:pre">      </span>WHILE i<num DO</div><div><span class="" style="white-space:pre">          </span>min:=i;</div><div><span class="" style="white-space:pre">            </span>j:=min+1;</div><div><span class="" style="white-space:pre">          </span>WHILE j<num DO</div><div><span class="" style="white-space:pre">                  </span>IF (i1[ j].dname<i1[min].dname) THEN</div><div><span class="" style="white-space:pre">                            </span>min:=j;</div><div><span class="" style="white-space:pre">                    </span>END;</div><div><span class="" style="white-space:pre">                       </span>INC( j);</div><div><span class="" style="white-space:pre">           </span>END;</div><div><span class="" style="white-space:pre">               </span>de:=i1[ i];</div><div><span class="" style="white-space:pre">                </span>i1[ i]:= i1[ min];</div><div><span class="" style="white-space:pre">         </span>i1[ min]:= de;</div><div><span class="" style="white-space:pre">             </span>INC( i);</div><div><span class="" style="white-space:pre">   </span>END;</div><div><span class="" style="white-space:pre">       </span></div><div><span class="" style="white-space:pre">   </span>j:=0;</div><div><span class="" style="white-space:pre">      </span>de:= i1[ 0];</div><div><span class="" style="white-space:pre">       </span>WHILE de#NIL DO</div><div><span class="" style="white-space:pre">            </span>IF flags#{}  THEN</div><div><span class="" style="white-space:pre">                 </span>res:=Kernel.Stat0( SYSTEM.ADR(de.dname[0]), SYSTEM.ADR(status));</div><div><span class="" style="white-space:pre">                   </span>size:= status.size;</div><div><span class="" style="white-space:pre">                        </span>Kernel.U2OTime( status.mtime, date, time);</div><div><span class="" style="white-space:pre">         </span>ELSE</div><div><span class="" style="white-space:pre">                       </span>time:=0; date:=0; size:= MIN( LONGINT);</div><div><span class="" style="white-space:pre">            </span>END;</div><div><span class="" style="white-space:pre">               </span>proc( de.dname, time, date, size, flags);</div><div><span class="" style="white-space:pre">          </span>INC( j);</div><div><span class="" style="white-space:pre">           </span>de:= i1[ j];</div><div><span class="" style="white-space:pre">       </span>END;</div><div>END Enumerate;</div><div><br></div><div>BEGIN</div><div><span class="" style="white-space:pre">     </span>PathChar := "/"</div><div>END FileDir.</div><div>(* Local Variables:  *)</div><div>(* coding: mac-roman *)</div><div>(* tab-width: 2      *)</div><div>(* End:              *)</div></div><div><br></div><div>--------------------------------------------------------snip</div><div><br></div><div>j.</div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 30, 2015 at 10:41 PM, Jan de Kruyf <span dir="ltr"><<a href="mailto:jan.de.kruyf@gmail.com" target="_blank">jan.de.kruyf@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">There is a "Match" in OFSFATFiles that looks a lot healthier.<div><br></div><div>So the issue is 'PROCEDURE MatchPrefix'. what on earth is it there for?</div><div><br></div><div>Also I have not proven to myself why Modules.Mod is shown and OLR.Modules.Mod is not shown.</div><div>And on top of it I do not see that a leading * gobbles any amount of chars in the module as it stands, unless I am blind.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>j.</div><div><br></div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 30, 2015 at 10:04 PM, Jan de Kruyf <span dir="ltr"><<a href="mailto:jan.de.kruyf@gmail.com" target="_blank">jan.de.kruyf@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hallo,<div>schoene Misthaufen!</div><div><br></div><div>I am a bit confused by 'PROCEDURE MatchPrefix'</div><div>Do we need such a thing here?</div><div>NW has it in Project Oberon to limit the search to a sub-range.</div><div><br></div><div>And what do I expect out of the Kernel? regular unix filenames, with Oberon limitations?</div><div>(I could kprint the buffer of course)</div><div><br></div><div>Other than that maybe start from fresh according to this plan:</div><div>---------</div><div><div>? matches any one character</div><div>+ matches one or more characters</div><div>* matches zero or more characters</div></div><div>----------</div><div>and no escape character or regex patterns.</div><div><br></div><div>Plan:</div><div>Split the pattern into normal runs and glob characters and do some very simple backtracking algorithm, or maybe not even that. come to think of it.</div><div><br></div><div>Now on with my emacs lisp, making 2 emacs windows talk to each other via the clipboard. Lots of fun.</div><div><br></div><div>cheers,</div><div><br></div><div>j.</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 30, 2015 at 7:38 PM, Peter Matthias <span dir="ltr"><<a href="mailto:PeterMatthias@web.de" target="_blank">PeterMatthias@web.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hallo Jan,<br>
<span><br>
<br>
Am 27.09.2015 um 21:02 schrieb Jan de Kruyf:<br>
> Hallo Peter,<br>
><br>
>  > Also pattern matching algorithm has a bug. E.G. System.Directory *.Mod~<br>
>  > does not show Modules.Mod. If someone has a clever implementation,<br>
>  > please let me know. For the Linux kernel side I will implement it.<br>
><br>
> You mean OLR.Modules.Mod ( and some others).<br>
><br>
> I was having my sunday afternoon fun :)<br>
><br>
> Is this bug to be found in (OLR.)Find.Mod ?<br>
<br>
</span>This is in OLR.FileDir.Mod . Procedure Match should be the culprit.<br>
If you have questions about the Linux side, let me know.<br>
<br>
Regards,<br>
        Peter<br>
<span><br>
<br>
> If so, tell me what the filename is supposed to be here:<br>
>   --Domain*;(* {filename} ~ *)--<br>
><br>
> Then I will have a look.<br>
> PROCEDURE BrowseFile(filename: ARRAY OF CHAR);<br>
> does not look like rocket science to me.<br>
 ><br>
> Cheers,<br>
><br>
> j.<br>
><br>
><br>
> On Fri, Sep 25, 2015 at 11:24 AM, Peter Matthias <<a href="mailto:PeterMatthias@web.de" target="_blank">PeterMatthias@web.de</a><br>
</span><div><div>> <mailto:<a href="mailto:PeterMatthias@web.de" target="_blank">PeterMatthias@web.de</a>>> wrote:<br>
><br>
><br>
><br>
>     Am 23.09.2015 um 17:26 schrieb Peter Easthope:<br>
>     > Hello,<br>
>     ><br>
>     > In OLR, has anyone found a way to store user data separately<br>
>     > from OLR system data?  As a specific example, OLR is installed<br>
>     > in /home/peter/olr on the HDD.  User data is in a SDHC card.<br>
>     > The SDHC can be mounted at /home/peter/olr/SDHC.<br>
>     ><br>
>     > ls /home/peter/olr/SDHC/* shows the contents of the SDHC.<br>
>     > System.Directory ./SDHC/* ~ shows nothing.<br>
>     ><br>
>     > Does anyone have a clever solution?<br>
><br>
>     Hi Peter,<br>
><br>
>     I was out for holidays, so the answer a little bit later:<br>
><br>
>     System.Directory does not show the files in the ./SDHC directory. Only<br>
>     flat files. However, you can open and store the files of that directory<br>
>     using the filename with the directory. E.g. Edit.Open ./SDHC/Test.Text ~<br>
>     as long as filename length is not exceeded. "." and "/" at the beginning<br>
>     work, "~" at the beginning does not work as this is evaluated in the<br>
>     shell and not in the kernel.<br>
><br>
>     Also pattern matching algorithm has a bug. E.G. System.Directory *.Mod~<br>
>     does not show Modules.Mod. If someone has a clever implementation,<br>
>     please let me know. For the Linux kernel side I will implement it.<br>
><br>
>     Regards,<br>
>              Peter<br>
><br>
>     --<br>
</div></div>>     <a href="mailto:Oberon@lists.inf.ethz.ch" target="_blank">Oberon@lists.inf.ethz.ch</a> <mailto:<a href="mailto:Oberon@lists.inf.ethz.ch" target="_blank">Oberon@lists.inf.ethz.ch</a>> mailing<br>
<div><div>>     list for ETH Oberon and related systems<br>
>     <a href="https://lists.inf.ethz.ch/mailman/listinfo/oberon" rel="noreferrer" target="_blank">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a><br>
><br>
><br>
><br>
><br>
> --<br>
> <a href="mailto:Oberon@lists.inf.ethz.ch" target="_blank">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems<br>
> <a href="https://lists.inf.ethz.ch/mailman/listinfo/oberon" rel="noreferrer" target="_blank">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a><br>
><br>
<br>
--<br>
<a href="mailto:Oberon@lists.inf.ethz.ch" target="_blank">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems<br>
<a href="https://lists.inf.ethz.ch/mailman/listinfo/oberon" rel="noreferrer" target="_blank">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>