home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / progrmng / mlpmodul.sit / MacLogimoPlus Documentation / DEF3 Files / DeviceMgr.DEF < prev    next >
Encoding:
Modula Definition  |  1990-06-14  |  5.3 KB  |  137 lines  |  [TEXT/PMED]

  1. DEFINITION MODULE DeviceMgr;  (* 20 Mar 87 by Tim Myers *)
  2.  
  3. (* Device Manager routines from Inside Macintosh *)
  4.  
  5. FROM SYSTEM IMPORT ADDRESS;
  6. FROM FileMgr IMPORT
  7.     OSType, OSErr, Ptr, ProcPtr, LONGINT, Str255, StringPtr, SignedByte,
  8.     FInfo, QElemPtr;
  9.  
  10.  
  11. EXPORT QUALIFIED
  12.     OpenDriver, CloseDriver, FSRead, FSWrite, Control, Status, KillIO,
  13.     ParamBlkType, ParamBlockRec, ParmBlkPtr, DCtlHandle, DCtlPtr, DCtlEntry,
  14.     fsCurPerm, fsRdPerm, fsWrPerm, fsRdWrPerm,
  15.     fsAtMark, fsFromStart, fsFromMark, rdVerify,
  16.     PBOpen, PBClose, PBRead, PBWrite, PBControl, PBStatus, PBKillIO;
  17.  
  18. TYPE Handle    = POINTER TO Ptr;
  19.     WindowPtr  = ADDRESS;
  20.     QHdrPtr    = POINTER TO QHdr;
  21.     QHdr = RECORD
  22.         qFlags: INTEGER;
  23.         qHead:    QElemPtr;
  24.         qTail:    QElemPtr
  25.     END;
  26.     csParamType = ARRAY[0..10] OF INTEGER;    (* These types are needed *)
  27.     csPtr = POINTER TO csParamType;  (* due to Modula's strong type checking *)
  28.  
  29. CONST
  30.     fsCurPerm   = 0;
  31.     fsRdPerm    = 1;
  32.     fsWrPerm    = 2;
  33.     fsRdWrPerm  = 3;
  34.     
  35.     fsAtMark    = 0;
  36.     fsFromStart = 1;
  37.     fsFromMark  = 3;
  38.     rdVerify    = 64;
  39.  
  40. TYPE
  41.     ParamBlkType = (ioParam, fileParam, volumeParam, cntrlParam);
  42.     ParmBlkPtr = POINTER TO ParamBlockRec;
  43.     ParamBlockRec = RECORD
  44.       qLink:        QElemPtr;        (* next queue entry *)
  45.       qType:        INTEGER;        (* queue type *)
  46.       ioTrap:        INTEGER;        (* routine trap *)
  47.       ioCmdAddr:    Ptr;            (* routine address *)
  48.       ioCompletion: ProcPtr;        (* completion routine *)
  49.       ioResult:        OSErr;            (* result code *)
  50.       ioNamePtr:    StringPtr;        (* pathname *)
  51.       ioVRefNum:    INTEGER;        (* volume reference or drive number *)
  52.  
  53.     CASE ParamBlkType OF
  54.       ioParam:
  55.         ioRefNum:        INTEGER;    (* path reference number *)
  56.         ioVersNum:        SignedByte;    (* version number *)
  57.         ioPermssn:        SignedByte;    (* read/write permission *)
  58.         ioMisc:            Ptr;        (* miscellaneous *)
  59.         ioBuffer:        Ptr;        (* data buffer *)
  60.         ioReqCount:        LONGINT;    (* requested number of bytes *)
  61.         ioActCount:        LONGINT;    (* actual number of bytes *)
  62.         ioPosMode:        INTEGER;    (* positioning mode and newline character *)
  63.         ioPosOffset:    LONGINT;    (* positioning offset *)
  64.      | fileParam:
  65.         ioFRefNum:        INTEGER;    (* path reference number *)
  66.         ioFVersNum:        SignedByte;    (* version number *)
  67.         filler1:        SignedByte;    (* not used *)
  68.         ioFDirIndex:    INTEGER;    (* directory index *)
  69.         ioFlAttrib:        SignedByte;    (* file attributes *)
  70.         ioFlVersNum:    SignedByte;    (* version number *)
  71.         ioFlFndrInfo:    FInfo;        (* information used by the finder *)
  72.         ioFlNum:        LONGINT;    (* file number *)
  73.         ioFlStBlk:        INTEGER;    (* first allocation block of data fork *)
  74.         ioFlLgLen:        LONGINT;    (* logical end-of-file of data fork *)
  75.         ioFlPyLen:        LONGINT;    (* physical end-of-file of data fork *)
  76.         ioFlRStBlk:        INTEGER;    (* first allocation block of resource fork *)
  77.         ioFlRLgLen:        LONGINT;    (* logical end-of-file of resource fork *)
  78.         ioFlRPyLen:        LONGINT;    (* physical end-of-file of resource fork *)
  79.         ioFlCrDat:        LONGINT;    (* date and time of creation *)
  80.         ioFlMdDat:        LONGINT;    (* date and time of last modification *)
  81.     | volumeParam:
  82.         filler2:        LONGINT;    (* not used *)
  83.         ioVolIndex:        INTEGER;    (* volume index *)
  84.         ioVCrDate:        LONGINT;    (* date and time of initialization *)
  85.         ioVLsBkUp:        LONGINT;    (* date and time of last modification *)
  86.         ioVAtrb:        INTEGER;    (* volume attributes *)
  87.         ioVNmFls:        INTEGER;    (* number of files in directory *)
  88.         ioVDirSt:        INTEGER;    (* first block of directory *)
  89.         ioVBlLn:        INTEGER;    (* length of directory in blocks *)
  90.         ioVNmAlBlks:    INTEGER;    (* number of allocation blocks *)
  91.         ioVAlBlkSiz:    LONGINT;    (* size of allocation blocks *)
  92.         ioVClpSiz:        LONGINT;    (* number of bytes to allocate *)
  93.         ioAlBlSt:        INTEGER;    (* first block in block map *)
  94.         ioVNxtFNum:        LONGINT;    (* next unused file number *)
  95.         ioVFrBlk:        INTEGER;    (* number of unused allocation blocks *)
  96.     | cntrlParam:
  97.         ioCRefNum:        INTEGER;    (* driver reference number *)
  98.         csCode:            INTEGER;    (* type of control of status information *)
  99.         csParam:        csParamType; (* control or status information *)
  100.     END (* CASE *)
  101.     END; (* ParamBlockRec *)
  102.     
  103.     DCtlHandle = POINTER TO DCtlPtr;
  104.     DCtlPtr    = POINTER TO DCtlEntry;
  105.     DCtlEntry  = RECORD
  106.         dCtlDriver:        Ptr;
  107.         dCtlFlags:        INTEGER;
  108.         dCtlQHdr:        QHdr;
  109.         dCtlPosition:    LONGINT;
  110.         dCtlStorage:    Handle;
  111.         dCtlRefNum:        INTEGER;
  112.         dCtlCurTicks:    LONGINT;
  113.         dCtlWindow:        WindowPtr;
  114.         dCtlDelay:        INTEGER;
  115.         dCtlEMask:        INTEGER;
  116.         dCtlMenu:        INTEGER;
  117.     END;
  118.  
  119. PROCEDURE OpenDriver  (name: StringPtr; VAR refNum: INTEGER): OSErr;
  120. PROCEDURE CloseDriver (refNum: INTEGER): OSErr;
  121.  
  122. PROCEDURE FSRead  (refNum: INTEGER; VAR count: LONGINT; buffPtr: Ptr): OSErr;
  123. PROCEDURE FSWrite (refNum: INTEGER; VAR count: LONGINT; buffPtr: Ptr): OSErr;
  124. PROCEDURE Control (refNum: INTEGER; csCode: INTEGER; csParamPtr: csPtr): OSErr;
  125. PROCEDURE Status  (refNum: INTEGER; csCode: INTEGER; csParamPtr: csPtr): OSErr;
  126. PROCEDURE KillIO  (refNum: INTEGER): OSErr;
  127.  
  128. PROCEDURE PBOpen    (paramBlock: ParmBlkPtr; async: BOOLEAN): OSErr;
  129. PROCEDURE PBClose   (paramBlock: ParmBlkPtr; async: BOOLEAN): OSErr;
  130. PROCEDURE PBRead    (paramBlock: ParmBlkPtr; async: BOOLEAN): OSErr;
  131. PROCEDURE PBWrite   (paramBlock: ParmBlkPtr; async: BOOLEAN): OSErr;
  132. PROCEDURE PBControl (paramBlock: ParmBlkPtr; async: BOOLEAN): OSErr;
  133. PROCEDURE PBStatus  (paramBlock: ParmBlkPtr; async: BOOLEAN): OSErr;
  134. PROCEDURE PBKillIO  (paramBlock: ParmBlkPtr; async: BOOLEAN): OSErr;
  135.  
  136. END DeviceMgr.
  137.