home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / pascal / visionix / test / tstrtxtu.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-01-01  |  3.2 KB  |  153 lines

  1. program tstrtxtu;
  2.  
  3.  
  4. uses
  5.  
  6.   vtypesu,
  7.   vgenu,
  8.   vstringu,
  9.   VStrTxtU;
  10.  
  11. Var
  12.   smaxavail,smemavail : LONGINT;
  13.  
  14. {────────────────────────────────────────────────────────────────────────────}
  15.  
  16. Procedure ShowMemInfoBefore;
  17.  
  18. BEGIN
  19.  
  20.   smaxavail := maxavail;
  21.   smemavail := memavail;
  22.  
  23.   WriteLn('      Memory Before: MaxAvail=',Maxavail,' MemAvail=',MemAvail);
  24.  
  25. END;
  26.  
  27. Procedure ShowMemInfoDuring;
  28.  
  29. BEGIN
  30.  
  31.   WriteLn('      Memory During: MaxAvail=',Maxavail,
  32.                               '(', smaxavail-maxavail,') ',
  33.                               'MemAvail=',MemAvail,
  34.                               '(', smemavail-memavail,') '  );
  35.  
  36. END;
  37.  
  38.  
  39. Procedure ShowMemInfoAfter;
  40.  
  41. BEGIN
  42.  
  43.   WriteLn('      Memory After : MaxAvail=',Maxavail,
  44.                               '(', smaxavail-maxavail,') ',
  45.                               'MemAvail=',MemAvail,
  46.                               '(', smemavail-memavail,') '  );
  47.  
  48.  
  49.  
  50. END;
  51.  
  52. {────────────────────────────────────────────────────────────────────────────}
  53.  
  54.  
  55. Procedure TestVStrTxtAssign( theflags : word );
  56.  
  57. Var
  58.  
  59.   SL                   :   PStrList;
  60.   smaxavail, smemavail : LONGINT;
  61.  
  62.   sltype     : ST80;
  63.  
  64.   Z          : INTEGER;
  65.  
  66.  
  67.   F          : TEXT;
  68.  
  69. BEGIN
  70.  
  71.   Case theflags of
  72.  
  73.     cslStrings   : sltype := 'cslStrings';
  74.     cslPStrings  : sltype := 'cslPStrings';
  75.     cslLLStrings : sltype := 'cslLLStrings';
  76.     cslPChars    : sltype := 'cslPChars';
  77.     cslLLPChars  : sltype := 'cslLLPChars';
  78.  
  79.   ELSE
  80.  
  81.     slType := 'UNKNOWN!';
  82.  
  83.   END;
  84.  
  85.   WriteLn('  Test VStrTxtAssign with '+sltype );
  86.  
  87.   smaxavail := maxavail;
  88.   smemavail := memavail;
  89.  
  90.   WriteLn('    VStrListNew( ',WordToHex(theflags),', 10, 80 )' );
  91.   SL := VStrListNew( theflags, 10, 80 );
  92.  
  93.   ShowMemInfoBefore;
  94.  
  95.   WriteLn('    VStrTxtAssign( f, sl )' );
  96.  
  97.   VStrTextAssign( F, SL );
  98.   ShowMemInfoDuring;
  99.  
  100.   WriteLN( F, '' );
  101.   WriteLN( F, 'Hi! How are you doing today?  I am fine.');
  102.   WriteLn( F, ' I hope you are enjoying this, because I am.');
  103.   WriteLn( F, '  The quick brown fox jumped over the lazy dog.');
  104.   WriteLn( F, '   All-the-live-long-day.');
  105.   WriteLn( F, '    Now is the time for all good people');
  106.   Write  ( F, '     to purchase a copy of ');
  107.   WriteLN( F, 'all Visionix Products...');
  108.  
  109.   For Z:=1 to VStrTextGetLines( F ) Do
  110.     WriteLn('    VStrListGetStr( sl, ',z,'  ) ... ',
  111.                  VStrListGetStr( SL, Z )              );
  112.  
  113.     WriteLn('    VStrListGetStr( sl, 10 ) ... ',
  114.                  VStrListGetStr( SL, 10 )              );
  115.  
  116.  
  117.  
  118.   Close( F );
  119.   ShowMemInfoAfter;
  120.  
  121.  
  122.  
  123.   WriteLn('    VStrListDispose()');
  124.  
  125.   VStrListDispose( SL );
  126.  
  127.  
  128.   WriteLn;
  129.  
  130. END;
  131.  
  132. {────────────────────────────────────────────────────────────────────────────}
  133. {────────────────────────────────────────────────────────────────────────────}
  134. {────────────────────────────────────────────────────────────────────────────}
  135.  
  136. BEGIN
  137.  
  138.  
  139.   WriteLn;
  140.   WriteLn;
  141.   WriteLn('TSTRTXTGU (Tests VStrTxtu)');
  142.   WriteLn('Version 0.1 November 2, 1993');
  143.   WriteLn;
  144.  
  145.  
  146.   TestVStrTxtAssign( cslStrings    );
  147.   TestVStrTxtAssign( cslPStrings   );
  148.   TestVStrTxtAssign( cslLLStrings  );
  149.   TestVStrTxtAssign( cslPChars     );
  150.   TestVStrTxtAssign( cslLLPChars   );
  151.  
  152.  
  153. END.