home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD 45 / SuperCD45.iso / talleres / prog_alternat / StringUtils / TEST.MOD < prev   
Encoding:
Text File  |  1999-10-31  |  991 b   |  48 lines

  1. MODULE Test;
  2.  
  3. IMPORT In,Out,stu:=StringUtils;
  4.  
  5. PROCEDURE ProgMain*;
  6. VAR
  7.   chPtr : chP;
  8.   intPtr : stu.intP;
  9.   strPtr : stu.strP;
  10.   arr : stu.arr10T;
  11.   s : STRING50;
  12.   i : INTEGER;
  13. BEGIN
  14.   (* create and init some records *)
  15.   NEW(chPtr);
  16.   NEW(intPtr);
  17.   NEW(strPtr);
  18.   chPtr.datatype := 'char'; 
  19.   chPtr^.c := 'X';         (* ^ here is optional *)
  20.   intPtr.datatype := 'integer';
  21.   intPtr.i := 100;
  22.   strPtr.datatype := 'string';
  23.   strPtr.s := 'Hello there, folks!';
  24.   
  25.   (* create a format string, s *)
  26.   s := '% "%" is worth ú%!';
  27.   Out.String( 'Before processing, the string is: ' );
  28.   Out.String( s );
  29.   Out.Ln;
  30.   
  31.   (* init the array, arr, by filling the slots with NILs *)
  32.   FOR i := 0 TO LEN(arr)-1 DO
  33.       arr[i] := NIL;
  34.   END;
  35.   
  36.   arr[0] := strPtr;
  37.   arr[1] := chPtr;
  38.   arr[2] := intPtr;
  39.   stu.ProcessArray( s, arr );
  40.   Out.Ln;
  41.   Out.String( 'After processing, the string is: ' );  
  42.   Out.String( s );
  43.     
  44. END ProgMain;
  45.  
  46.  
  47. END Test.
  48.