Package Name: osutils

Return to: Package List


with Interfaces.C; use Interfaces.C;
with Types; use Types;

package OSUtils is
   --  
   --  File:       OSUtils.h
   --  
   --  Contains:   OS Utilities Interfaces.
   --  
   --  Version:    Technology: System 7.5
   --              Package:	Universal Interfaces 2.1 in ÒMPW LatestÓ on ETO #18
   --  
   --  Copyright:  © 1984-1995 by Apple Computer, Inc.
   --              All rights reserved.

   --  

   subtype LongDateField is SignedByte;

   subtype QTypes is SignedByte;

   subtype TrapType is SignedByte;
   type SysParmType is 
      record
         valid : UInt8;
         aTalkA : UInt8;
         aTalkB : UInt8;
         config : UInt8;
         portA : Short_Integer;
         portB : Short_Integer;
         alarm : Long_Integer;
         font : Short_Integer;
         kbdPrint : Short_Integer;
         volClik : Short_Integer;
         misc : Short_Integer;
      end record;

   type SysPPtr is Access SysParmType;
   type QElem;
   type QElemPtr is Access QElem;
   type Short_Integer_Vec_1 is array (0 .. 0) of Short_Integer;
   type QElem is 
      record
         qLink : QElemPtr;
         qType : Short_Integer;
         qData : Short_Integer_Vec_1;
      end record;

   type QElem_Ptr is Access QElem;
   type QHdr is 
      record
         qFlags : Short_Integer;
         qHead : QElemPtr;
         qTail : QElemPtr;
      end record;

   type QHdrPtr is Access QHdr;

   subtype DeferredTaskUPP is UniversalProcPtr;
   type DeferredTask is 
      record
         qLink : QElemPtr;
         qType : Short_Integer;
         dtFlags : Short_Integer;
         dtAddr : DeferredTaskUPP;
         dtParam : Long_Integer;
         dtReserved : Long_Integer;
      end record;

   type DeferredTaskPtr is Access DeferredTask;
   type SysEnvRec is 
      record
         environsVersion : Short_Integer;
         machineType : Short_Integer;
         systemVersion : Short_Integer;
         processor : Short_Integer;
         hasFPU : Boolean;
         hasColorQD : Boolean;
         keyBoardType : Short_Integer;
         atDrvrVersNum : Short_Integer;
         sysVRefNum : Short_Integer;

      end record;
   type Union_1 is array (0 .. 3) of char;

   subtype Union_1_dlsDelta is SInt8;             --  signed byte; daylight savings delt

   subtype Union_1_gmtDelta is Long_Integer;      --  must mask - see documentatio
   type MachineLocation is 
      record
         latitude : Fract;
         longitude : Fract;
         u : Union_1;

      end record;
   type DateTimeRec is 
      record
         year : Short_Integer;
         month : Short_Integer;
         day : Short_Integer;
         hour : Short_Integer;
         minute : Short_Integer;
         second : Short_Integer;
         dayOfWeek : Short_Integer;

      end record;

   subtype LongDateTime is wide;
   type LongDateCvt is array (0 .. 7) of char;
   subtype LongDateCvt_c is wide;
   type anon_struct_1 is 
      record
         lHigh : UInt32;
         lLow : UInt32;
      end record;

   subtype LongDateCvt_hl is anon_struct_1;
   type LongDateRec is array (0 .. 27) of char;
   type anon_struct_2 is 
      record
         era : Short_Integer;
         year : Short_Integer;
         month : Short_Integer;
         day : Short_Integer;
         hour : Short_Integer;
         minute : Short_Integer;
         second : Short_Integer;
         dayOfWeek : Short_Integer;
         dayOfYear : Short_Integer;
         weekOfYear : Short_Integer;
         pm : Short_Integer;
         res1 : Short_Integer;
         res2 : Short_Integer;
         res3 : Short_Integer;
      end record;
   subtype LongDateRec_ld is anon_struct_2;
   type Short_Integer_Vec_14 is array (0 .. 13) of Short_Integer;

   subtype LongDateRec_list is Short_Integer_Vec_14;
   type anon_struct_3 is 
      record
         eraAlt : Short_Integer;
         oldDate : DateTimeRec;
      end record;

   subtype LongDateRec_od is anon_struct_3;

   subtype DateDelta is SInt8;
   type Long_Integer_Vec_4 is array (0 .. 3) of Long_Integer;
   type TogglePB is 
      record
         togFlags : Long_Integer;                 --  caller normally sets low word to dateStdMask=$7F
         amChars : ResType;                       --  from 'itl0', but uppercased
         pmChars : ResType;                       --  from 'itl0', but uppercased
         reserved : Long_Integer_Vec_4;

      end record;

   subtype ToggleResults is Short_Integer;
   procedure LongDateToSeconds
     (lDate              : access LongDateRec;
      lSecs              : access LongDateTime);

   pragma Import (C, LongDateToSeconds, "LongDateToSeconds", "LongDateToSeconds");
   procedure LongSecondsToDate
     (lSecs              : access LongDateTime;
      lDate              : access LongDateRec);

   pragma Import (C, LongSecondsToDate, "LongSecondsToDate", "LongSecondsToDate");
   function ToggleDate
     (lSecs              : access LongDateTime;
      field              : in     LongDateField;
      delta_Id           : in     DateDelta;
      ch                 : in     Short_Integer;
      params             : access TogglePB)
      return                      ToggleResults;

   pragma Import (C, ToggleDate, "ToggleDate", "ToggleDate");
   function ValidDate
     (vDate              : access LongDateRec;
      flags              : in     Long_Integer;
      newSecs            : access LongDateTime)
      return                      Short_Integer;

   pragma Import (C, ValidDate, "ValidDate", "ValidDate");
   function IsMetric
      return                      Boolean;

   pragma Import (C, IsMetric, "IsMetric", "IsMetric");
   function GetSysPPtr
      return                      SysPPtr;

   pragma Import (C, GetSysPPtr, "GetSysPPtr", "GetSysPPtr");
   function ReadDateTime
     (time               : access unsigned_long)
      return                      OSErr;

   pragma Import (C, ReadDateTime, "ReadDateTime", "ReadDateTime");
   procedure GetDateTime
     (secs               : access unsigned_long);

   pragma Import (C, GetDateTime, "GetDateTime", "GetDateTime");
   function SetDateTime
     (time               : in     unsigned_long)
      return                      OSErr;

   pragma Import (C, SetDateTime, "SetDateTime", "SetDateTime");
   procedure SetTime
     (d                  : access DateTimeRec);

   pragma Import (C, SetTime, "SetTime", "SetTime");
   procedure GetTime
     (d                  : access DateTimeRec);

   pragma Import (C, GetTime, "GetTime", "GetTime");
   procedure DateToSeconds
     (d                  : access DateTimeRec;
      secs               : access unsigned_long);

   pragma Import (C, DateToSeconds, "DateToSeconds", "DateToSeconds");
   procedure SecondsToDate
     (secs               : in     unsigned_long;
      d                  : access DateTimeRec);

   pragma Import (C, SecondsToDate, "SecondsToDate", "SecondsToDate");
   procedure SysBeep
     (duration           : in     Short_Integer);

   pragma Import (C, SysBeep, "SysBeep", "SysBeep");
   function DTInstall
     (dtTaskPtr          : in     DeferredTaskPtr)
      return                      OSErr;

   pragma Import (C, DTInstall, "DTInstall", "DTInstall");
   function SysEnvirons
     (versionRequested   : in     Short_Integer;
      theWorld           : access SysEnvRec)
      return                      OSErr;

   pragma Import (C, SysEnvirons, "SysEnvirons", "SysEnvirons");
   procedure Delay_Id
     (numTicks           : in     Long_Integer;
      finalTicks         : access Long_Integer);

   pragma Import (C, Delay_Id, "Delay", "Delay");
   function NGetTrapAddress
     (trapNum            : in     Short_Integer;
      tTyp               : in     TrapType)
      return                      UniversalProcPtr;

   pragma Import (C, NGetTrapAddress, "NGetTrapAddress", "NGetTrapAddress");
   procedure NSetTrapAddress
     (trapAddr           : in     UniversalProcPtr;
      trapNum            : in     Short_Integer;
      tTyp               : in     TrapType);

   pragma Import (C, NSetTrapAddress, "NSetTrapAddress", "NSetTrapAddress");
   function GetOSTrapAddress
     (trapNum            : in     Short_Integer)
      return                      UniversalProcPtr;

   pragma Import (C, GetOSTrapAddress, "GetOSTrapAddress", "GetOSTrapAddress");
   procedure SetOSTrapAddress
     (trapAddr           : in     UniversalProcPtr;
      trapNum            : in     Short_Integer);

   pragma Import (C, SetOSTrapAddress, "SetOSTrapAddress", "SetOSTrapAddress");
   function GetToolTrapAddress
     (trapNum            : in     Short_Integer)
      return                      UniversalProcPtr;

   pragma Import (C, GetToolTrapAddress, "GetToolTrapAddress", "GetToolTrapAddress");
   procedure SetToolTrapAddress
     (trapAddr           : in     UniversalProcPtr;
      trapNum            : in     Short_Integer);

   pragma Import (C, SetToolTrapAddress, "SetToolTrapAddress", "SetToolTrapAddress");
   function GetToolboxTrapAddress
     (trapNum            : in     Short_Integer)
      return                      UniversalProcPtr;

   pragma Import (C, GetToolboxTrapAddress, "GetToolboxTrapAddress", "GetToolboxTrapAddress");
   procedure SetToolboxTrapAddress
     (trapAddr           : in     UniversalProcPtr;
      trapNum            : in     Short_Integer);

   pragma Import (C, SetToolboxTrapAddress, "SetToolboxTrapAddress", "SetToolboxTrapAddress");
   function WriteParam
      return                      OSErr;

   pragma Import (C, WriteParam, "WriteParam", "WriteParam");
   procedure Enqueue
     (qElement           : in     QElemPtr;
      qHeader            : in     QHdrPtr);

   pragma Import (C, Enqueue, "Enqueue", "Enqueue");
   function Dequeue
     (qElement           : in     QElemPtr;
      qHeader            : in     QHdrPtr)
      return                      OSErr;

   pragma Import (C, Dequeue, "Dequeue", "Dequeue");
   function SetCurrentA5
      return                      Long_Integer;

   pragma Import (C, SetCurrentA5, "SetCurrentA5", "SetCurrentA5");
   function SetA5
     (newA5              : in     Long_Integer)
      return                      Long_Integer;

   pragma Import (C, SetA5, "SetA5", "SetA5");
   function InitUtil
      return                      OSErr;

   pragma Import (C, InitUtil, "InitUtil", "InitUtil");
   procedure ReadLocation
     (loc                : access MachineLocation);

   pragma Import (C, ReadLocation, "ReadLocation", "ReadLocation");
   procedure WriteLocation
     (loc                : access MachineLocation);

   pragma Import (C, WriteLocation, "WriteLocation", "WriteLocation");
   function GetTrapVector
     (trapNumber         : in     Short_Integer)
      return                      UniversalProcPtr_Ptr;

   pragma Import (C, GetTrapVector, "GetTrapVector", "GetTrapVector");
end OSUtils;