<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=""><span style="font-family: monospace; white-space: pre-wrap;" class="">> On </span><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">Sun Oct 22 18:16:10 CEST 2017 Paul Reed wrote:<br class="">>    ...
>    WHILE ch > "!" DO pat[i] := ch; INC(i); Texts.Read(R, ch) END;
>    pat[i] := 0X; pat[i+1] := ch; (*directory option*)
>    …</span></font><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="">A more general solution that also allows for multiple single-character </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">options is:</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="">  i := 0;<br class="">  WHILE ch > " " DO<br class="">    IF ch = "!" THEN pat[i] := 0X; pat[i+1] := "!"; INC(i, 2) (*directory option*)<br class="">    ELSE pat[i] := ch; INC(i)<br class="">    END ;<br class="">    Texts.Read(R, ch)<br class="">  END ;<br class="">  pat[i] := 0X;</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="">The difference is that this solution reads the *entire* argument string, </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">i.e. it </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">does</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">not stop </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">at the first “!” </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">character. This leads to at least two desirable </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">properties:</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="">1) First, it makes it easy to accept *multiple* single-character </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">directory options, so</span></font></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">long as </span><span style="font-family: monospace; white-space: pre-wrap;" class="">the first one is “!” (one could of course</span><span style="font-family: monospace; white-space: pre-wrap;" class=""> remove that limitation). </span><span style="font-family: monospace; white-space: pre-wrap;" class="">For example,</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="">  System.Directory *.Mod!$? ~</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="">could be interpreted</span><font face="monospace" class=""><span style="white-space: pre-wrap;" class=""> as having three </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">single-</span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">character options “!”, “$”, “?”. P</span><span style="white-space: pre-wrap; font-family: monospace;" class="">rocedure</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">System.List </span><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">can be easily adapted </span></font><span style="font-family: monospace; white-space: pre-wrap;" class="">to </span><span style="font-family: monospace; white-space: pre-wrap;" class="">simply read the remaining </span><span style="font-family: monospace; white-space: pre-wrap;" class="">characters after the “!”</span></div><div class=""><font face="monospace" class=""><br class=""></font></div><div class=""><span style="font-family: monospace;" class="">Second, it naturally lends itself to be ported to situations, where </span><span style="font-family: monospace;" class="">the *entire*</span></div><div class=""><span style="font-family: monospace;" class="">argument string MUST be read anyway, for example, when receiving </span><span style="font-family: monospace;" class="">it </span><span style="font-family: monospace;" class="">over an RS232</span></div><div class=""><span style="font-family: monospace;" class="">line - this is the case, for example, in Oberon0.Mod (</span><span style="font-family: monospace;" class="">Oberon-0 </span><span style="font-family: monospace;" class="">command </span><span style="font-family: monospace;" class="">interpreter</span></div><div class=""><span style="font-family: monospace;" class="">which is </span><span style="font-family: monospace;" class="">the top module of </span><span style="font-family: monospace;" class="">the build-up </span><span style="font-family: monospace;" class="">boot file used for booting over a serial line).</span></div><div class=""><span style="font-family: monospace;" class=""><br class=""></span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">With the above modifications, it is easy o make it work in that environment: one</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">only has to replace the line</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="">  Texts.Read(W, ch)</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="">with the following line</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><span style="font-family: monospace; white-space: pre-wrap;" class="">RS232.Rec(x); ch := 0X</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="">Neither original Oberon solution nor the change proposed by Paul would work in</span></font></div><div class=""><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">Oberon0, </span></font><font face="monospace" class=""><span style="white-space: pre-wrap;" class="">since </span></font><span style="white-space: pre-wrap; font-family: monospace;" class="">the partner program on the host computer always sends the *entire*</span></div><div class=""><span style="white-space: pre-wrap; font-family: monospace;" class="">argument </span><span style="font-family: monospace; white-space: pre-wrap;" class="">string, no matter what (see module ORC.Mod). If the c</span><span style="font-family: monospace; white-space: pre-wrap;" class="">lient does not read</span></div><div class=""><span style="font-family: monospace; white-space: pre-wrap;" class="">it all, it will simply hang (or time out). The above code works in all situations.</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="">Just my two Maria Theresien Taler..</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="">-AP</span></font></div></body></html>