home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Pascal / Samples / TBASE551.ARJ / MANUAL.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-12-19  |  1.8 KB  |  66 lines

  1. Uses Tbase , DbStr;
  2.  
  3. (* This is the Simplest program I used to format the Manual Tbase3.Txt.
  4.    I just include this to you to show as another demo of what Tbase3
  5.    can do with Pascal. See Demo.pas for a comprehensive demo *)
  6.  
  7. Var i : LongInt ;
  8.     Manual : DataObject ;
  9.     Mfile : Text ;
  10.  
  11. (* 
  12. This routine writes the specifies field s if it is not empty.
  13. sss and ss are just strings for allighment or heading.
  14. *)
  15.     
  16. Procedure WriteData(sss,ss,s : string  ) ;
  17. Begin
  18.     s :=  Trim ( Manual^.FieldData(s) )   ;
  19.     If s <> '' then Begin
  20.                 if Trim(sss) <> '' then Writeln(Mfile, sss );
  21.                 Writeln(Mfile , ss + s );
  22.             End;
  23. End;
  24.  
  25. (* This procedure displays the fields in a formatted manner.
  26.    Notice that Field names are given with no discremination of case
  27.    or spaces *)
  28.  
  29. Procedure WriteManual;
  30. Var j : Integer ;
  31. Begin
  32.     WriteData('','','Name');             Writeln(Mfile);
  33.     WriteData('Description','     ','Discript1') ;
  34.     WriteData('           ','     ','Discript2') ;    Writeln(Mfile);
  35.     WriteData('Syntax     ','     ','use1     ') ;
  36.     WriteData('           ','     ','use2     ') ;    Writeln(Mfile);
  37.     WriteData('Remarks    ','     ','remark1  ') ;
  38.     WriteData('           ','     ','remark2  ') ;
  39.     WriteData('           ','     ','remark3  ') ;    Writeln(Mfile);
  40.     WriteData('Warning    ','     ','warning1 ') ;
  41.     WriteData('           ','     ','warning2 ') ;    Writeln(Mfile);
  42.     WriteData('See Also   ','     ','seeALSO  ') ;    
  43.     Writeln(Mfile , '----------------------------------------------------------');
  44.     Writeln(Mfile);
  45. End;
  46.  
  47. Begin { M a i n }
  48.  
  49.     Assign( Mfile , Paramstr(2) );
  50.     Rewrite(Mfile);
  51.  
  52.     New( Manual , Init( paramstr(1) ) );
  53.  
  54.     With Manual^ do 
  55.     Begin
  56.         For i := 1 to RecCount do
  57.         Begin
  58.             GetDbRec(i);
  59.             WriteManual;
  60.         End;
  61.     End;
  62.     Dispose( Manual , done );
  63.  
  64.     Close(Mfile);
  65. End.    
  66.