home *** CD-ROM | disk | FTP | other *** search
/ ftp.ee.pdx.edu / 2014.02.ftp.ee.pdx.edu.tar / ftp.ee.pdx.edu / pub / users / Harry / Blitz / OSProject / p5 / FileStuff.h < prev    next >
Text File  |  2007-09-19  |  3KB  |  83 lines

  1.   -----------------------------  DiskDriver  ---------------------------------
  2.   --
  3.   --  There is only one instance of this class.
  4.   --
  5.   class DiskDriver
  6.     superclass Object
  7.     fields
  8.       DISK_STATUS_WORD_ADDRESS: ptr to int
  9.       DISK_COMMAND_WORD_ADDRESS: ptr to int
  10.       DISK_MEMORY_ADDRESS_REGISTER: ptr to int
  11.       DISK_SECTOR_NUMBER_REGISTER: ptr to int
  12.       DISK_SECTOR_COUNT_REGISTER: ptr to int
  13.       semToSignalOnCompletion: ptr to Semaphore
  14.       semUsedInSynchMethods: Semaphore
  15.       diskBusy: Mutex
  16.     methods
  17.       Init ()
  18.       SynchReadSector  (sectorAddr, numberOfSectors, memoryAddr: int)
  19.       StartReadSector  (sectorAddr, numberOfSectors, memoryAddr: int,
  20.                         whoCares: ptr to Semaphore)
  21.       SynchWriteSector (sectorAddr, numberOfSectors, memoryAddr: int)
  22.       StartWriteSector (sectorAddr, numberOfSectors, memoryAddr: int,
  23.                         whoCares: ptr to Semaphore)
  24.   endClass
  25.  
  26.   -----------------------------  FileManager  ---------------------------------
  27.  
  28.   class FileManager
  29.     superclass Object
  30.     fields
  31.       fileManagerLock: Mutex
  32.       fcbTable: array [MAX_NUMBER_OF_FILE_CONTROL_BLOCKS] of FileControlBlock
  33.       anFCBBecameFree: Condition
  34.       fcbFreeList: List [FileControlBlock]
  35.       openFileTable: array [MAX_NUMBER_OF_OPEN_FILES] of OpenFile
  36.       anOpenFileBecameFree: Condition
  37.       openFileFreeList: List [OpenFile]
  38.       directoryFrame: int
  39.       serialTerminalFile: OpenFile
  40.     methods
  41.       Init ()
  42.       Print ()
  43.       FindFCB (filename: String) returns ptr to FileControlBlock  -- null if errors
  44.       Open (filename: String) returns ptr to OpenFile             -- null if errors
  45.       Close (open: ptr to OpenFile)
  46.       Flush (open: ptr to OpenFile)
  47.       SynchRead (open: ptr to OpenFile, targetAddr, bytePos, numBytes: int) returns bool
  48.       SynchWrite (open: ptr to OpenFile, sourceAddr, bytePos, numBytes: int) returns bool
  49.   endClass
  50.  
  51.   -----------------------------  FileControlBlock  ---------------------------------
  52.  
  53.   class FileControlBlock
  54.     superclass Listable
  55.     fields
  56.       fcbID: int
  57.       numberOfUsers: int             -- count of OpenFiles pointing here
  58.       startingSectorOfFile: int      -- or -1 if FCB not in use
  59.       sizeOfFileInBytes: int
  60.       bufferPtr: int                 -- addr of a page frame
  61.       relativeSectorInBuffer: int    -- or -1 if none
  62.       bufferIsDirty: bool            -- Set to true when buffer is modified
  63.     methods
  64.       Init ()
  65.       Print ()
  66.     endClass
  67.  
  68.   -----------------------------  OpenFile  ---------------------------------
  69.  
  70.   class OpenFile
  71.     superclass Listable
  72.     fields
  73.       kind: int                      -- FILE, TERMINAL, or PIPE
  74.       currentPos: int                -- 0 = first byte of file
  75.       fcb: ptr to FileControlBlock   -- null = not open
  76.       numberOfUsers: int             -- count of Processes pointing here
  77.     methods
  78.       Print ()
  79.       ReadBytes (targetAddr, numBytes: int) returns bool        -- true=All Okay
  80.       ReadInt () returns int
  81.       LoadExecutable (addrSpace: ptr to AddrSpace) returns int  -- -1 = problems
  82.   endClass
  83.