[comp.sys.mac.programmer] SysEnvirons and systemVersion

stuartb@microsoft.UUCP (Stuart Burden) (05/11/89)

I have a quick question to do with the SysEnvirons function and how to
interpret the system version from it.

I can get all the information from SysEnvirons I need, except an explicit
system version number.  What I get returned is an integer.  What I need to
know, is how do I relate this to a particular version of the system.

For example, systemVersion returns 1538 when run on a release 6.0.2.  Do I
then have to manually say, well since it's 1538 it must be 6.0.2?  If so
where is there a list of previous "system numbers".

Basically, am I missing something here..?  Is there a better way to
determine what system is running, than SysEnvirons?

As an aside to this, how does one determine the finder version also?

Stu.

__Paths to my door:_______________________
microsoft!stuartb@beaver.cs.washington.edu  -   Usual disclaimer, that all
microsoft!stuartb@uw-beaver.arpa            -   the above is pure fantasy
microsoft!stuartb@uunet.UU.NET              -       and Microsoft only
[DE01HB]stuartb@DASNET#   {from AppleLink}  -    gave me the Mountain Dew
stuartb@microsoft.uucp    {well connected}  -      to dream it all in a
D2012 {@applelink.apple.com - shared acct}  -        caffeine haze :-)
__________________________________________________________________________

gandreas@umn-d-ub.D.UMN.EDU (Glenn Andreas) (05/11/89)

In article <5692@microsoft.UUCP> stuartb@microsoft.UUCP (Stuart Burden) writes:
>I can get all the information from SysEnvirons I need, except an explicit
>system version number.  What I get returned is an integer.  What I need to
>know, is how do I relate this to a particular version of the system.
>
>For example, systemVersion returns 1538 when run on a release 6.0.2.

It is simple (enough so that you're going to kick yourself for not thinking
of it).  1538 in hex is $0602.

>Basically, am I missing something here..?  Is there a better way to
>determine what system is running, than SysEnvirons?
Remember, you should be looking for features provided, not versions whenever
possible - test for availability of what you need, rather than saying "Oh,
6.0.2, so this must have what I need"


>As an aside to this, how does one determine the finder version also?
You could try to read the 'vers' resource in the finder, but this probably
wouldn't work under MF, since the finder would be running at the time.  You
could try using OpenRFPerm for this.


>Stu.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
= "Whether you like it, or don't like it, sit   | - gandreas@ub.d.umn.edu - =
=  back and take a look at it, because it's the |   Glenn Andreas           =
=  best going today!  WOOOOoooo!" - Ric Flair   |                           =
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

earleh@eleazar.dartmouth.edu (Earle R. Horton) (05/11/89)

In article <5692@microsoft.UUCP> stuartb@microsoft.UUCP (Stuart Burden) writes:
>I have a quick question to do with the SysEnvirons function and how to
>interpret the system version from it.
>
>I can get all the information from SysEnvirons I need, except an explicit
>system version number.  What I get returned is an integer.  What I need to
>know, is how do I relate this to a particular version of the system.
>
>For example, systemVersion returns 1538 when run on a release 6.0.2...

     Note that 1538 is equivalent to hex $0602.  The major release
number is in the high byte, and the minor subrelease number is in the
low byte.

>As an aside to this, how does one determine the finder version also?

     This information is in the 'vers' resource of the Finder resource
file.  You can't access it if the Finder is open, i.e. running at the
same time as your application under MultiFinder.  This is because the
Finder resource file is already open in the Finder partition.

"People forget how fast you did a job, but they remember how well you
did it."  Salada Tag Lines

jackiw@cs.swarthmore.edu (Nick Jackiw) (05/12/89)

In article <5692@microsoft.UUCP> stuartb@microsoft.UUCP (Stuart Burden) writes:
> I have a quick question to do with the SysEnvirons function and how to
> interpret the system version from it.
> 
> For example, systemVersion returns 1538 when run on a release 6.0.2.  Do I
> then have to manually say, well since it's 1538 it must be 6.0.2?  If so
> where is there a list of previous "system numbers".
> 

1538 in hexadecimal is ... $0602!  So, if your compiler won't let you
check whether theRec.systemVersion >= $0600 (i. e. running System 6
or later), you can explicitly break it up into

	System Major Release = sysVers div 256;
	       Minor Release = sysVers mod 256.

