[comp.sys.mac.programmer] MacsBug dcmd's in ThinkC

escher@apple.com (Mike Crawford) (02/13/90)

Anyone had any luck writing MacsBug dcmd's in ThinkC 4.0?  (These are 
custom debugger commands one can write in C or Pascal, and ResEdit into 
the debugger prefs file.  Suddenly, Macsbug has won my heart from TMON).

Apparently one writes an application, then runs an MPW tool to convert the 
App to a dcmd resource.  I don't have MPW at home, and don't want to, as I 
am blessed with ThinkC, so lovely, yet so inextensible.  (Tastes Great!  
Less Filling!)

I could bring my dcmd's to work and convert them here, but then that would 
be a pain and would not work for ThinkC only users.

If anyone has a standalone converter, let me know, or send me some tips 
and I'll write my own and post it (egad, what I get myself into, but then 
I wanna know 68K code better).

E-Mail replies and I will post a summary.

Mike Crawford
Oddball Enterprises
oddball!mike@ucscc.ucsc.edu

Consulting for Apple Computer Inc.
escher@apple.com

These are my own opinions.  No one else may have them.

d88-jwa@nada.kth.se (Jon Watte) (02/13/90)

In article <6650@internal.Apple.COM> escher@apple.com (Mike Crawford) writes:

