System.Directory options
On Sun Oct 22 18:16:10 CEST 2017 Paul Reed wrote: ... WHILE ch > "!" DO pat[i] := ch; INC(i); Texts.Read(R, ch) END; pat[i] := 0X; pat[i+1] := ch; (*directory option*) …
A more general solution that also allows for multiple single-character options is: i := 0; WHILE ch > " " DO IF ch = "!" THEN pat[i] := 0X; pat[i+1] := "!"; INC(i, 2) (*directory option*) ELSE pat[i] := ch; INC(i) END ; Texts.Read(R, ch) END ; pat[i] := 0X; The difference is that this solution reads the *entire* argument string, i.e. it does not stop at the first “!” character. This leads to at least two desirable properties: 1) First, it makes it easy to accept *multiple* single-character directory options, so long as the first one is “!” (one could of course remove that limitation). For example, System.Directory *.Mod!$? ~ could be interpreted as having three single-character options “!”, “$”, “?”. Procedure System.List can be easily adapted to simply read the remaining characters after the “!” Second, it naturally lends itself to be ported to situations, where the *entire* argument string MUST be read anyway, for example, when receiving it over an RS232 line - this is the case, for example, in Oberon0.Mod (Oberon-0 command interpreter which is the top module of the build-up boot file used for booting over a serial line). With the above modifications, it is easy o make it work in that environment: one only has to replace the line Texts.Read(W, ch) with the following line RS232.Rec(x); ch := 0X Neither original Oberon solution nor the change proposed by Paul would work in Oberon0, since the partner program on the host computer always sends the *entire* argument string, no matter what (see module ORC.Mod). If the client does not read it all, it will simply hang (or time out). The above code works in all situations. Just my two Maria Theresien Taler.. -AP
Andreas: I wonder whether we should not adopt some of the Unix/Linux syntax at this point in order to make the System somewhat more palatable to casual users. Which probably means "all users". The directory listing command would look like this: System.Directory *.Mod-la ~ where minus sign "-" means there will be options, and the option letters "l" (small L), "a", and possibly others will have the same meaning as in Unix. The "la" options are among the most commonly used, and for a reason. This syntax can be adopted in addition to your "!" discussion. Just allow the minus sign to be on the list of the interpreted symbols. My proposition stems from recently using the Oberon System, both the FPGA and the Linz V4. Years ago I was a proficient user of Linz V4, but now I am constantly puzzled and a bit annoyed, though I still remember a bit. I wonder if it makes sense to acknowledge that for most users the Oberon System is not, and it will never be, their only computer interface. It would make the user's life a little bit easier if some common conventions are adopted from Linux, which is probably familiar to everyone on this list at some elementary level. Just my two groszes. Wojtek ________________________________________ From: Oberon [oberon-bounces@lists.inf.ethz.ch] on behalf of Andreas Pirklbauer [andreas_pirklbauer@yahoo.com] Sent: Wednesday, November 1, 2017 10:40 AM To: ETH Oberon and related systems Subject: [Oberon] System.Directory options
On Sun Oct 22 18:16:10 CEST 2017 Paul Reed wrote: ... > WHILE ch > "!" DO pat[i] := ch; INC(i); Texts.Read(R, ch) END; > pat[i] := 0X; pat[i+1] := ch; (*directory option*) > …
A more general solution that also allows for multiple single-character options is: i := 0; WHILE ch > " " DO IF ch = "!" THEN pat[i] := 0X; pat[i+1] := "!"; INC(i, 2) (*directory option*) ELSE pat[i] := ch; INC(i) END ; Texts.Read(R, ch) END ; pat[i] := 0X; The difference is that this solution reads the *entire* argument string, i.e. it does not stop at the first “!” character. This leads to at least two desirable properties: 1) First, it makes it easy to accept *multiple* single-character directory options, so long as the first one is “!” (one could of course remove that limitation). For example, System.Directory *.Mod!$? ~ could be interpreted as having three single-character options “!”, “$”, “?”. Procedure System.List can be easily adapted to simply read the remaining characters after the “!” Second, it naturally lends itself to be ported to situations, where the *entire* argument string MUST be read anyway, for example, when receiving it over an RS232 line - this is the case, for example, in Oberon0.Mod (Oberon-0 command interpreter which is the top module of the build-up boot file used for booting over a serial line). With the above modifications, it is easy o make it work in that environment: one only has to replace the line Texts.Read(W, ch) with the following line RS232.Rec(x); ch := 0X Neither original Oberon solution nor the change proposed by Paul would work in Oberon0, since the partner program on the host computer always sends the *entire* argument string, no matter what (see module ORC.Mod). If the client does not read it all, it will simply hang (or time out). The above code works in all situations. Just my two Maria Theresien Taler.. -AP
On 1 November 2017 at 12:54, Skulski, Wojciech <skulski@pas.rochester.edu> wrote (in part):
I wonder whether we should not adopt some of the Unix/Linux syntax at this point in order to make the System somewhat more palatable to casual users.
Do you mean adding a "glob-like" expander under the hood? As you know, the shell expands regexp in Unix but where would you put this in the Oberon I/F? N.
Nemo: adding tools like regular expressions ("embellishments" in Oberon speak) is the task for users. There are lots of applications of any sort under Linz V4, and even more in Component Pascal Collection. These can be ported back to plain vanilla Oberon System, if one is desperate. My proposition was more modest. Since there is a discussion of the directory listing options, and there is a proposition for adding multiple options, and these options are activated with single characters, it all starts looking familiar to me. If so, then why use characters like !@#$% for these options, if there is already a case, which is known to everyone? It will be more user friendly if similar functionality is provided in a way which we all already use on daily basis. On a more general basis, the character "!" was clearly a hack. It was meant an as exception to otherwise clean rules. Apparently, clean rules led to restrictions, and the real life prevailed. The story looks familiar to me. An exception is tolerable if it stays an exception. But the exceptions, which proliferate, should be telling something. My proposition says "let's acknowledge that there is need for <something>", which in this case is a need for options. I proposed to essentially follow Andreas's thoughts, but use familiar characters for these options. A more thorough proposition would say "lets make the options stand out more clearly", which is already the case with other modules such as the compiler. I am not going that far. Does it make sense? Wojtek ________________________________________ From: Oberon [oberon-bounces@lists.inf.ethz.ch] on behalf of Nemo [cym224@gmail.com] Sent: Wednesday, November 1, 2017 2:05 PM To: ETH Oberon and related systems Subject: Re: [Oberon] System.Directory options On 1 November 2017 at 12:54, Skulski, Wojciech <skulski@pas.rochester.edu> wrote (in part):
I wonder whether we should not adopt some of the Unix/Linux syntax at this point in order to make the System somewhat more palatable to casual users.
Do you mean adding a "glob-like" expander under the hood? As you know, the shell expands regexp in Unix but where would you put this in the Oberon I/F? N. --
participants (3)
-
Andreas Pirklbauer -
Nemo -
Skulski, Wojciech