home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / mac / programm / 19784 < prev    next >
Encoding:
Text File  |  1992-12-14  |  3.6 KB  |  94 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. 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
  3. From: Michael Hecht <Michael_Hecht@mac.sas.com>
  4. Subject: Re: Machine Icons
  5. Sender: news@unx.sas.com (Noter of Newsworthy Events)
  6. Message-ID: <Bz9A1w.4AH@unx.sas.com>
  7. X-Useragent: Nuntius v1.1.1d15
  8. Date: Mon, 14 Dec 1992 15:37:07 GMT
  9. X-Xxdate: Mon, 14 Dec 92 15:36:52 GMT
  10. X-Xxmessage-Id: <A75214446C02050A@studly.mac.sas.com>
  11. References: <168BAA257.GREMICF@YaleVM.YCC.Yale.Edu>
  12. Nntp-Posting-Host: studly.mac.sas.com
  13. Organization: SAS Institute Inc.
  14. Lines: 78
  15.  
  16. In article <168BAA257.GREMICF@YaleVM.YCC.Yale.Edu> M. David Greenspon,
  17. GREMICF@YaleVM.YCC.Yale.Edu writes:
  18. >I'm doing this because I'd like to determine various things about the 
  19. >system I'm on:  for example, if I get an icon that looks like a Quadra, 
  20. >I'll assume the presence of an FPU.
  21.  
  22. Hah! Good one. Had me going there for a few seconds. :-)
  23.  
  24. Well, a little tracing with MacsBug reveals the following table that maps
  25. machine type to icon (for System 7.0.1*, anyway):
  26.  
  27. Machine Type                    Machine Icon
  28. ============                    ============
  29. unknown (0)                     3
  30. gestaltClassic (1)              -16482
  31. gestaltMacXL (2)                3
  32. gestaltMac512KE (3)             -16482
  33. gestaltMacPlus (4)              -16482
  34. gestaltMacSE (5)                -16483
  35. gestaltMacII (6)                -16486
  36. gestaltMacIIx (7)               -16486
  37. gestaltMacIIcx (8)              -16485
  38. gestaltMacSE030 (9)             -16483
  39. gestaltPortable (10)            -16484
  40. gestaltMacIIci (11)             -16485
  41. (12)                            3
  42. gestaltMacIIfx (13)             -16486
  43. (14)                            3
  44. (15)                            3
  45. (16)                            3
  46. gestaltMacClassic (17)          -16482
  47. gestaltMacIIsi (18)             -16502
  48. gestaltMacLC (19)               -16503
  49. (20)                            -16504
  50. (21)                            -16505
  51. (22)                            -16507
  52. (23)                            -16482
  53. (24)                            -16508
  54. (25)                            -16505
  55. (26)                            -16504
  56. (27)                            -16482
  57.  
  58. [Sorry, I don't have the machine names of the types above 19 handy at the
  59. moment.]
  60.  
  61. Of course, using this table as such has loads of problems:
  62.  
  63. * Apple could change the icon numbers on you.
  64.  
  65. * When new machine types are added, you'll never know about them.
  66.  
  67. To solve these problems, I suggest you take advantage of the fact that
  68. the machineIcon Gestalt selector calls the machineType gestalt selector
  69. to get the index into the above table. Use ReplaceGestalt to temporarily
  70. substitute the 'mach' selector with your own routine that will hand back
  71. whatever selector you want. Then, call Gestalt for the 'micn' repeatedly,
  72. and have your 'mach' function substitute a different machineType for each
  73. call.
  74.  
  75. You'll have to write your replacement Gestalt selector as a stand-alone
  76. code segment that loads into the System Heap. ReplaceGestalt complains,
  77. otherwise. You can store the fake machine selector somewhere near the
  78. beginning of it from your app, and just have the routine return it.
  79.  
  80. How do you know how many times to call? Fetch the kMachineNameStrID
  81. string list resource and see how many strings are in it!
  82.  
  83. Don't forget to replace the original 'mach' routine when you're done.
  84.  
  85. Good luck!
  86. --Michael
  87.  
  88. PS: What are you writing?
  89.  
  90.  
  91. =======================================================================
  92. Michael P. Hecht                 | Internet:  Michael_Hecht@mac.sas.com
  93. SAS Institute Inc.; Cary, NC USA | AppleLink: SAS.HECHT
  94.