CHAR to/from BYTE conversion
We have ORD() and CHR(). ORD() converts CHAR to INTEGER. CHR() converts INTEGER to CHAR. How to convert BYTE to/from CHAR ? Can a CHAR byte hold -ve values? Seems not... BYTE also represents values from 0 to 255. Then what is the difference between BYTE and CHAR? We say, BYTE and INTEGER are compatible; If we assign -12 to a BYTE, what will happen? Kindly help me understanding these. With thanks and best regards, Yours sincerely, Srinivas Nayak Home: http://www.mathmeth.com/sn/ Blog: http://srinivas-nayak.blogspot.in/
Hi Srinivas Let's assume you have three variables VAR c: CHAR; b: BYTE; i: INTEGER; If you write c := CHR(b), it internally works as if you wrote i := b; c := CHR(i); If you write b := ORD(c), it internally works as if you wrote i := ORD(c); b := i; The difference of BYTE and CHAR is the type; with BYTE you can do calculations, with CHAR you cannot. CHAR hold ASCII characters. Jörg -----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Srinivas Nayak Sent: Mittwoch, 6. Juli 2016 16:00 To: ETH Oberon and related systems <oberon@lists.inf.ethz.ch> Subject: [Oberon] CHAR to/from BYTE conversion We have ORD() and CHR(). ORD() converts CHAR to INTEGER. CHR() converts INTEGER to CHAR. How to convert BYTE to/from CHAR ? Can a CHAR byte hold -ve values? Seems not... BYTE also represents values from 0 to 255. Then what is the difference between BYTE and CHAR? We say, BYTE and INTEGER are compatible; If we assign -12 to a BYTE, what will happen? Kindly help me understanding these. With thanks and best regards, Yours sincerely, Srinivas Nayak Home: http://www.mathmeth.com/sn/ Blog: http://srinivas-nayak.blogspot.in/ -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Hmmm... That means both CHAR and BYTE holds values 0 to 255. But BYTE values can take part in calculations, where as CHAR values are only interpreted as ASCII codes, which can't take part in calculations. With thanks and best regards, Yours sincerely, Srinivas Nayak Home: http://www.mathmeth.com/sn/ Blog: http://srinivas-nayak.blogspot.in/ On 07/06/2016 08:23 PM, Jörg wrote:
Hi Srinivas
Let's assume you have three variables VAR c: CHAR; b: BYTE; i: INTEGER;
If you write c := CHR(b), it internally works as if you wrote i := b; c := CHR(i); If you write b := ORD(c), it internally works as if you wrote i := ORD(c); b := i;
The difference of BYTE and CHAR is the type; with BYTE you can do calculations, with CHAR you cannot. CHAR hold ASCII characters.
Jörg
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Srinivas Nayak Sent: Mittwoch, 6. Juli 2016 16:00 To: ETH Oberon and related systems <oberon@lists.inf.ethz.ch> Subject: [Oberon] CHAR to/from BYTE conversion
We have ORD() and CHR(). ORD() converts CHAR to INTEGER. CHR() converts INTEGER to CHAR.
How to convert BYTE to/from CHAR ?
Can a CHAR byte hold -ve values? Seems not... BYTE also represents values from 0 to 255. Then what is the difference between BYTE and CHAR?
We say, BYTE and INTEGER are compatible; If we assign -12 to a BYTE, what will happen?
Kindly help me understanding these.
With thanks and best regards,
Yours sincerely, Srinivas Nayak
Home: http://www.mathmeth.com/sn/ Blog: http://srinivas-nayak.blogspot.in/ -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Hi Srinivas,
That means both CHAR and BYTE holds values 0 to 255.
No, CHAR holds characters, 0X to 0FFX, including "A", "B" etc.; and BYTE holds 0 to 255, a sub-range of the INTEGER range. Your statement is indicative of how much damage C has done to the world :) Cheers, Paul
That means both CHAR and BYTE holds values 0 to 255.
No, CHAR holds characters, 0X to 0FFX, including "A", "B" etc.; and BYTE holds 0 to 255, a sub-range of the INTEGER range.
Your statement is indicative of how much damage C has done to the world :)
Characters should not be just English characters. Your statement is indicative of how much damage ASCII has done to the world :) W.
Don't open that can of worms :-) - Should LEN(s) return the number of characters in s (logical length) or the number of bytes of s (physical length)? - shoudn't the type CHAR better be called "ASCII"? - As Unicode characters need up to 32 bit, should CHAR be 32 bit? Strings are quite tricky, especially a compact internal representation of them. Jörg
Am 08.07.2016 um 20:50 schrieb Skulski, Wojciech <skulski@pas.rochester.edu>:
That means both CHAR and BYTE holds values 0 to 255.
No, CHAR holds characters, 0X to 0FFX, including "A", "B" etc.; and BYTE holds 0 to 255, a sub-range of the INTEGER range.
Your statement is indicative of how much damage C has done to the world :)
Characters should not be just English characters.
Your statement is indicative of how much damage ASCII has done to the world :)
W. -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Jörg Straube Sent: Saturday, 9 July 2016 5:06 AM To: ETH Oberon and related systems Cc: paulreed@paddedcell.com Subject: Re: [Oberon] CHAR to/from BYTE conversion
Don't open that can of worms :-) - Should LEN(s) return the number of characters in s (logical length) or the number of bytes of s (physical length)?
Neither. LEN is the number of elements of an array. An array declared as VAR s: ARRAY 12 OF CHAR will always have 12 elements no matter how long the string is that is currently stored in the array. LEN("abc") = 4 (* including the terminating NULL character *) s := "abc"; LEN(s) = 12 Similarly for an array declared as VAR a: ARRAY 12 OF INTEGER LEN(a) = 12. SYSTEM.SIZE will give you the number of bytes allocated to a variable. SYSTEM indicates that the value that SIZE returns is implementation-dependent. The length of a string is the number of characters up to but not including the null terminating character. The longest string that can be stored in the array s where LEN(s) = 12 is 11 characters.
- shoudn't the type CHAR better be called "ASCII"?
No. Since 2013 the Oberon Report has not required it be Latin-1 / ASCII. CHAR is now defined as 'the characters of a standard character set'.
- As Unicode characters need up to 32 bit, should CHAR be 32 bit?
There is nothing stopping an implementer of Oberon from defining characters as 32-bit (or 16-bit for that matter) items if they wanted it to be used to develop applications that required a character set other than ASCII.
Strings are quite tricky, especially a compact internal representation of them.
True. Regards, Chris Burrows CFB Software http://www.astrobe.com
Am 08.07.2016 um 20:50 schrieb Skulski, Wojciech <skulski@pas.rochester.edu>:
That means both CHAR and BYTE holds values 0 to 255.
No, CHAR holds characters, 0X to 0FFX, including "A", "B" etc.; and BYTE holds 0 to 255, a sub-range of the INTEGER range.
Your statement is indicative of how much damage C has done to the world :)
Characters should not be just English characters.
Your statement is indicative of how much damage ASCII has done to the world :)
W. -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Chris Indeed, you're right the Oberon-07 report allows for any charcter coding as the formulation "ordinal value" (of type INTEGER) is quite open. Even EBCDIC would do. One small remark though, the Oberon EBNF is not complete as the rule "character" (used in the definition of "string") is not defined. The ProjectOberon implementation supports CHAR in the range 0X to 7FX. If the implementation decides for Unicode you should probably take UTF-32 as internal representation of CHAR, and INTEGER has to have at least 32 bit. If you would take UTF-16 or UTF-8 the rather simple ch := s[5] get's quite complicated to implement. If you restrict yourself to Unicode BMP (no emoji), UTF-16 will do and INTEGERs can have 16 bit. Jörg Am 09.07.2016 um 04:03 schrieb Chris Burrows <chris@cfbsoftware.com>:
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Jörg Straube Sent: Saturday, 9 July 2016 5:06 AM To: ETH Oberon and related systems Cc: paulreed@paddedcell.com Subject: Re: [Oberon] CHAR to/from BYTE conversion
Don't open that can of worms :-) - Should LEN(s) return the number of characters in s (logical length) or the number of bytes of s (physical length)?
Neither.
LEN is the number of elements of an array. An array declared as
VAR s: ARRAY 12 OF CHAR
will always have 12 elements no matter how long the string is that is currently stored in the array.
LEN("abc") = 4 (* including the terminating NULL character *)
s := "abc"; LEN(s) = 12
Similarly for an array declared as
VAR a: ARRAY 12 OF INTEGER
LEN(a) = 12.
SYSTEM.SIZE will give you the number of bytes allocated to a variable. SYSTEM indicates that the value that SIZE returns is implementation-dependent.
The length of a string is the number of characters up to but not including the null terminating character. The longest string that can be stored in the array s where LEN(s) = 12 is 11 characters.
- shoudn't the type CHAR better be called "ASCII"?
No. Since 2013 the Oberon Report has not required it be Latin-1 / ASCII. CHAR is now defined as 'the characters of a standard character set'.
- As Unicode characters need up to 32 bit, should CHAR be 32 bit?
There is nothing stopping an implementer of Oberon from defining characters as 32-bit (or 16-bit for that matter) items if they wanted it to be used to develop applications that required a character set other than ASCII.
Strings are quite tricky, especially a compact internal representation of them.
True.
Regards,
Chris Burrows CFB Software http://www.astrobe.com
Am 08.07.2016 um 20:50 schrieb Skulski, Wojciech <skulski@pas.rochester.edu>:
That means both CHAR and BYTE holds values 0 to 255.
No, CHAR holds characters, 0X to 0FFX, including "A", "B" etc.; and BYTE holds 0 to 255, a sub-range of the INTEGER range.
Your statement is indicative of how much damage C has done to the world :)
Characters should not be just English characters.
Your statement is indicative of how much damage ASCII has done to the world :)
W. -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Chris Just realized the using the second rule in this definition string = """ {character} """ | digit {hexdigit} "X" . makes your code non-portable. The expression ("a" = 61X) is TRUE in one implementation and FALSE in another. Jörg
Am 09.07.2016 um 08:34 schrieb Jörg Straube <joerg.straube@iaeth.ch>:
Chris
Indeed, you're right the Oberon-07 report allows for any charcter coding as the formulation "ordinal value" (of type INTEGER) is quite open. Even EBCDIC would do. One small remark though, the Oberon EBNF is not complete as the rule "character" (used in the definition of "string") is not defined.
The ProjectOberon implementation supports CHAR in the range 0X to 7FX.
If the implementation decides for Unicode you should probably take UTF-32 as internal representation of CHAR, and INTEGER has to have at least 32 bit. If you would take UTF-16 or UTF-8 the rather simple ch := s[5] get's quite complicated to implement. If you restrict yourself to Unicode BMP (no emoji), UTF-16 will do and INTEGERs can have 16 bit.
Jörg
Am 09.07.2016 um 04:03 schrieb Chris Burrows <chris@cfbsoftware.com>:
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Jörg Straube Sent: Saturday, 9 July 2016 5:06 AM To: ETH Oberon and related systems Cc: paulreed@paddedcell.com Subject: Re: [Oberon] CHAR to/from BYTE conversion
Don't open that can of worms :-) - Should LEN(s) return the number of characters in s (logical length) or the number of bytes of s (physical length)?
Neither.
LEN is the number of elements of an array. An array declared as
VAR s: ARRAY 12 OF CHAR
will always have 12 elements no matter how long the string is that is currently stored in the array.
LEN("abc") = 4 (* including the terminating NULL character *)
s := "abc"; LEN(s) = 12
Similarly for an array declared as
VAR a: ARRAY 12 OF INTEGER
LEN(a) = 12.
SYSTEM.SIZE will give you the number of bytes allocated to a variable. SYSTEM indicates that the value that SIZE returns is implementation-dependent.
The length of a string is the number of characters up to but not including the null terminating character. The longest string that can be stored in the array s where LEN(s) = 12 is 11 characters.
- shoudn't the type CHAR better be called "ASCII"?
No. Since 2013 the Oberon Report has not required it be Latin-1 / ASCII. CHAR is now defined as 'the characters of a standard character set'.
- As Unicode characters need up to 32 bit, should CHAR be 32 bit?
There is nothing stopping an implementer of Oberon from defining characters as 32-bit (or 16-bit for that matter) items if they wanted it to be used to develop applications that required a character set other than ASCII.
Strings are quite tricky, especially a compact internal representation of them.
True.
Regards,
Chris Burrows CFB Software http://www.astrobe.com
Am 08.07.2016 um 20:50 schrieb Skulski, Wojciech <skulski@pas.rochester.edu>:
That means both CHAR and BYTE holds values 0 to 255.
No, CHAR holds characters, 0X to 0FFX, including "A", "B" etc.; and BYTE holds 0 to 255, a sub-range of the INTEGER range.
Your statement is indicative of how much damage C has done to the world :)
Characters should not be just English characters.
Your statement is indicative of how much damage ASCII has done to the world :)
W. -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
On 7/8/2016 11:58 PM, Jörg Straube wrote:
string = """ {character} """ | digit {hexdigit} "X" . How about dropping the hex representation and leaving character abstract? string = """ {character} """
But then one needs, tab, end-of-line, form-feed, etc, to also be abstract.
Hi In his Oberon report, Wirth leaves the character coding very undefined. He leaves it up to the implementation a) how many bytes a CHAR has and b) what coding is used. However in a lot of places you clearly see source code that only works if ASCII (or Latin-1) encoding is assumed. Eg in Texts.Scan you find: IF ch <= "9" THEN d := ORD(ch) - 30H ELSE d := ORD(ch) - 37H; hex := TRUE END; This code will not work if the implementation would decide for EBCDIC. This source code is a little better (would work for ASCII and EBCDIC) IF ch <= "9" THEN d := ORD(ch) ORD("0") ELSE d := ORD(ch) (ORD("A") 10); hex := TRUE END; br Jörg From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Douglas G. Danforth Sent: Montag, 11. Juli 2016 01:13 To: ETH Oberon and related systems <oberon@lists.inf.ethz.ch> Subject: Re: [Oberon] CHAR to/from BYTE conversion On 7/8/2016 11:58 PM, Jörg Straube wrote: string = """ {character} """ | digit {hexdigit} "X" . How about dropping the hex representation and leaving character abstract? string = """ {character} """ But then one needs, tab, end-of-line, form-feed, etc, to also be abstract.
Joerg:
Eg in Texts.Scan you find:
IF ch <= "9" THEN d := ORD(ch) - 30H ELSE d := ORD(ch) - 37H; hex := TRUE END;
I was always amused by NW advocating high level programming, using named constants rather than hard coding the numbers, etc. And then in his published book Project Oberon the reader can enjoy seeing "1", "2", and "3" meaning mouse clicks left, middle, and right. Which is the exact opposite of the principles NW was teaching. The grad students then cleaned the code in their Unix/Linux/Windows ports of Project Oberon. They used ML, MM, MR meaning mouse left, middle, right. I always wondered in NW intentionally provided them a real life example of his own questionable programming style so they could correct bad programming. W.
Am 2016-07-11 um 17:13 schrieb Skulski, Wojciech:
I was always amused by NW advocating high level programming, using named constants rather than hard coding the numbers, etc. And then in his published book Project Oberon the reader can enjoy seeing "1", "2", and "3" meaning mouse clicks left, middle, and right. Which is the exact opposite of the principles NW was teaching.
I don't think the master of simplicity ever advocated using named constants in cases like this. It is not difficult to count to three when looking at the mouse keys, and it wouldn't be possible to change the number assignment anyhow without breaking compatibility to central Oberon System modules.
The grad students then cleaned the code in their Unix/Linux/Windows ports of Project Oberon. They used ML, MM, MR meaning mouse left,
Students often exaggerate when applying the principles of their master. :) Richard
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Richard Hable
Am 2016-07-11 um 17:13 schrieb Skulski, Wojciech:
I was always amused by NW advocating high level programming, using named constants rather than hard coding the numbers, etc. And then in his published book Project Oberon the reader can enjoy seeing "1", "2", and "3" meaning mouse clicks left, middle, and right. Which is the exact opposite of the principles NW was teaching.
I don't think the master of simplicity ever advocated using named constants in cases like this. It is not difficult to count to three when looking at the mouse keys, and it wouldn't be possible to change the number assignment anyhow without breaking compatibility to central Oberon System modules.
The grad students then cleaned the code in their Unix/Linux/Windows ports of Project Oberon. They used ML, MM, MR meaning mouse left,
Students often exaggerate when applying the principles of their master. :)
ML, MM and MR aren't much better than 1, 2 and 3 anyway, since they refer to the physical position of the buttons rather than to the semantics. The semantics of the mouse should also include the chords. B
One thing I noticed, we put a couple of Oberon statements in a single line... Does this have any special significance? I mean, is it that, the statements that are put in a single line are somehow very closely related (logically) than other statements in other lines? With thanks and best regards, Yours sincerely, Srinivas Nayak Home: http://www.mathmeth.com/sn/ Blog: http://srinivas-nayak.blogspot.in/ On 07/11/2016 11:43 PM, Bob Walkden wrote:
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Richard Hable
Am 2016-07-11 um 17:13 schrieb Skulski, Wojciech:
I was always amused by NW advocating high level programming, using named constants rather than hard coding the numbers, etc. And then in his published book Project Oberon the reader can enjoy seeing "1", "2", and "3" meaning mouse clicks left, middle, and right. Which is the exact opposite of the principles NW was teaching.
I don't think the master of simplicity ever advocated using named constants in cases like this. It is not difficult to count to three when looking at the mouse keys, and it wouldn't be possible to change the number assignment anyhow without breaking compatibility to central Oberon System modules.
The grad students then cleaned the code in their Unix/Linux/Windows ports of Project Oberon. They used ML, MM, MR meaning mouse left,
Students often exaggerate when applying the principles of their master. :)
ML, MM and MR aren't much better than 1, 2 and 3 anyway, since they refer to the physical position of the buttons rather than to the semantics. The semantics of the mouse should also include the chords.
B -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
Srinivas Thats purely a matter of personal taste. I personally put "short" things building one logical block on one line. Eg. len := 0; WHILE s[len] # 0X DO INC(len) END; These statements calculate the length "len" of the string "s" and build logically one entity. But you could format this block as follows: len := 0; WHILE s[len] # 0X DO INC(len) END; Or very uncommon as follows: len := 0; WHILE s[len] # 0X DO INC(len) END; Some of my "rules": - When there is a logical block consisting of few statements taking less than let's say 60 characters, I put it on one line. - I almost never put statements on the same line after a BEGIN. - If not all statements of a THEN or ELSE clause fit on one line, I will use a line break after the THEN or ELSE. - I don't like this type of construct (long IF, short ELSE) IF p = NIL THEN (* a huge bunch of statements doing this and that taking up several lines or even several pages *) ELSE Error(30) END I rather rewrite this to IF p # NIL THEN Error(30) ELSE (* a huge bunch of statements doing this and that taking up several lines or even several pages *) END But all these rules I made up for me, might not be applicable to other people. Jörg -----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Srinivas Nayak Sent: Dienstag, 12. Juli 2016 03:53 To: ETH Oberon and related systems <oberon@lists.inf.ethz.ch> Subject: Re: [Oberon] NW programming style One thing I noticed, we put a couple of Oberon statements in a single line... Does this have any special significance? I mean, is it that, the statements that are put in a single line are somehow very closely related (logically) than other statements in other lines? With thanks and best regards, Yours sincerely, Srinivas Nayak Home: http://www.mathmeth.com/sn/ Blog: http://srinivas-nayak.blogspot.in/ On 07/11/2016 11:43 PM, Bob Walkden wrote:
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Richard Hable
Am 2016-07-11 um 17:13 schrieb Skulski, Wojciech:
I was always amused by NW advocating high level programming, using named constants rather than hard coding the numbers, etc. And then in his published book Project Oberon the reader can enjoy seeing "1", "2", and "3" meaning mouse clicks left, middle, and right. Which is the exact opposite of the principles NW was teaching.
I don't think the master of simplicity ever advocated using named constants in cases like this. It is not difficult to count to three when looking at the mouse keys, and it wouldn't be possible to change the number assignment anyhow without breaking compatibility to central Oberon System modules.
The grad students then cleaned the code in their Unix/Linux/Windows ports of Project Oberon. They used ML, MM, MR meaning mouse left,
Students often exaggerate when applying the principles of their master. :)
ML, MM and MR aren't much better than 1, 2 and 3 anyway, since they refer to the physical position of the buttons rather than to the semantics. The semantics of the mouse should also include the chords.
B -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Srinivas Nayak Sent: Tuesday, 12 July 2016 11:23 AM To: ETH Oberon and related systems Subject: Re: [Oberon] NW programming style
One thing I noticed, we put a couple of Oberon statements in a single line... Does this have any special significance? I mean, is it that, the statements that are put in a single line are somehow very closely related (logically) than other statements in other lines?
The Oberon microsystems' BlackBox Component Pascal Help file includes a section called 'Programming Conventions' which describes these sorts of programming style issues. The conventions described are typical of those used by Oberon programmers. You can download the complete BlackBox system from: http://www.oberon.ch/blackbox.html Alternatively, Oberon microsystems kindly gave us permission to use the guidelines in the Astrobe 'ARM Cortex-M Oberon Programmers Guide'. You can download a copy from: http://www.astrobe.com/Oberon.htm See Chapter 7 'Programming Conventions and Guidelines'. Regards, Chris Chris Burrows CFB Software http://www.astrobe.com
Might I suggest downloading BlackBox from http://blackboxframework.org/index.php?cID=home,en-us That site is the current development site for BlackBox and now contains BlackBox 1.7-rc (release candidate) which has a number of bug fixes of 1.6. -Doug Danforth On 7/12/2016 5:53 AM, Chris Burrows wrote:
You can download the complete BlackBox system from:
http://www.oberon.ch/blackbox.html
Alternatively, Oberon microsystems kindly gave us permission to use the guidelines in the Astrobe 'ARM Cortex-M Oberon Programmers Guide'. You can download a copy from:
http://www.astrobe.com/Oberon.htm
See Chapter 7 'Programming Conventions and Guidelines'.
-----Original Message----- From: Oberon [mailto:oberon-bounces@lists.inf.ethz.ch] On Behalf Of Richard Hable
Am 2016-07-11 um 17:13 schrieb Skulski, Wojciech:
I was always amused by NW advocating high level programming, using named constants rather than hard coding the numbers, etc. And then in his published book Project Oberon the reader can enjoy seeing "1", "2", and "3" meaning mouse clicks left, middle, and right. Which is the exact opposite of the principles NW was teaching.
I don't think the master of simplicity ever advocated using named constants in cases like this. It is not difficult to count to three when looking at
Layering. At the lowest level, the mouse has three switches, ML, MM, MR. One layer up from that, you get chords. The moment you start talking about abstraction (by e.g. assigning named constants), you should start thinking about layers of abstraction, and NOT confusing the layers. This was the real message in Dijkstra's seminal paper "Structure of the T.H.E. Multiprogramming System". (It is best known for introducing semaphores.) --John R. Strohm -----Original Message----- From: Bob Walkden Sent: Monday, July 11, 2016 1:13 PM To: 'ETH Oberon and related systems' Subject: Re: [Oberon] NW programming style the
mouse keys, and it wouldn't be possible to change the number assignment anyhow without breaking compatibility to central Oberon System modules.
The grad students then cleaned the code in their Unix/Linux/Windows ports of Project Oberon. They used ML, MM, MR meaning mouse left,
Students often exaggerate when applying the principles of their master. :)
ML, MM and MR aren't much better than 1, 2 and 3 anyway, since they refer to the physical position of the buttons rather than to the semantics. The semantics of the mouse should also include the chords. B -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
On Mon, July 11, 2016 11:45 am, Richard Hable wrote:
Am 2016-07-11 um 17:13 schrieb Skulski, Wojciech:
I was always amused by NW advocating high level programming, using named constants rather than hard coding the numbersg.
I don't think the master of simplicity ever advocated using named constants in cases like this. It is not difficult to count to three when looking at the mouse keys
So, if you had a program with just three procedures, a simple utility, it would be better to make the program like this: PROCEDURE ONE; BEGIN END; PROCEDURE TWO; BEGIN END; PROCEDURE THREE; BEGIN END; BEGIN ONE; TWO; THREE END. Rather than being sensible and doing this: PROCEDURE WriteToFile; BEGIN END; PROCEDURE CloseFile; BEGIN END; PROCEDURE PrintToScreen; BEGIN END; BEGIN WriteToFile; CloseFile; PrintToScreen END. Because after all, one, two, three, is simpler.. right? But what does one, two, three, even mean? What does it say? nothing at all.. it's useless information... it could mean anything, or nothing at all... whereas descriptive names mean something in code while reading it. So you would prefer a program that just said ONE TWO THREE instead of being descriptive? Why, if procedures are named properly, shouldn't named constants also be named properly? The only time something shouldn't be named, is a variable such as "i" like a loop counter, where i just means a loop integer or a loop number.... But for named constants... why in the world would you be satisfied with one, two, three...... I don't know... If procedures should be named, why not other things like variables and constants?
Am 2016-09-05 um 11:59 schrieb Lars:
BEGIN WriteToFile; CloseFile; PrintToScreen END.
Apples and Oranges. You are comparing the naming of three procedures doing different things with the naming of mouse buttons. Contrary to these procedures, all mouse buttons are alike--they only differ in their positions on the mouse. And positions are best stored as integer values. Richard
Hello! 06.09.2016, 00:55, "Richard Hable" <informujo@aon.at>:
Apples and Oranges.
You are comparing the naming of three procedures doing different things with the naming of mouse buttons. Contrary to these procedures, all mouse buttons are alike--they only differ in their positions on the mouse. And positions are best stored as integer values.
You are forgetting that a left-handed person would prefer to have button 3 as the primary button (being under his/her index finger). But number 1 is hard-coded. Good luck searching for that number to replace it with 3 - which would be a trivial operation with named constants, and could even be loaded from a configuration file. ---=====--- Александр
Am 2016-09-06 um 11:32 schrieb Alexander Ilin:
You are forgetting that a left-handed person would prefer to have button 3 as the primary button (being under his/her index finger).
Nope, support for left handers is yet another reason not to give names like ML, MM, and MR to the mouse buttons, because the left hander will prefer ML to be on the right side etc.
But number 1 is hard-coded. Good luck searching for that number to replace it with 3 - which would be a trivial operation with named constants, and could even be loaded from a configuration file.
Supporting left handers should never require to search and replace every single reference to a mouse button within application source code. Instead, a simple flag could be provided to switch between enumerating the buttons from left to right to the opposite direction. Richard
Exactly. C and C++ together have spread a severe mental disease. Now I am trying to unlearn things, which now seems very very difficult. :-( Surprised to discover yesterday that: "The >> operator in C and C++ is an arithmetic shift if used with a signed integer type. If it is used on an unsigned integer type instead, it will be a logical shift." "The (1999) ISO standard for the programming language C defines the right shift operator in terms of divisions by powers of 2. Because of the above-stated non-equivalence, the standard explicitly excludes from that definition the right shifts of signed numbers that have negative values. It doesn't specify the behaviour of the right shift operator in such circumstances, but instead requires each individual C compiler to define the behaviour of shifting negative values right." Now I am comparing and contrast semantics of C's division / and %, to that of Oberon's DIV and MOD. And how they are related to Shifts. What happens when division and modulus' operands are combinations of positive and negative numbers... :-( With thanks and best regards, Yours sincerely, Srinivas Nayak Home: http://www.mathmeth.com/sn/ Blog: http://srinivas-nayak.blogspot.in/ On 07/08/2016 11:14 PM, Paul Reed wrote:
Hi Srinivas,
That means both CHAR and BYTE holds values 0 to 255.
No, CHAR holds characters, 0X to 0FFX, including "A", "B" etc.; and BYTE holds 0 to 255, a sub-range of the INTEGER range.
Your statement is indicative of how much damage C has done to the world :)
Cheers, Paul
-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon .
participants (12)
-
Alexander Ilin -
Bob Walkden -
Chris Burrows -
Douglas G. Danforth -
John R. Strohm -
Jörg -
Jörg Straube -
Lars -
Paul Reed -
Richard Hable -
Skulski, Wojciech -
Srinivas Nayak