>Apparently one writes an application, then runs an MPW tool to convert the 
>App to a dcmd resource.  I don't have MPW at home, and don't want to, as I 
>am blessed with ThinkC, so lovely, yet so inextensible.  (Tastes Great!  

So anyone got the interface out of apple ? THINK C is better than
MPW in handling standalone code reources...

h+
-- 
   ---  Stay alert !  -  Trust no one !  -  Keep your laser handy !  ---
             h+@nada.kth.se  ==  h+@proxxi.se  ==  Jon Watte
                    longer .sig available on request

tim@hoptoad.uucp (Tim Maroney) (02/15/90)

In article <2933@draken.nada.kth.se> d88-jwa@nada.kth.se (Jon W{tte) writes:
>THINK C is better than MPW in handling standalone code reources...

I *definitely* don't agree with that.  Building any software that has
more than one code resource is a real pain in THINK C; you've got to
ResEdit the resources from one file to the next by hand, a very tedious
operation.  You also have to open and close multiple projects and give
several build commands by hand.  In MPW, you just write a makefile and
combine all the pieces with Rez.  I don't even think that THINK C has
any noticeable performance advantage when building code resources; its
linker isn't exactly blazing fast itself; and MPW requires far less
programmer effort per build, which is what really counts.  THINK C's
advantages seem to be in the area of quick application
prelink-and-test, and not much else.
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com

"Those who restrain desire, do so because theirs is weak enough to be
 restrained..." - Blake, "The Marriage of Heaven and Hell"

d85-jem@nada.kth.se (Jan-Erik M}ngs) (02/15/90)

In article <10246@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes:
>In article <2933@draken.nada.kth.se> d88-jwa@nada.kth.se (Jon W{tte) writes:
>>THINK C is better than MPW in handling standalone code reources...
>
>I *definitely* don't agree with that...

You are right on most points, but I don't think that was what Jon
ment.  In THINK C 3.x and 4.0 you can write code resources with
globals without the need of anything like "MakeA5World" described in
TN 256 (THINK C uses A4).  In 4.0 you can also write segmented code
resources and you can do them object-oriented.  How do you do that in
MPW? As fas as I know, MPW C++ and Object Pascal can only be used for
applications...

>you've got to ResEdit the resources from one file to the next by
>hand, a very tedious operation.

THINK C 4.0 has a check box named "Merge" that you can use when you
save your resource. No needs for ResEdit anymore...

>Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com
          .
Jan-Erik Mangs

tim@hoptoad.uucp (Tim Maroney) (02/17/90)

In article <2933@draken.nada.kth.se> d88-jwa@nada.kth.se (Jon W{tte) writes:
>>>THINK C is better than MPW in handling standalone code reources...

In article <10246@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes:
>>I *definitely* don't agree with that...

In article <2952@draken.nada.kth.se> d85-jem@nada.kth.se (Jan-Erik M}ngs)
writes:
>You are right on most points, but I don't think that was what Jon
>ment.  In THINK C 3.x and 4.0 you can write code resources with
>globals without the need of anything like "MakeA5World" described in
>TN 256 (THINK C uses A4).

I guess I've never really seen the difficulty.  I wrote several
global-using code resources in MPW C 1.0; actually, I think the first
one used the beta version.  It's not now and never has been a big deal
to do.  Now that Apple has told you how to do it and given example
code, it's as easy as it is in THINK C.

>In 4.0 you can also write segmented code
>resources and you can do them object-oriented.  How do you do that in
>MPW? As fas as I know, MPW C++ and Object Pascal can only be used for
>applications...

I tried to use THINK C's multi-segment resources.  I simply could not
get anything using function pointers to work.  In any case, MPW lets
you link code resources bigger than 32K, so who needs multiple
segments?  I think object-oriented programming is a fad, and I no
longer use it myself, but since you can have globals in MPW, you
can use C++ in code resources.  I believe Keith Rollin has spelled
out exactly how to do this here.

>>you've got to ResEdit the resources from one file to the next by
>>hand, a very tedious operation.
>
>THINK C 4.0 has a check box named "Merge" that you can use when you
>save your resource. No needs for ResEdit anymore...

That's nice; I assume this works similarly to "Rez -a" in MPW.  But you
omitted the other problem I mentioned.  You still have to do one build
operation per code resource, which involves closing a project, opening
a new project, giving a Make:Use Disk command (since cooperating code
resources usually share include files), waiting for that to complete,
then giving a Build Whatever command, then checking the destination
folder, then overriding the existing file, then waiting for the Build
to finish, then repeating for the next code resource.  Not only is
there a lot to do, but you have to watch the computer at every phase
waiting for your next action to come up.  The same operation might take
half again to two times as long in MPW, but you can leave the computer
while it's happening; all you have to do is give a single Build command
(Cmd-B, type name of target (usually "all"), hit return) and let it
fly.  The actual time elapsed may be somewhat longer, but all that time
is yours, whereas very little of it is free time in THINK C.  THINK C
is suffering from a false economy of time.

It's also giving you plenty more opportunities to shoot yourself in the
foot.  "Let's see, did I already rebuild the LDEF or not?  I better do
it again just to make sure."  No such problem with makefiles.
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com

"`Truth' never set anyone free.  It is only *doubt* which will bring
 mental emancipation."
        -- Anton LaVey, quoted by Arthur Lyons, SATAN WANTS YOU

russotto@eng.umd.edu (Matthew T. Russotto) (02/19/90)

In article <10293@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes:
>
>I guess I've never really seen the difficulty.  I wrote several
>global-using code resources in MPW C 1.0; actually, I think the first
>one used the beta version.  It's not now and never has been a big deal
>to do.  Now that Apple has told you how to do it and given example
>code, it's as easy as it is in THINK C.
>
So, how do you write a code resource without having it include the ^&*^&*
A5Init segment?  I was writing an INIT and found I had to write all the
Operating System (register-based) routines in assembly to avoid linking
with CRuntime and CInterface.
--
Matthew T. Russotto	russotto@eng.umd.edu	russotto@wam.umd.edu
][, ][+, ///, ///+, //e, //c, IIGS, //c+ --- Any questions?

tim@hoptoad.uucp (Tim Maroney) (02/20/90)

In article <10293@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes:
>>I guess I've never really seen the difficulty.  I wrote several
>>global-using code resources in MPW C 1.0; actually, I think the first
>>one used the beta version.  It's not now and never has been a big deal
>>to do.  Now that Apple has told you how to do it and given example
>>code, it's as easy as it is in THINK C.

In article <1990Feb19.151837.22953@eng.umd.edu> russotto@eng.umd.edu
(Matthew T. Russotto) writes:
>So, how do you write a code resource without having it include the ^&*^&*
>A5Init segment?  I was writing an INIT and found I had to write all the
>Operating System (register-based) routines in assembly to avoid linking
>with CRuntime and CInterface.

Why do you want to avoid including %A5Init?  I always linked it in by
using a segment name command in the MPW Linker to merge it with the
main code segment, e.g., if the main segment is called Internet, then
give the directive "-sn "%A5Init"=Internet" to the linker.

You probably don't need CInterface these days, with the new include
files and calling conventions.  (Though I don't see what's so horrific
about linking with it....)  You probably do need parts of CRunTime,
since it contains arithmetic routines used to implement the operators.
If there's anything in CRunTime that interferes with you, there are two
solutions.  First is to make a stripped copy of the library (using the
-df flag to Lib) which omits any troublesome routines like main.  The
second is simply to write your own routines with the same names as the
troublesome ones, link CRunTime last, and turn off linker warnings.  I
generally prefer the first solution.
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com

"I am convinced that cross-posting is an evil Satanic plot."
    -- Eugene Miya on soc.net-people, misc.headlines, misc.kids, misc.misc,
		      news.misc, and soc.misc