Article View: comp.sys.mac
Article #19771Re: C problem
From: David Phillip Oster
Date: Thu, 01 Oct 1987 18:36
Date: Thu, 01 Oct 1987 18:36
28 lines
1702 bytes
1702 bytes
In article <2120@sfsup.UUCP> shap@sfsup.UUCP (J.S.Shapiro) writes:
>I have tried going indirect via register a5 to get at the host
>application's quickdraw globals structure, and that doesn't seem to work.
>If I simply say 'qd.screenBits', I get the a diagnostic.
What you need to do is:
func(){
qdVarsType *qd; /* I don't know the real name for this type.
It is not defined in LightSpeed C */
/* CurrentA5 is a system low-mem global */
/* it holds a pointer that points to the last qdVar, not
the first like everything else does. */
qd = (qdVarsType *) (CurrentA5 + sizeof(qdVarsType));
qd->screenBits ... /* will access the globals */
...
}
The above trick will also work for LightSpeed C programmers, if they have an
appropriate definition of qdVarsType.
This is all from memory, and may be slightly wrong.
--- David Phillip Oster --A Sun 3/60 makes a poor Macintosh II.
Arpa: oster@dewey.soe.berkeley.edu --A Macintosh II makes a poor Sun 3/60.
Uucp: {uwvax,decvax,ihnp4}!ucbvax!oster%dewey.soe.berkeley.edu
Technical Details
Message-ID:
<21061@ucbvax.BERKELEY.EDU>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!necntc!ames!ucbcad!ucbvax!dewey.soe.berkeley.edu!osterReferences:
<2120@sfsup.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!necntc!ames!ucbcad!ucbvax!dewey.soe.berkeley.edu!oster From: oster@dewey.soe.berkeley.edu (David Phillip Oster) Newsgroups: comp.sys.mac Subject: Re: C problem Message-ID: <21061@ucbvax.BERKELEY.EDU> Date: Thu, 1-Oct-87 14:36:25 EDT Article-I.D.: ucbvax.21061 Posted: Thu Oct 1 14:36:25 1987 Date-Received: Mon, 5-Oct-87 07:17:51 EDT References: <2120@sfsup.UUCP> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) Organization: School of Education, UC-Berkeley Lines: 28