Metropoli BBS
VIEWER: tvfm.dif MODE: TEXT (ASCII)
  TVFM, a Turbo Vision File Manager example from Borland Pascal

  In order for the original source code from Borland to work with
  Virtual Pascal for OS/2, the following changes need to be made.  Note,
  that the source will still work with Borland Pascal after the changes
  have been made.

  * Add Use32 to all the Uses clause of all units

  * Change COLORS.PAS:
    At line 62, insert a line, changing
      LoadPalette := False;
      Assign(F, Name);
    to
      LoadPalette := False;
      if (Pos('*',Name) <> 0 ) or (Pos('?',Name) <> 0) then Exit;
      Assign(F, Name);

  * Change DIRVIEW.PAS:
    In OS/2, the FindFirst/FindNext sequence used in DOS is completed
    with a FindClose call that frees the resources used for the search.
    Insert the line
      {$IFDEF OS2} FindClose(SR); {$ENDIF}
    at line 81 (end of procedure tDirectory.Init) and line 110 (in
    procedure tDirectory.Adjust).

  * Change FILECOPY.PAS:
    As noted above, a call to FindClose must be added.  Insert
      {$IFDEF OS2} FindClose(SRec); {$ENDIF}
    At line 287, just before the line
      if (DosError = 0) and ((SRec.Attr and Archive) = 0) then Exit

  * Change FILEFIND.PAS:
    Again, FindClose must be added in two places.  In the function
    TSearchDialog.GetNextFile, line 156ff
      if DosError = 0 then GetNextFile := Search.Name
      else GetNextFile := '';
    should be changed to read
      if DosError = 0 then GetNextFile := Search.Name
      else
        begin
          GetNextFile := '';
          {$IFDEF OS2} FindClose(Search); {$ENDIF}
        end;

     Around line 200, in TSearchDialog.HandleEvent, change
       if DosError <> 0 then PopStack := True
       else
     to read
       if DosError <> 0 then
         begin
           PopStack := True;
           {$IFDEF OS2} FindClose(Stack^.Search); {$ENDIF}
         end
       else

  * Change FILEVIEW.PAS:
    - In line 94, the file size field should be expanded to 9 characters,
      so the line that currently looks like
        if DisplayFields and $1 <> 0 then FormatStr(S, ' %-8s%-4s %7d', Params)
      should be changed to
        if DisplayFields and $1 <> 0 then FormatStr(S, ' %-8s%-4s %9d', Params)

    - Two FindClose statements need to be added as well:
      Around line 128, in the final part of TFileView.SearchForFiles, change
          end else SearchForFiles := True;  { done searching }
        end;
      to
          end
        else
          begin
            SearchForFiles := True;  { done searching }
            {$IFDEF OS2} FindClose(Search); {$ENDIF}
          end;
        end;

      The FindClose call needs to be added as the last statement in
      TFileView.ScanSingleFile too - this is line 152:
          {$IFDEF OS2} FindClose(Search); {$ENDIF}
        end;

  * Change TOOLS.PAS:
    - The Uses clause needs to include two of the OS/2 API interface
      units, and the first line should be changed to read
        uses {$IFDEF OS2} Os2Base, Os2Def, {$ENDIF}

    - The DriveValid function, line 556, is implemented in 16 bit
      assembler, and must be changed to OS/2.  Insert the following
      before the existing definition of DriveValid:
        {$IFDEF OS2}
        function DriveValid(Drive: Char): Boolean;
        var
          DriveNum,LogDrvMap: ULong;
        begin                   { LogDrvMap: Bit 0: 'A:', Bit 1: 'B:', etc }
          if DosQueryCurrentDisk(DriveNum,LogDrvMap) = 0
            then DriveValid := ((1 shl (Ord(Drive) - Ord('A'))) and LogDrvMap) <> 0
            else DriveValid := False;
        end;
        {$ELSE}
      and add the matching ENDIF around line 602, after the definition of
      the GetRedirEntry function.

    - The RedirDeviceList function is not available for DPMI; most of it is
      enclosed in {$IFNDEF DPMI} conditionals.  An {$IFNDEF OS2} conditional
      needs to be added, changing the lines to
        {$IFNDEF DPMI}
        {$IFNDEF OS2}
          List := New(PDeviceCollection, Init(10,10));
          ...
        {$ENDIF}
        {$ENDIF}

  * Change TVFM.PAS:
    - After the Uses clause, add the following:

        {$IFDEF VPDEMO}
          {$Dynamic VP11Demo.Lib}
        {$ENDIF}

      This means, that the program will use all units stored in the
      Demo Licence DLL (vp11demo.dll) when the program is compiled with
      the demonstration version of VP/2.

[ RETURN TO DIRECTORY ]