<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">See inline comments.</span></div><br class=""><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">> </span><span style="white-space: pre-wrap; font-family: monospace;" class="">If ch is "!" then we want to put it in pat[i+1], if not then</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">> since </span><span style="white-space: pre-wrap; font-family: monospace;" class="">PROCEDURE List only compares with that value, </span><span style="white-space: pre-wrap; font-family: monospace;" class="">any other one</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">> will do. So </span><span style="white-space: pre-wrap; font-family: monospace;" class="">that's why I suggested putting </span><span style="font-family: monospace; white-space: pre-wrap;" class="">ch in in both cases.</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">You are of course right, but only for this particular implementation</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">of PROCEDURE </span><span style="font-family: monospace; white-space: pre-wrap;" class="">System.List (which checks only that one value).</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class=""><br class=""></span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">M</span><span style="font-family: monospace; white-space: pre-wrap;" class="">y original </span><span style="font-family: monospace; white-space: pre-wrap;" class="">implementation (which clears </span><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">the rest </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">of the *full*</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">pattern array of 32 chars to 0X in order to *always* guarantee</span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">that a </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">“clean” </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">pattern array </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">is </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">presented to System.List</span><span style="white-space: pre-wrap; font-family: monospace;" class="">)</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> ....</span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> WHILE ch > "!" DO pat[i] := ch; INC(i); Texts.Read(R, ch) END;
pat[i] := 0X; INC(i);
IF ch = "!" THEN pat[i] := "!"; INC(i) END ; (*directory option*)
WHILE i < LEN(pat) DO pat[i] := 0X; INC(i) END ;</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> ....</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">would </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">work with ANY implementation of System.List - </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">including one</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">that accepts other (or even multiple) options. See your next point.</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class=""><br class=""></span></div><div class=""><br class=""></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">> FWIW, I was also concerned about what would have to change if</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">> another option was added.</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">I have always lamented about the fact some Oberon commands </span><span style="font-family: monospace; white-space: pre-wrap;" class="">use</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">a “non-</span><span style="font-family: monospace; white-space: pre-wrap;" class="">standard” </span><span style="font-family: monospace; white-space: pre-wrap;" class="">way </span><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">(whatever </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">that </span><span style="white-space: pre-wrap; font-family: monospace;" class="">means in Oberon) of parsing</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">arguments - such as in System.Directory, where</span><span style="font-family: monospace; white-space: pre-wrap;" class=""> the “!” option must</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">come *immediately* </span><span style="white-space: pre-wrap; font-family: monospace;" class="">after </span><span style="white-space: pre-wrap; font-family: monospace;" class="">the pattern, i.e. with *</span><span style="white-space: pre-wrap; font-family: monospace;" class="">no* space allowed.</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class=""><br class=""></span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">This choice may </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">have been motivated by </span><span style="white-space: pre-wrap; font-family: monospace;" class="">the fact that the parameter</span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">“!" is passed on to System.List *as </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">part of the pattern itself*.</span></font></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class=""><br class=""></span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">But </span><span style="white-space: pre-wrap; font-family: monospace;" class="">it didn’t </span><span style="white-space: pre-wrap; font-family: monospace;" class="">have to. </span><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">Since </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">List already uses a global variable </span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">for the pattern, </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">it could </span><span style="white-space: pre-wrap; font-family: monospace;" class="">equally well have used yet </span><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">another </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">global</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">variable </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">‘patOptions' to hold </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">the options (patOptions could be a</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">SET </span><span style="white-space: pre-wrap; font-family: monospace;" class="">for example). </span><span style="font-family: monospace; white-space: pre-wrap;" class="">This would </span><span style="font-family: monospace; white-space: pre-wrap;" class="">have kept the pattern itself clean</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">and separate </span><span style="font-family: monospace; white-space: pre-wrap;" class="">from the options, and also have </span><span style="font-family: monospace; white-space: pre-wrap;" class="">made the handling of</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">multiple </span><span style="font-family: monospace; white-space: pre-wrap;" class="">options a trivial </span><span style="font-family: monospace; white-space: pre-wrap;" class="">exercise.</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">But ok, if we accept the current status quo, the only way to have</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">multiple (single char) options would be to handle them explicitly:</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">e.g. in System.Directory:</span></div><div class=""><br class=""></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> i :=</span> <span style="white-space: pre-wrap;" class="">0;</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> WHILE (ch >= "A") & (ch <= "Z") OR (ch >= "a") & (ch <= "z”</span></font>) <span style="font-family: monospace; white-space: pre-wrap;" class="">OR</span><span style="font-family: monospace; white-space: pre-wrap;" class=""> </span><span style="font-family: monospace; white-space: pre-wrap;" class="">(</span><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">ch = “.”) OR (ch = “*”)</span> </font><span style="font-family: monospace; white-space: pre-wrap;" class="">DO</span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> pat[i] := ch; INC(i); Texts.Read(R, ch)</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> END;<br class=""> pat[i] := 0X; INC(i);</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> WHILE ch > “ “ DO pat[i] := ch; </span></font><span style="font-family: monospace; white-space: pre-wrap;" class="">INC</span><span style="font-family: monospace; white-space: pre-wrap;" class="">(</span><span style="font-family: monospace; white-space: pre-wrap;" class="">i</span><span style="font-family: monospace; white-space: pre-wrap;" class="">);</span><span style="font-family: monospace; white-space: pre-wrap;" class=""> Texts</span><span style="font-family: monospace; white-space: pre-wrap;" class="">.</span><span style="font-family: monospace; white-space: pre-wrap;" class="">Read</span><span style="font-family: monospace; white-space: pre-wrap;" class="">(</span><span style="font-family: monospace; white-space: pre-wrap;" class="">R, ch</span><span style="font-family: monospace; white-space: pre-wrap;" class="">) END ; (*directory options*)</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> </span><span style="font-family: monospace; white-space: pre-wrap;" class="">pat[i] </span><span style="font-family: monospace; white-space: pre-wrap;" class="">:=</span><span style="font-family: monospace; white-space: pre-wrap;" class=""> </span><span style="font-family: monospace; white-space: pre-wrap;" class="">0X</span><span style="font-family: monospace; white-space: pre-wrap;" class="">;</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">e.g. in System.List:</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> INC(j0); ch := pat[j0]</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> WHILE ch # 0X DO (*options*)</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> IF ch = "!" THEN (*option 1*)<br class=""> Kernel.GetSector(adr, hp);<br class=""> Texts.Write(W, 9X); Texts.WriteClock(W, hp.date);<br class=""> Texts.WriteInt(W, hp.aleng*FileDir.SectorSize + hp.bleng - FileDir.HeaderSize, 8) (*length*)<br class=""> (*Texts.WriteHex(W, adr)*)</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> ELSIF ch = “+”</span> THEN ... (*option 2*)<br class=""> </font><span style="font-family: monospace; white-space: pre-wrap;" class=""> ELSIF ch = “?”</span><span style="font-family: monospace;" class=""> THEN ... (*option 3*)</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""> ELSIF </span><span style="font-family: monospace;" class="">...</span><br style="font-family: monospace;" class=""></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> END ;</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> INC(j0)</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> END</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">This is not recommended. It “fills" the pattern with the options</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">which then need to </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">be handled separately in List.</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">It is easier and cleaner </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">use a global variable for the options.</span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""><br class=""></span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">e.g. in System.Directory: </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">INCL(patOptions, option)</span></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">e.g. in System.List: </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">IF 1 IN patOptions THEN...</span></div><div class=""><br class=""></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">My two Groschen..</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class=""><br class=""></span></div><div class="">-AP</div></body></html>