home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / BSP Tree 1.2 / Sources / Core / source / minimum system.cp < prev    next >
Encoding:
Text File  |  1995-04-24  |  4.0 KB  |  66 lines  |  [TEXT/MMCC]

  1. //------------------------------------------------------------------------------
  2. //    File:                    minimum system.cp
  3. //    Date:                    10/21/94
  4. //    Author:                Bretton Wade
  5. //
  6. //    Description:    this file contains the minimum system requirements
  7. //
  8. //------------------------------------------------------------------------------
  9.  
  10. #include    "minimum system.h"
  11.  
  12. //------------------------------------------------------------------------------
  13. //    Handle failure if minimum system is not present
  14. //------------------------------------------------------------------------------
  15. static    void    MinimumSystemError (short errString)                                                            //    handle minimum system requirements failure
  16. {                                                                                                                                                                //    begin
  17.     Str255    str;                                                                                                                                    //    place to get the error string
  18.     GetIndString (str, 256, errString);                                                                                        //    get the error string
  19.     ParamText (str, 0, 0, 0);                                                                                                            //    set the error string parameter
  20.     Alert (257, 0);                                                                                                                                //    give the alert about the error
  21.     ResetAlrtStage ();                                                                                                                        //    no more beeps
  22.     ExitToShell ();                                                                                                                                //    quit immediately
  23. }                                                                                                                                                                //    end
  24.  
  25. //------------------------------------------------------------------------------
  26. //    Ensure required features
  27. //------------------------------------------------------------------------------
  28. void    MinimumSystem (void)                                                                                                            //    check for minimum system requirements
  29. {                                                                                                                                                                //    begin
  30.     short    **requirements = (short **) GetResource ('reqd', 128);                                    //    get the requirements resource
  31.     long    result;                                                                                                                                    //    the result for gestalt services
  32.     if ((*requirements)[0])                                                                                                                //    if the application requires system 7
  33.     {                                                                                                                                                            //    begin
  34.         Gestalt (gestaltSystemVersion, &result);                                                                        //    get the system version
  35.         if (result < 0x0700)                                                                                                                //    require 7.0 or greater
  36.             MinimumSystemError (1);                                                                                                        //    fail with OS less than v7
  37.     }                                                                                                                                                            //    end
  38.     if ((*requirements)[1])                                                                                                                //    if the application requires the thread manager
  39.     {                                                                                                                                                            //    begin
  40.         if (Gestalt (gestaltThreadMgrAttr, &result))                                                                //    get the thread manager selector
  41.             MinimumSystemError (2);                                                                                                        //    fail with thread manager not present
  42.     }                                                                                                                                                            //    end
  43.     if ((*requirements)[2])                                                                                                                //    if the application requires quicktime
  44.     {                                                                                                                                                            //    begin
  45.         if (Gestalt (gestaltQuickTime, &result))                                                                        //    get the quicktime selector
  46.             MinimumSystemError (3);                                                                                                        //    fail with Quicktime not present
  47.     }                                                                                                                                                            //    end
  48. #ifndef    powerc
  49.     if ((*requirements)[3])                                                                                                                //    if the application requires a 68020 or greater
  50.     {                                                                                                                                                            //    begin
  51.         Gestalt (gestaltProcessorType, &result);                                                                        //    get the Processor Type
  52.         if (result < gestalt68020)                                                                                                    //    require that the system have a 68020 or greater
  53.             MinimumSystemError (4);                                                                                                        //    fail with 68020 or > not present
  54.     }                                                                                                                                                            //    end
  55.     if ((*requirements)[4])                                                                                                                //    if the application requires an FPU
  56.     {                                                                                                                                                            //    begin
  57.         Gestalt (gestaltFPUType, &result);                                                                                    //    get the FPU Type
  58.         if (result == gestaltNoFPU)                                                                                                    //    require that the system have an FPU
  59.             MinimumSystemError (5);                                                                                                        //    fail with FPU not present
  60.     }                                                                                                                                                            //    end
  61. #endif
  62.     ReleaseResource (Handle (requirements));                                                                            //    let go of the requirements data
  63. }                                                                                                                                                                //    end
  64.  
  65. //------------------------------------------------------------------------------
  66.