🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #40318

Re: MPW C 3.0 Help!

#40318
From: Joel B Levin
Date: Tue, 04 Apr 1989 18:06
62 lines
2998 bytes
In article <1748@amelia.nas.nasa.gov> prabhu@amelia.nas.nasa.gov (Dinesh K. Prabhu) writes:
|     I recently got MPW C(3.0) and I am planning on switching to that
|   environment. Could someone give me helpful tips on converting LSC 3.0
|   code to MPW C ? I saw in recent postings that  int == short on LSC
|   and int == long on MPW. Are there many more tiny details like this ?...

An interesting topic.  I have been playing with LSC sources for a
while, and with MPW 3 it's gotten a lot easier.  For instance, I just
ported the entire TransSkel set with demo programs to MPW 3, and it
only took a few hours over several evenings.  After I clean it up and
make it properly portable I'll probably post the diffs.

If the code has a portable definition for integers, you only have to
change the definition: e.g.
    typedef int Integer;
  becomes
    typedef short Integer;

The hardest part was all the .h files; MPW 3 follows very closely the
Inside Mac organization.  So not only are the names different (e.g.,
MenuMgr.h => Menus.h) but you'll probably need to #include more of
them; the most common example of this was Memory.h to deal with all
the Handle handling (:-)) calls.  Often this did not show up until
Link time.

You'll have to get the type declarations right on the toolbox calls,
since the .h files contain full prototypes.  I suppose there is a
switch to suppress this, but I preferred just fixing them.  This was
things like

          ControlHandle	ch;
   ...
	  DisposHandle (ch);
  had to change to
	  DisposHandle ((Handle)ch);

and

	  wp = GetNewWindow (..., -1);
  had to be
	  wp = GetNewWindow (..., (WindowPtr)-1);
	
and a ProcPtr had to be changed to a GrowZoneProcPtr, etc.  The
compiler will show you them pretty fast.

The remaining chore is to build the resources.  If you have a version
of the application or (as in the TransSkel stuff) a foo.proj.rsrc, you
can Derez them and build a Rez file.  In the latter case you'll need
to add the FREF and BNDL resources, or at least I did.  If you only
have the RMaker source, then you'll need RMaker, I guess.

CreateMake does an OK job of making a useable makefile, though I
always change it (one day I'll tackle CreateMake which is, after all,
just a script).

For doing non-applications (DAs, INITs, WDEFs, etc.), there's more
that I won't get into; the support for that kind of stuff, especially
for globals, is quite different on MPW from LSC.  Check the MPW examples.

	/JBL
UUCP:     {backbone}!bbn!levin		POTS: (617) 873-3463
INTERNET: levin@bbn.com
Technical Details
Message-ID: <38226@bbn.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!bbn!bbn.com!levin
References: <1748@amelia.nas.nasa.gov>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!bbn!bbn.com!levin
From: levin@bbn.com (Joel B Levin)
Newsgroups: comp.sys.mac
Subject: Re: MPW C 3.0 Help!
Message-ID: <38226@bbn.COM>
Date: 4 Apr 89 18:06:56 GMT
References: <1748@amelia.nas.nasa.gov>
Sender: news@bbn.COM
Reply-To: levin@BBN.COM (Joel B Levin)
Distribution: usa
Organization: BBN Communications Corporation
Lines: 62