Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!bu-cs!dartvax!eleazar.dartmouth.edu!earleh
From: earleh@eleazar.dartmouth.edu (Earle R. Horton)
Newsgroups: comp.sys.mac.programmer
Subject: Bug in MPW C 2.0.2 print header files.
Keywords: Try calling PrGeneral!
Message-ID: <10157@dartvax.Dartmouth.EDU>
Date: 23 Sep 88 20:29:56 GMT
Sender: news@dartvax.Dartmouth.EDU
Reply-To: earleh@eleazar.dartmouth.edu (Earle R. Horton)
Organization: Society to make my life more fun.
Lines: 32

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