earleh@eleazar.dartmouth.edu (Earle R. Horton) (09/24/88)
The following fragments, one from an MPW C include file, and one from
an MPW Pascal Interface file, demonstrate a truly horrendous bug in
the MPW C 2.0.2 printing header files. In MPW C, sizeof(int) is equal
to 4, but the size of a Pascal Integer is 2 bytes. Although I haven't
tried it, it looks like use of any of these incorrectly declared data
structures with PrGeneral will create serious alignment problems. All
of the data structures used by PrGeneral are affected.
Q80:mpw:cincludes:PrintTraps.h # C
typedef struct TGetRotnBlk {
int iOpCode;
int iError;
long lReserved;
THPrint hPrint;
Boolean fLandscape;
char bXtra;
} TGetRotnBlk;
Q80:mpw:PInterfaces:PrintTraps.p # Pascal
TGetRotnBlk = RECORD {data block for GetRotn call}
iOpCode: Integer; {input; = getRotnOp}
iError: Integer; {output}
lReserved: LongInt; {reserved for future use}
hPrint: THPrint; {input; handle to a valid print record}
fLandscape: Boolean; {output; Boolean flag}
bXtra: SignedByte; {not used}
END;
Earle R. Horton. 23 Fletcher Circle, Hanover, NH 03755
(603) 643-4109
Sorry, no fancy stuff, since this program limits my .signature to three
darin@Apple.COM (Darin Adler) (09/24/88)
In article <10157@dartvax.Dartmouth.EDU> earleh@eleazar.dartmouth.edu (Earle R. Horton) writes: > The following fragments, one from an MPW C include file, and one from > an MPW Pascal Interface file, demonstrate a truly horrendous bug in > the MPW C 2.0.2 printing header files. Yes, the MPW C 2.0.2 printing header files use int in a number of places where they should use short. This has been fixed in MPW 3.0 by generating the C and Pascal headers from a single database. In the mean time, you can do a global replace (case sensitive, entire word) of "int" with "short" in the Printing.h and PrintTraps.h files for 2.0. -- Darin Adler AppleLink: Adler4 UUCP: {sun,voder,nsc,mtxinu,dual}!apple!darin CSNET: darin@Apple.com