home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / pascal / visionix / test / tstringu.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-01-01  |  4.0 KB  |  171 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.   VStrTxtAssign( F, SL );
  97.   ShowMemInfoDuring;
  98.  
  99.   WriteLN( F, '' );
  100.   WriteLN( F, 'Hi! How are you doing today?  I am fine.');
  101.   WriteLn( F, ' I hope you are enjoying this, because I am.');
  102.   WriteLn( F, '  The quick brown fox jumped over the lazy dog.');
  103.   WriteLn( F, '   All-the-live-long-day.');
  104.   WriteLn( F, '    Now is the time for all good people');
  105.   Write  ( F, '     to purchase a copy of ');
  106.   WriteLN( F, 'all Visionix Products...');
  107.  
  108.   VStrListPutStr( SL, 1, 'Hello, ');
  109.   VStrListPutStr( SL, 2, 'World. ');
  110.   VStrListPutStr( SL, 3, 'How '   );
  111.   VStrListPutStr( SL, 4, 'Are '   );
  112.   VStrListPutStr( SL, 5, 'You '   );
  113.   VStrListPutStr( SL,10, 'Today?' );
  114.  
  115.   For Z:=1 to 5 Do
  116.     WriteLn('    VStrListGetStr( sl, ',z,'  ) ... ',
  117.                  VStrListGetStr( SL, Z )              );
  118.  
  119.     WriteLn('    VStrListGetStr( sl, 10 ) ... ',
  120.                  VStrListGetStr( SL, 10 )              );
  121.  
  122.  
  123.  
  124.  
  125.   WriteLn('    VStrListDispose()');
  126.  
  127.   VStrListDispose( SL );
  128.  
  129.   ShowMemInfoAfter;
  130.  
  131.   WriteLn;
  132.  
  133. END;
  134.  
  135. {────────────────────────────────────────────────────────────────────────────}
  136. {────────────────────────────────────────────────────────────────────────────}
  137. {────────────────────────────────────────────────────────────────────────────}
  138.  
  139. BEGIN
  140.  
  141.  
  142.   WriteLn;
  143.   WriteLn;
  144.   WriteLn('TSTRINGU (Tests VStringu)');
  145.   WriteLn('Version 0.1 November 2, 1993');
  146.   WriteLn;
  147.  
  148.   TestStrListNewAndDispose( cslStrings    );
  149.   TestStrListNewAndDispose( cslPStrings   );
  150.   TestStrListNewAndDispose( cslLLStrings  );
  151.   TestStrListNewAndDispose( cslPChars     );
  152.   TestStrListNewAndDispose( cslLLPchars   );
  153.  
  154.   TestStrListPutAndGetStr ( cslStrings    );
  155.   TestStrListPutAndGetStr ( cslPStrings   );
  156.   TestStrListPutAndGetStr ( cslLLStrings  );
  157.   TestStrListPutAndGetStr ( cslPChars     );
  158.   TestStrListPutAndGetStr ( cslLLPchars   );
  159.  
  160.   TestStrListPutAndGetPtr ( cslStrings    );
  161.   TestStrListPutAndGetPtr ( cslPStrings   );
  162.   TestStrListPutAndGetPtr ( cslLLStrings  );
  163.  
  164.   TestStrListPutAndGetPChar( cslStrings    );
  165.   TestStrListPutAndGetPChar( cslPStrings   );
  166.   TestStrListPutAndGetPChar( cslLLStrings  );
  167.   TestStrListPutAndGetPChar( cslPChars     );
  168.   TestStrListPutAndGetPChar( cslLLPchars   );
  169.  
  170.  
  171. END.