Thread View: net.micro.mac
2 messages
2 total messages
Started by seth
Fri, 28 Dec 1984 23:39
Programs working with DA's
Author: seth
Date: Fri, 28 Dec 1984 23:39
Date: Fri, 28 Dec 1984 23:39
30 lines
1994 bytes
1994 bytes
Having received my copy of Inside Mac, things are slowly becoming clearer.
However I'm still having some trouble with DA's. They start up okay but
then the system seems to reselect my window as the active window. For
example, I started the alarm clock and the time displayed okay but the
little handle and the close box did not appear. My window displayed as
if inactive (i.e. no highlighting). The regions where the handle and
close box should have been were sensitive though and I was able to
pull down the settings part of the clock. What am I missing?
I'm writing C code and using Sumacc and aside from some discrepancies in
the calling sequences things are going well but I'm confused about debugging.
How can I make use of the information provided by MACSBUGMAP? Is there
any way to get Maxbug to use a symbol table so it can print variable names?
For those using Sumacc, I strongly recommend running your code through
lint because most of the Sumacc routines expect pointers while the
Inside Mac documentation specifies structures.
Finally, is anyone keeping an archive of stupid questions about Sumacc and
the like that novices could consult before exposing their ignorance?
Happy hacking,
Seth Goldman
ARPA: seth@UCLA-LOCUS.ARPA
UUCP: ...!{ihnp4,cepu,trwspp,sdcrdcf,ucbvax}!ucla-cs!seth
USMail: Computer Science Department
A.I. Lab, 3531 Boelter Hall
UCLA
Los Angeles, CA 90024
(213) 825-5199
Re: SUMacC Calling Conventions
Author: Ned Horvath
Date: Mon, 31 Dec 1984 18:05
Date: Mon, 31 Dec 1984 18:05
56 lines
3530 bytes
3530 bytes
Read Croft's accompanying documentation, and read the Assembler Programmer's
Guide in inside mac for details of argument passing. In fact, it is
probably necessary to print out a copy of the SUMacC mactrap.s file and look
CAREFULLY at what it does to your arguments.
In fact, much of the confusion can be traced to the fact that Inside Mac was
written from a pascal point of view. Pascal "protects" the programmer from
details like the fact that ANY structure of size 4 bytes or larger gets passed
as a pointer-to-structure, be it VAR or not. Atomic data of length 4
(longs, pointers) get passed directly in the stack unless they are VAR.
A far more painful set of problems stems from the fact that the C string
convention - i.e. terminated by '\0' - and the Mac ROM convention - first
byte contains length - are terribly incompatible. SUMacC strives to isolate
you from the difference by translating strings on-the-fly. You have available:
p2cstr (cp) - translates pascal to C string in place
c2pstr (cp) - translates C to pascal string in place
isapstr (cp) - marks cp as a string mactrap should NOT try to
translate.
The problem is that SUMacC -- at least the beta version, the latest I have --
does not and probably cannot do the whole job, so one winds up looking at
the SUMacC toolbox definitions a lot. The following, in particular, are
things to watch out for:
- only one string argument can be translated by mactrap. Routines like
ParamText which take 4 string arguments have to have isapstr() used
on at least three of them. (Has this been corrected?). In passing,
a trick: any ParamText arguments you don't use can be passed as
isapstr ("") -- the empty string is the only one common to the two
string conventions!
- any argument mactrap treats as VPS must be passed as a C string, and
is always translated on the way back as well. NumToString is an
example.
- strings passed as part of a larger structure -- e.g. the fName member
of the SFReply struct in the Standard File Package -- will always
follow the pascal convention. This is a good example of something
SUMacC should not even try to work around.
- the mac's OSType -- i.e. the 4-character type and creator ID's --
should always be passed as a pointer to a C string: mactrap handles
these specially, passing the first four chars as a long.
Sorry this got long-winded -- the string convention incompatibility has been
the single most frustrating factor in using SUMacC. Watch for it.
Finally, I must say that overall I am VERY pleased with the SUMacC environment.
The above comments are not to be taken as criticism of Bill Croft and the
others who took on a difficult task and carried it off VERY well. Rather,
I want to warn others about a largely-inescapable irritation with trying to
use C for the Mac. It hasn't stopped me, or driven me to pascal or a Lisa...
=Ned=
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads