On Tue, Jan 7, 2020 at 8:25 PM David Griffith via cctalk <
cctalk at classiccmp.org> wrote:
I'm having some trouble getting Frotz 2.50 ported
to TOPS20. Version 2.32
with dumb interface compiles fine under KCC. With 2.50, there are several
preprocessor lines that include parentheses. For instance:
#if UINT_MAX == (1UL<<32)-1UL
typedef unsigned int uint32;
#else
typedef unsigned long uint32;
#endif
I haven't used KCC, but I'm guessing that even if parenthesis worked, the
expression would always be false, because UINT_MAX is not likely to be
2^32-1 on a PDP-10. I would not expect KCC to offer _any_ 32-bit integer
type, and that would expect int to be 36 bits. I'm not sure whether to
expect long to be 36 bits or 72 bits.
Assuming that Frotz doesn't have problems with using a 36-bit integer type
where it expects 32-bit, just replace the whole #if block with the
appropriate typedef, or nest it inside another #ifdef for some KCC- or
PDP-10-specific macro. Or perhaps test CHAR_BIT? An ISO 9899 compliant C
compiler for the PDP-10 would have CHAR_BIT of 9, 12 or some multiple
thereof, but if KCC isn't 9899 compliant that might not be the case.