home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / MFMP110A.ZIP / MAXAREAS.PAS < prev    next >
Pascal/Delphi Source File  |  1992-03-09  |  2KB  |  73 lines

  1. (*#module(turbo_comp=>off)*)
  2. Implementation Unit MaxAreas;
  3.  
  4. IMPORT
  5.   OS2DEF(ULONG),
  6.   DOS(HDIR,FILEFINDBUF,HDIR_CREATE,EXIT_PROCESS),
  7.   TURBOCRT,
  8.   TURBODOS,
  9.   TURBOSYS(_BLOCKREAD);
  10.  
  11. Var
  12.   xztempstr : array[1..255] of char;
  13.   xhndlhdir : HDIR;
  14.   xattr, xreslng, xcount, xretn : word;
  15.   xrsrvd : ULONG;
  16.   xDirInfo : FILEFINDBUF;
  17.   AreaDat : FILE OF char;
  18. {========================================================================}
  19. Procedure OpenMaximusArea;
  20. Var
  21.   iores : word;
  22.   Begin
  23.     xattr := 0H;
  24.     xhndlhdir := HDIR_CREATE;
  25.     xcount := 1;
  26.     xreslng := size(FILEFINDBUF);
  27.     StrToZ(AreaPath,xztempstr);
  28.     xretn := dos.FindFirst(xztempstr,xhndlhdir,xattr,xDirInfo,
  29.       xreslng,xcount,xrsrvd);
  30.     If xretn <> 0 Then
  31.     Begin
  32.       WriteLn(AreaPath+' not found!');
  33.       dos.exit(EXIT_PROCESS,1);
  34. {      ABORT(1); }
  35.     End
  36.     Else
  37.     Begin
  38.       IOcheck := FALSE;
  39.       Assign(AreaDat,AreaPath);
  40.       iores := IOresult;
  41.       FileMode := 0H;
  42.       iores := IOresult;
  43.       Reset(AreaDat);
  44.       iores := IOresult;
  45.       Seek(AreaDat,4);
  46.       iores := IOresult;
  47.       _BLOCKREAD(AreaDat,StructLen,Size(StructLen));
  48.       iores := IOresult;
  49.       IOcheck := TRUE;
  50.     End;
  51.   End;
  52. {========================================================================}
  53. Function GetMaximusArea { (AreaNo, StructLen : Integer; Var AreaRecord : AreaRecordType) : Byte; };
  54.   Begin
  55.     If (StructLen*AreaNo) > FileSize(AreaDat) Then
  56.     Begin
  57.       GetMaximusArea := 254;
  58.     End
  59.     Else
  60.     Begin
  61.       Seek(AreaDat,StructLen*(AreaNo-1));
  62.       _BLOCKREAD(AreaDat,AreaRecord,Size(AreaRecord));
  63.       GetMaximusArea := 0;
  64.     End;
  65.   End;
  66. {========================================================================}
  67. Procedure CloseMaximusArea;
  68.   Begin
  69.     Close(AreaDat);
  70.   End;
  71. {========================================================================}
  72. End.
  73.