Package Name: processes

Return to: Package List


with Interfaces.C; use Interfaces.C;
with Types; use Types;
with Events; use Events;
with Files; use Files;

package Processes is
   --  
   --  File:       Processes.h
   --  
   --  Contains:   Process Manager Interfaces.
   --  
   --  Version:    Technology: System 7.5
   --              Package:    Universal Interfaces 2.0 in ÒMPW LatestÓ on ETO #17
   --  
   --  Copyright:  © 1984-1995 by Apple Computer, Inc.
   --              All rights reserved.

   --  
   type ProcessSerialNumber is 
      record
         highLongOfPSN : unsigned_long;
         lowLongOfPSN : unsigned_long;
      end record;

   type ProcessSerialNumberPtr is Access ProcessSerialNumber;
   --  Process identifier - Various reserved process serial numbers
   kNoProcess      :constant integer:= 0;
   kSystemProcess  :constant integer:= 1;

   kCurrentProcess :constant integer:= 2;
   --  Definition of the parameter block passed to _Launch

   subtype LaunchFlags is unsigned_short;
    --  Definition of the parameter block passed to _Launch
   launchContinue    :Constant Integer:= 16#4000#;
   launchNoFileFlags :Constant Integer:= 16#0800#;
   launchUseMinimum  :Constant Integer:= 16#0400#;
   launchDontSwitch  :Constant Integer:= 16#0200#;
   launchAllow24Bit  :Constant Integer:= 16#0100#;

   launchInhibitDaemon :Constant Integer:= 16#0080#;
   --   Format for first AppleEvent to pass to new process.
   type AppParameters is 
      record
         theMsgEvent : EventRecord;
         eventRefCon : unsigned_long;
         messageLength : unsigned_long;
      end record;

   type AppParametersPtr is Access AppParameters;
   --  Parameter block to _Launch
   type LaunchParamBlockRec is 
      record
         reserved1 : unsigned_long;
         reserved2 : unsigned_short;
         launchBlockID : unsigned_short;
         launchEPBLength : unsigned_long;
         launchFileFlags : unsigned_short;
         launchControlFlags : LaunchFlags;
         launchAppSpec : FSSpecPtr;
         launchProcessSN : ProcessSerialNumber;
         launchPreferredSize : unsigned_long;
         launchMinimumSize : unsigned_long;
         launchAvailableSize : unsigned_long;
         launchAppParameters : AppParametersPtr;
      end record;

   type LaunchPBPtr is Access LaunchParamBlockRec;
   --  * Set launchBlockID to extendedBlock to specify that extensions exist.
  extendedBlock       : Constant Integer:= 16#4C43#;  -- 'LC' 

  extendedBlockLen      : Constant Integer:= 32;  -- sizeof(LaunchParamBlockRec) - 12 }
  -- Definition of the information block returned by GetProcessInformation
  modeDeskAccessory     : Constant Integer:= 16#00020000#;
  modeMultiLaunch       : Constant Integer:= 16#00010000#;
  modeNeedSuspendResume : Constant Integer:= 16#00004000#;
  modeCanBackground     : Constant Integer:= 16#00001000#;
  modeDoesActivateOnFGSwitch  : Constant Integer:= 16#00000800#;
  modeOnlyBackground    : Constant Integer:= 16#00000400#;
  modeGetFrontClicks    : Constant Integer:= 16#00000200#;
  modeGetAppDiedMsg     : Constant Integer:= 16#00000100#;
  mode32BitCompatible   : Constant Integer:= 16#00000080#;
  modeHighLevelEventAware    : Constant Integer:= 16#00000040#;
  modeLocalAndRemoteHLEvents : Constant Integer:= 16#00000020#;
  modeStationeryAware     : Constant Integer:= 16#00000010#;
  modeUseTextEditServices : Constant Integer:= 16#00000008#;

  modeDisplayManagerAware : Constant Integer:= 16#00000004#;
   --  Record returned by GetProcessInformation
   type ProcessInfoRec is 
      record
         processInfoLength : unsigned_long;
         processName : StringPtr;
         processNumber : ProcessSerialNumber;
         processType : unsigned_long;
         processSignature : OSType;
         processMode : unsigned_long;
         processLocation : Ptr;
         processSize : unsigned_long;
         processFreeMem : unsigned_long;
         processLauncher : ProcessSerialNumber;
         processLaunchDate : unsigned_long;
         processActiveTime : unsigned_long;
         processAppSpec : FSSpecPtr;
      end record;

   type ProcessInfoRecPtr is Access ProcessInfoRec;
   function LaunchApplication
     (LaunchParams       : in     LaunchPBPtr)
      return                      OSErr;

   pragma Import (C, LaunchApplication, "LaunchApplication", "LaunchApplication");
   function LaunchDeskAccessory
     (pFileSpec          : access FSSpec;
      pDAName            : access Str255)
      return                      OSErr;

   pragma Import (C, LaunchDeskAccessory, "LaunchDeskAccessory", "LaunchDeskAccessory");
   function GetCurrentProcess
     (PSN                : access ProcessSerialNumber)
      return                      OSErr;

   pragma Import (C, GetCurrentProcess, "GetCurrentProcess", "GetCurrentProcess");
   function GetFrontProcess
     (PSN                : access ProcessSerialNumber)
      return                      OSErr;

   pragma Import (C, GetFrontProcess, "GetFrontProcess", "GetFrontProcess");
   function GetNextProcess
     (PSN                : access ProcessSerialNumber)
      return                      OSErr;

   pragma Import (C, GetNextProcess, "GetNextProcess", "GetNextProcess");
   function GetProcessInformation
     (PSN                : access ProcessSerialNumber;
      info               : access ProcessInfoRec)
      return                      OSErr;

   pragma Import (C, GetProcessInformation, "GetProcessInformation", "GetProcessInformation");
   function SetFrontProcess
     (PSN                : access ProcessSerialNumber)
      return                      OSErr;

   pragma Import (C, SetFrontProcess, "SetFrontProcess", "SetFrontProcess");
   function WakeUpProcess
     (PSN                : access ProcessSerialNumber)
      return                      OSErr;

   pragma Import (C, WakeUpProcess, "WakeUpProcess", "WakeUpProcess");
   function SameProcess
     (PSN1               : access ProcessSerialNumber;
      PSN2               : access ProcessSerialNumber;
      result             : access Boolean)
      return                      OSErr;

   pragma Import (C, SameProcess, "SameProcess", "SameProcess");
end Processes;