home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Peter Lewis / PNL Libraries / MySystemGlobals.p < prev    next >
Encoding:
Text File  |  1994-09-19  |  1.6 KB  |  59 lines  |  [TEXT/PJMM]

  1. unit MySystemGlobals;
  2.  
  3. interface
  4.  
  5. {$IFC undefined THINK_Pascal}
  6.     uses
  7.         Files;
  8. {$ENDC}
  9.  
  10.     var  { set up by InitSystemGlobals }
  11.         system7: boolean;
  12.         system_version: longInt;
  13.         has_appleEvents: boolean;
  14.         has_findfolder: boolean;
  15.         has_aliasMgr: boolean;
  16.         has_newStdFile: boolean;
  17.         has_HelpMgr: boolean;
  18.         has_colorQD: boolean;
  19.         app_resfile: integer;
  20.         app_fs: FSSpec;
  21.  
  22.     procedure InitSystemGlobals;
  23.  
  24. implementation
  25.  
  26. {$IFC undefined THINK_Pascal}
  27.     uses
  28.         Resources, GestaltEqu;
  29. {$ENDC}
  30.  
  31. {$S Init}
  32.     procedure InitSystemGlobals;
  33.         var
  34.             oe: OSErr;
  35.             gv: longInt;
  36.             pb: FCBPBRec;
  37.             sysenv: sysEnvRec;
  38.     begin
  39.         app_resfile := CurResFile;
  40.         pb.ioNamePtr := @app_fs.name;
  41.         pb.ioVRefNum := 0;
  42.         pb.ioRefNum := app_resfile;
  43.         pb.ioFCBIndx := 0;
  44.         oe := PBGetFCBInfo(@pb, false);
  45.         app_fs.vRefNum := pb.ioFCBVRefNum;
  46.         app_fs.parID := pb.ioFCBParID;
  47.         has_colorqd := (SysEnvirons(1, sysEnv) = noErr) & sysenv.hasColorQD; { Gestalt has a bug that causes hasColourQD to always be set }
  48.         if (Gestalt(gestaltSystemVersion, system_version) <> noErr) then begin
  49.             system_version := $0600;
  50.         end;
  51.         system7 := system_version >= $0700;
  52.         has_AppleEvents := (Gestalt(gestaltAppleEventsAttr, gv) = noErr) & (BTST(gv, gestaltAppleEventsPresent));
  53.         has_findfolder := (Gestalt(gestaltFindFolderAttr, gv) = noErr) & (BTST(gv, gestaltFindFolderPresent));
  54.         has_newStdFile := (Gestalt(gestaltStandardFileAttr, gv) = noErr) & (BTST(gv, gestaltStandardFile58));
  55.         has_HelpMgr := (Gestalt(gestaltHelpMgrAttr, gv) = noErr) & (BTST(gv, gestaltHelpMgrPresent));
  56.         has_aliasMgr := (Gestalt(gestaltAliasMgrAttr, gv) = noErr) & (BTST(gv, gestaltAliasMgrPresent));
  57.     end;
  58.  
  59. end.