[Oberon] CHAR to/from BYTE conversion

Jörg joerg.straube at iaeth.ch
Mon Jul 11 13:04:02 CEST 2016


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 at lists.inf.ethz.ch] On Behalf Of Douglas
G. Danforth
Sent: Montag, 11. Juli 2016 01:13
To: ETH Oberon and related systems <oberon at 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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20160711/2f804ca0/attachment.html>


More information about the Oberon mailing list