Article View: comp.sys.mac
Article #24641Re: sprintf() bug?
From: Joel B Levin
Date: Wed, 03 Feb 1988 17:58
Date: Wed, 03 Feb 1988 17:58
41 lines
1989 bytes
1989 bytes
In article <MW1oTmy00Xo18P01No@andrew.cmu.edu> rs4u+@andrew.cmu.edu (Richard Siegel) writes:
:MPW and Aztec, on the other hand, allow you to pass C strings to ROM calls;
:they *do* have glue. For EVERY SINGLE trap that takes a string, they have
:glue.
:Icky.
As of MPW 2.0, you can avoid the glue in most cases, because two
things have been added:
1. In the #include files, for each trap where the only differences
between the "glued" version and the trap are string type and calling
sequence, a definition has been added which invokes the trap directly,
e.g.,
SetWTitle (theWindow, cString);
gets you some glue, but
SETWTITLE (theWindow, PStringPtr);
gets you the trap without glue. This doesn't work for OS calls which
don't use the stack; there you always need glue, I imagine even in LSC.
2. The compiler recognizes the "special" character \p at the head of a
string constant and translates it to a length byte, so you can now say
SETWTITLE (theWindow, "\pNew title");
I have been playing in my spare time with the problem of translating
LSC into MPW (I don't have LSC or a manual, so I'm half blind) --
specifically, TransSkel, TransDisplay, and TransEdit and their demos.
It has been most educational. Before I learned of these new features
of MPW 2.0, it was a lot of work; this has made it much easier. When
I have done, I'll probably write up the lessons I've learned so it is
easier for someone else to do this. (Unless, of course, someone has
written a translator?)
/JBL
UUCP: {harvard, husc6, etc.}!bbn!levin
ARPA: levin@bbn.com
Technical Details
Message-ID:
<20455@bbn.COM>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!bbn!bbn.com!levinReferences:
<MW1oTmy00Xo18P01No@andrew.cmu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!bbn!bbn.com!levin From: levin@bbn.com (Joel B Levin) Newsgroups: comp.sys.mac Subject: Re: sprintf() bug? Message-ID: <20455@bbn.COM> Date: 3 Feb 88 17:58:03 GMT References: <MW1oTmy00Xo18P01No@andrew.cmu.edu> Sender: news@bbn.COM Reply-To: levin@powell.BBN.COM (Joel B Levin) Organization: BBN Communications Corporation Lines: 41