[comp.unix.aux] just getting my feet wet.... question...

johnj@osiris.UUCP (John Johnston) (03/17/89)

	I'm just getting my feet wet with a MacII running A/UX and have
been looking into some of the toolbox stuff - so I read the example 'term'
source code, and started finding things like:

	InsertResMenu(menu,'FONT',0);

where the second argument is supposed to be a ResType, which is a
long! From the way it looks and works, however, it appears that that
@!#&! abominable code is the way the Mac expects to see things ? Is
this possible ? 

	--mjr();
	mjr@cthulhu.welch.jhu.edu

phil@Apple.COM (Phil Ronzone) (03/18/89)

In article <2876@osiris.UUCP> mjr@cthulhu.welch.jhu.edu writes:
>... and started finding things like:
>	InsertResMenu(menu,'FONT',0);
>where the second argument is supposed to be a ResType, which is a
>long! From the way it looks and works, however, it appears that that
>@!#&! abominable code is the way the Mac expects to see things ? Is
>this possible ? 

Yes, the Toolbox uses a fair number of 4 bytes character "strings", which
are dealt with as 32-bit words. The Point data structure is the same,
although, as a structure, it is acceptable nowadays to pass structures
in C.

Heritage of small ROM/RAM/assembly language days. It does mean that it is
a bit tricky porting QuickDraw to a Cray! :-) :-) :-)

+------------------------+-----------------------+----------------------------+
| Philip K. Ronzone      | A/UX System Architect | APPLELINK: RONZONE1        |
| Apple Computer MS 27AJ +-----------------------+----------------------------+
| 10500 N. DeAnza Blvd.  | Computer viruses don't cause security problems,    |
| Cupertino CA 95014     | computer programmers do ...                        |
+------------------------+----------------------------------------------------+
|{amdahl,decwrl,sun,voder,nsc,mtxinu,dual,unisoft}!apple!phil                 |
+-----------------------------------------------------------------------------+

hearn@claris.com (Bob Hearn) (03/18/89)

>
>	I'm just getting my feet wet with a MacII running A/UX and have
>been looking into some of the toolbox stuff - so I read the example 'term'
>source code, and started finding things like:
>
>	InsertResMenu(menu,'FONT',0);
>
>where the second argument is supposed to be a ResType, which is a
>long! From the way it looks and works, however, it appears that that
>@!#&! abominable code is the way the Mac expects to see things ? Is
>this possible ? 
>
>	--mjr();
>	mjr@cthulhu.welch.jhu.edu

Notice 'FONT' is in single quotes, not double.  Thus it is a character
constant, not a string.  Admittedly, K&R only have single-char constants,
but it is a useful extension.  The C compiler will happily convert the
4-byte constant to a long.  The Mac "expects" a long; it doesn't care how
you specify it.  The code looks that way because that's the easiest way to
build a ResType.

Bob Hearn
hearn@claris.com