home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d512 / m2pascal.lha / M2Pascal / test.mod < prev    next >
Text File  |  1991-07-20  |  1KB  |  57 lines

  1. MODULE test;
  2. (* This is a simple m2 source program designed to test m2pascal.
  3. *)
  4.  
  5. FROM InOut      IMPORT  WriteString,    WriteLn,    WriteInt;
  6.  
  7. FROM Storage    IMPORT  ALLOCATE, DEALLOCATE;
  8.  
  9.  
  10. CONST
  11.         C1    =    10;
  12.  
  13.  
  14. TYPE
  15.         ConnectPtr  =  POINTER TO ConnectType;    
  16.     ConnectType =  RECORD
  17.             node    : INTEGER;
  18.             next    : ConnectPtr;        
  19.     END;
  20.  
  21.     ArrayType = ARRAY [ 1.. C1 ] OF  BOOLEAN;
  22.  
  23. VAR  
  24.         v1int           : INTEGER;
  25.         v2card          : CARDINAL;
  26.         v3real          : REAL;
  27.  
  28. PROCEDURE proc1() : INTEGER;
  29. BEGIN
  30.     IF C1 = 10 THEN
  31.         RETURN C1;
  32.     ELSE
  33.         RETURN 0;
  34.     END;
  35. END proc1;
  36.  
  37. BEGIN (* main *)
  38.    v1int   :=   1;
  39.    v2card  :=   2;
  40.    v3real  :=   3.0;
  41.  
  42.            (* Test while loop *)
  43.    WHILE ( v1int < 2 ) DO
  44.         DEC ( v1int );
  45.    END;
  46.  
  47.  
  48.           (* Test repeat loop *)
  49.    REPEAT
  50.        v1int := 1;
  51.    UNTIL ( v1int < 2 ) ;
  52.  
  53.    WriteString (" Simple test program written in Module-2 to \n");
  54.    WriteString (" demonstrate m2pascal (type more test.mod to see) \n\n");
  55. END test.
  56.  
  57.