home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!agate!stanford.edu!rock!concert!sas!mozart.unx.sas.com!studly.mac.sas.com!Michael_Hecht
- From: Michael Hecht <Michael_Hecht@mac.sas.com>
- Subject: Re: Machine Icons
- Sender: news@unx.sas.com (Noter of Newsworthy Events)
- Message-ID: <Bz9A1w.4AH@unx.sas.com>
- X-Useragent: Nuntius v1.1.1d15
- Date: Mon, 14 Dec 1992 15:37:07 GMT
- X-Xxdate: Mon, 14 Dec 92 15:36:52 GMT
- X-Xxmessage-Id: <A75214446C02050A@studly.mac.sas.com>
- References: <168BAA257.GREMICF@YaleVM.YCC.Yale.Edu>
- Nntp-Posting-Host: studly.mac.sas.com
- Organization: SAS Institute Inc.
- Lines: 78
-
- In article <168BAA257.GREMICF@YaleVM.YCC.Yale.Edu> M. David Greenspon,
- GREMICF@YaleVM.YCC.Yale.Edu writes:
- >I'm doing this because I'd like to determine various things about the
- >system I'm on: for example, if I get an icon that looks like a Quadra,
- >I'll assume the presence of an FPU.
-
- Hah! Good one. Had me going there for a few seconds. :-)
-
- Well, a little tracing with MacsBug reveals the following table that maps
- machine type to icon (for System 7.0.1*, anyway):
-
- Machine Type Machine Icon
- ============ ============
- unknown (0) 3
- gestaltClassic (1) -16482
- gestaltMacXL (2) 3
- gestaltMac512KE (3) -16482
- gestaltMacPlus (4) -16482
- gestaltMacSE (5) -16483
- gestaltMacII (6) -16486
- gestaltMacIIx (7) -16486
- gestaltMacIIcx (8) -16485
- gestaltMacSE030 (9) -16483
- gestaltPortable (10) -16484
- gestaltMacIIci (11) -16485
- (12) 3
- gestaltMacIIfx (13) -16486
- (14) 3
- (15) 3
- (16) 3
- gestaltMacClassic (17) -16482
- gestaltMacIIsi (18) -16502
- gestaltMacLC (19) -16503
- (20) -16504
- (21) -16505
- (22) -16507
- (23) -16482
- (24) -16508
- (25) -16505
- (26) -16504
- (27) -16482
-
- [Sorry, I don't have the machine names of the types above 19 handy at the
- moment.]
-
- Of course, using this table as such has loads of problems:
-
- * Apple could change the icon numbers on you.
-
- * When new machine types are added, you'll never know about them.
-
- To solve these problems, I suggest you take advantage of the fact that
- the machineIcon Gestalt selector calls the machineType gestalt selector
- to get the index into the above table. Use ReplaceGestalt to temporarily
- substitute the 'mach' selector with your own routine that will hand back
- whatever selector you want. Then, call Gestalt for the 'micn' repeatedly,
- and have your 'mach' function substitute a different machineType for each
- call.
-
- You'll have to write your replacement Gestalt selector as a stand-alone
- code segment that loads into the System Heap. ReplaceGestalt complains,
- otherwise. You can store the fake machine selector somewhere near the
- beginning of it from your app, and just have the routine return it.
-
- How do you know how many times to call? Fetch the kMachineNameStrID
- string list resource and see how many strings are in it!
-
- Don't forget to replace the original 'mach' routine when you're done.
-
- Good luck!
- --Michael
-
- PS: What are you writing?
-
-
- =======================================================================
- Michael P. Hecht | Internet: Michael_Hecht@mac.sas.com
- SAS Institute Inc.; Cary, NC USA | AppleLink: SAS.HECHT
-