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.