Retired Document
Important: This sample code may not represent best practices for current development. The project may use deprecated symbols and illustrate technologies and techniques that are no longer recommended.
CodeWarrior (OS 9)/CPUGestalt.c
/* |
File: CPUGestalt.c |
Contains: This sample code illustrates the way to determine the |
processor type of the Macintosh you're running on |
Written by: |
Copyright: Copyright © 1999 by Apple Computer, Inc., All Rights Reserved. |
You may incorporate this Apple sample source code into your program(s) without |
restriction. This Apple sample source code has been provided "AS IS" and the |
responsibility for its operation is yours. You are not permitted to redistribute |
this Apple sample source code as "Apple sample source code" after having made |
changes. If you're going to re-distribute the source, we require that you make |
it clear in the source that the code was descended from Apple sample source |
code, but that you've made changes. |
Change History (most recent first): |
7/23/1999 Karl Groethe Updated for Metrowerks Codewarror Pro 2.1 and |
Added PowerPC 750 processor |
*/ |
#include <Gestalt.h> |
#include <stdio.h> |
void main() |
{ |
OSErr err; |
long getCPUtype; |
// check to see if we're on a Power Macintosh |
err = Gestalt (gestaltNativeCPUtype, &getCPUtype); |
if (0x100 & getCPUtype) { |
// we are on a Power Macintosh |
if (getCPUtype == gestaltCPU601) |
printf( "\nThis is a Power Macintosh with a 601 processor." ); |
else if (getCPUtype == gestaltCPU603) |
printf( "\nThis is a Power Macintosh with a 603 processor." ); |
else if (getCPUtype == gestaltCPU604) |
printf( "\nThis is a Power Macintosh with a 604 processor." ); |
else if (getCPUtype==gestaltCPU750) |
printf( "\nThis is a Power Macintosh with a 750(G3) processor." ); |
else |
printf( "\nThis is a Power Macintosh with a processor that I am unaware of." ); |
} else { |
// we are on a 68K Macintosh |
err = Gestalt ( gestaltProcessorType, &getCPUtype ); |
if (getCPUtype == gestalt68040) |
printf( "\nThis is a 68K Macintosh with a 68040 processor." ); |
else if (getCPUtype == gestalt68030) |
printf( "\nThis is a 68K Macintosh with a 68030 processor." ); |
else if (getCPUtype == gestalt68020) |
printf( "\nThis is a 68K Macintosh with a 68020 processor." ); |
else if (getCPUtype == gestalt68010) |
printf( "\nThis is a 68K Macintosh with a 68010 processor." ); |
else if (getCPUtype == gestalt68000) |
printf( "\nThis is a 68K Macintosh with a 68000 processor." ); |
else |
printf( "\nThis is a 68K Macintosh with a processor that I am unaware of." ); |
} |
} |
Copyright © 2003 Apple Computer, Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2003-10-27