[fpc-devel] EBCDIC (was On a port of Free Pascal to the IBM 370)

Hans-Peter Diettrich DrDiettrich1 at aol.com
Mon Jan 30 17:40:27 CET 2012

steve smithers schrieb:

> Finally, the suggestions about developing FreePascal/370 as an ASCII compiler
> seem somewhat pointless to me.  Why would anyone want to use an ASCII compiler
> on an EBCDIC system?  I accept fully that producing an EBCDIC version will
> present problems, but if this compiler is actually going to be used by anyone,
> these have to be overcome.

Existing source code frequently assumes ASCII encoding. The obvious are 
upper/lowercase conversions, by and/or or add/sub constant values to the 
characters. It will be hell to find and fix all such code in the 
compiler and RTL, even if only the constants have to be modified for 
EBCDIC. Even code with the assumed order of common characters (' ' < '0' 
< 'A' < 'a') has to be found and fixed manually - how would you even 
*find* code with such implicit assumptions?

Next come character ranges, where letters are assumed contiguous in all 
existing code and examples. Clearly this is true only for ASCII 
('a'..'z'), not for national characters like 'ä' or 'é', but the 
compiler assumes ASCII source encoding all over. Fixing the set 
constructor to make Set Of Char work with EBCDIC will be a challenge.

When a user e.g. picks up such example or library code from somewhere, 
and finds that it doesn't work, he'll blame the compiler for malfunction.

An EBCDIC based compiler will disallow the use of any foreign libraries, 
because a simple (syntactic) conversion from ASCII to EBCDIC encoding 
doesn't cover beforementioned (semantic) issues :-(


More information about the fpc-devel mailing list