[comp.sys.mac.programmer] MPW Pascal and libraries

franklin@uvicctr.UVic.CA.UUCP (Katherine Franklin) (03/14/90)

I'm just beginning to program on the Mac with MPW Pascal. I have the
MPW manuals and the Pascal Manual. Why does it feel like there is
something missing ? How do I find out what is in the libraries and
how they work ? I've looked at the interface files, but they are
confusing and there are so many of them !! I haven't a clue where to begin
looking for what !! 

Example: I need to convert an integer to a string. It seems like a simple
and common task that I would expect to either be a standard routine or in
the libraries somewhere. Looking for every reference to strings in the the
Pascal manual yields nothing. Is it in the libraries ? I have no idea. Nor
do I know how to begin looking for the info.

Am I missing something ?

	Katherine

------
Katherine Franklin			franklin@uvicctr.uvic.ca
University of Victoria			franklin@uvunix.bitnet
Victoria, BC, Canada			

chewy@apple.com (Paul Snively) (03/15/90)

In article <958@uvicctr.UVic.CA.UUCP> franklin@uvicctr.UVic.CA.UUCP 
(Katherine Franklin) writes:
> I'm just beginning to program on the Mac with MPW Pascal. I have the
> MPW manuals and the Pascal Manual. Why does it feel like there is
> something missing ? How do I find out what is in the libraries and
> how they work ? I've looked at the interface files, but they are
> confusing and there are so many of them !! I haven't a clue where to 
begin
> looking for what !! 
> 
> Example: I need to convert an integer to a string. It seems like a simple
> and common task that I would expect to either be a standard routine or in
> the libraries somewhere. Looking for every reference to strings in the 
the
> Pascal manual yields nothing. Is it in the libraries ? I have no idea. 
Nor
> do I know how to begin looking for the info.
> 
> Am I missing something ?
> 
>         Katherine

You certainly are, if the documents that you named are the only ones that 
you have on the subject.

You'll need at least Inside Macintosh Volumes I-IV, and volume V if you 
intend to support Macintosh SE- or II-class machines.  Also, you'll need 
the Macintosh Technical Notes, which are available via anonymous FTP to 
apple.com, in pub/dts/mac/tn, I believe.

Among other things, Inside Macintosh documents NumToString, which takes an 
INTEGER and a VAR STR255, e.g.:

VAR
  theErr: INTEGER;
  tempString: STR255;
...
NumToString(theErr, tempString);
...

This will convert theErr to a string, which you can then do whatever you 
wish with.

Hope this helps!

__________________________________________________________________________
                                Paul Snively
                      Macintosh Developer Technical Support
                             Apple Computer, Inc.

1st Choice: Paul_Snively.DTS@qm.gateway.apple.com
2nd Choice: CHEWBACCA@applelink.apple.com
Last Choice: chewy@apple.com

Just because I work for Apple Computer, Inc. doesn't mean that I believe 
what they believe, or vice-versa.
__________________________________________________________________________

drc@claris.com (Dennis Cohen) (03/15/90)

chewy@apple.com (Paul Snively) writes:

>You certainly are, if the documents that you named are the only ones that 
>you have on the subject.

>You'll need at least Inside Macintosh Volumes I-IV, and volume V if you 
>intend to support Macintosh SE- or II-class machines.  Also, you'll need 
>the Macintosh Technical Notes, which are available via anonymous FTP to 
>apple.com, in pub/dts/mac/tn, I believe.

>Among other things, Inside Macintosh documents NumToString, which takes an 
>INTEGER and a VAR STR255, e.g.:

Not wanting to contradict you, Paul, but NumToString takes a LongInt, not an
Integer.  (PACK 7)

>VAR
>  theErr: INTEGER;
>  tempString: STR255;
>...
>NumToString(theErr, tempString);
>...

>This will convert theErr to a string, which you can then do whatever you 
>wish with.

Obviously, what Paul recommends will work because the Pascal compiler will
extend theErr to a LongInt when it passes it to the Toolbox.

Dennis Cohen
Claris Corp.
 ****************************************************
Disclaimer:  Any opinions expressed above are _MINE_!
 ****************************************************

chewy@apple.com (Paul Snively) (03/15/90)

In article <10938@claris.com> drc@claris.com (Dennis Cohen) writes:
> >Among other things, Inside Macintosh documents NumToString, which takes 
an 
> >INTEGER and a VAR STR255, e.g.:
> 
> Not wanting to contradict you, Paul, but NumToString takes a LongInt, 
not an
> Integer.  (PACK 7)
> 
> >VAR
> >  theErr: INTEGER;
> >  tempString: STR255;
> >...
> >NumToString(theErr, tempString);
> >...
> 
> >This will convert theErr to a string, which you can then do whatever 
you 
> >wish with.
> 
> Obviously, what Paul recommends will work because the Pascal compiler 
will
> extend theErr to a LongInt when it passes it to the Toolbox.
> 
> Dennis Cohen
> Claris Corp.

Thanks to Pete Gontier and Dennis Cohen for cleaning up after me; 
NumToString does indeed take a LONGINT and still works with my example 
(which I stole right out of some of my own code) for precisely the reason 
that Dennis says; Pascal sign-extends integers for you if you pass them 
where you should be passing a LONGINT.

__________________________________________________________________________
                                Paul Snively
                      Macintosh Developer Technical Support
                             Apple Computer, Inc.

1st Choice: Paul_Snively.DTS@qm.gateway.apple.com
2nd Choice: CHEWBACCA@applelink.apple.com
Last Choice: chewy@apple.com

Just because I work for Apple Computer, Inc. doesn't mean that I believe 
what they believe, or vice-versa.
__________________________________________________________________________

franklin@uvicctr.UVic.CA.UUCP (Katherine Franklin) (03/16/90)

Thanks for all the great answers. I had heard of Inside Mac but I didn't
really think it applied to me because I was only building MPW tools. I
figured the manual for the compiler would cover that sort of stuff.
Ooops ! Learn something new !

	Katherine