> As an aside to this, how does one determine the finder version also?

Ouch. Well, you could use SysEnvirons to find the System Folder, and then
look for "Finder" in there, open it up, and checks it 'vers' resources.
There's no guarantee that future or ancient finders will maintain a vers
resource at all, or even that User definitely has a finder (instead of some
f-substitute), etc., so you should prepare a default action.  Out of
curiosity why do you need to know the version?  Possibly there's information
outside the SysEnvRec your application will depend on?  In the words of
Apple, "Impossible! No such thing!" (1/2 :-))

-Nick.

> Stu.
> __Paths to my door:_______________________
> microsoft!stuartb@beaver.cs.washington.edu  -   Usual disclaimer, that all
> microsoft!stuartb@uw-beaver.arpa            -   the above is pure fantasy
> microsoft!stuartb@uunet.UU.NET              -       and Microsoft only
> [DE01HB]stuartb@DASNET#   {from AppleLink}  -    gave me the Mountain Dew
> stuartb@microsoft.uucp    {well connected}  -      to dream it all in a
> D2012 {@applelink.apple.com - shared acct}  -        caffeine haze :-)
> __________________________________________________________________________


-- 
     _  _|\____    Nick Jackiw | Visual Geometry Project | Math Department
   / /_/   O>  \   ------------+-------------------------+ Swarthmore College
   |       O>   |  215-328-8225| jackiw@cs.swarthmore.edu| Swarthmore PA 19081
    \_Guernica_/   ------------+-------------------------+                 USA

MAC.ROMOS@applelink.apple.com (Ian Hendry) (05/13/89)

In article <13443@dartvax.Dartmouth.EDU> earleh@eleazar.dartmouth.edu 
(Earle R. Horton) writes:
> >For example, systemVersion returns 1538 when run on a release 6.0.2...
> 
>      Note that 1538 is equivalent to hex $0602.  The major release
> number is in the high byte, and the minor subrelease number is in the
> low byte.


Not quite.  As I understand the major is the high byte, the minor the high 
nibble of the low byte and the revision number is the low nibble of the
low byte.  That is, $0614 is the version "6.1.4", NOT "6.20" ($14 == 20).

Have fun,

Ian Hendry
MAC.ROMOS@applelink.apple.com
Make sure my name is in the subject of any Email, or post replies to 
network.
TE: 408-974-4737

Disclaimer:  It was all HIS idea anyway!  Nothing I say reflects anything 
my employer means... or anything I mean for that matter.

ksitze@nmsu.edu (Kevin Sitze) (05/13/89)

In article: <stuartb@microsoft.UUCP's message of 11 May 89 13:39:02
GMT> Stuart writes:
>I have a quick question to do with the SysEnvirons function and how to
>interpret the system version from it.
>
>I can get all the information from SysEnvirons I need, except an explicit
>system version number.  What I get returned is an integer.  What I need to
>know, is how do I relate this to a particular version of the system.
>
>For example, systemVersion returns 1538 when run on a release 6.0.2.  Do I
>then have to manually say, well since it's 1538 it must be 6.0.2?  If so
>where is there a list of previous "system numbers".
>
>Basically, am I missing something here..?  Is there a better way to
>determine what system is running, than SysEnvirons?

Your missing something.  SysEnvirons (as IM-V says) returns the system
number.  The system number though is encoded in BCD format (as IM-V
says) so system 6.0.2 is returned as 1538 or $0602 (hex number 0602).

					-Kelesi
--
------------------------------------+-------------------------------
From the Macintosh of: Kevin Sitze  | Disclamer: Who the heck needs
                                    |   a disclamer?  After all, Dan
EMail: ksitze%NMSU.edu              |   Quayle doesn't.
SMail: 601 S. Melendres             +-------------------------------
       Las Cruces, NM  88005        | "We have the answers, the
------------------------------------+  trouble lies in finding the
"The difference between intelligence|  questions..."
and stupidity is that intelligence  | "The information is there,
has a limit."           - anonymous |  finding it is another story."
The dolt confuses you -- more --    |	   	    - Any consultant
------------------------------------+-------------------------------