[comp.sys.mac.programmer] Calling ATM from MPW

chi@tybalt.caltech.edu (Curt Hagenlocher) (07/27/90)

It was a slow day at work yesterday, so I decided to port
the Adobe Type Manager interface routines from Think C
to MPW C.  Just for fun, I fixed the sample programs to
work with MPW also.

If you'd like a copy of these, send mail and I'll email them
to you.  As Adobe makes these freely available, I imagine
there is no problem with this.

---

The fix for the interface routines is somewhat evil.  I
declare them to be pascal void, and then send them the
parameters in reverse order (Pascal and C have backwards
calling conventions.)

It is necessary that they be void so that no space is
cleared on the stack for the result.  The result is returned
from the driver function to the C function in D0.  By
not specifying a return value in the C function (which is
declared int), the value in D0 is returned to the original
caller.

This has been verified by the use of DumpObj.

Guaranteed to work only with MPW C 3.0 or 3.1.  This seems
the sort of solution that would easily break.  Maybe I'll
write a little assembly glue to make it more robust.

---
Curt Hagenlocher		chi@tybalt.caltech.edu
Real bad boys movin' silent