home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / PJ8_3.ZIP / UPROGRAM.PAS < prev    next >
Pascal/Delphi Source File  |  1990-02-15  |  1KB  |  61 lines

  1. (* uprogram.pas -- (c) 1989 by Tom Swan *)
  2.  
  3. unit uprogram;
  4.  
  5. interface
  6.  
  7. uses crt, ukeys, ucmds, ulist, umenu;
  8.  
  9. procedure run;
  10.  
  11. var
  12.  
  13.    theMenu  : menu;
  14.  
  15. implementation
  16.  
  17. { ----- Private command object. }
  18.  
  19. type
  20.  
  21.    quitObj = object( command )
  22.       procedure processItem; virtual;
  23.    end;
  24.  
  25. var
  26.    
  27.    quitCmd  : quitObj;
  28.  
  29. {$IFDEF DEBUG}
  30.    startmem : longint;  { Holds memavail at startup for debugging }
  31. {$ENDIF}
  32.  
  33. { ----- Run the program. }
  34.  
  35. procedure run;
  36. begin
  37.    quitCmd.init( @theMenu, 'Q', 'Quit' );
  38.    theMenu.performCommands;
  39.    theMenu.done;
  40.    gotoxy( 1, hi( windmax ) + 1 );
  41.    writeln;
  42. {$IFDEF DEBUG}
  43.    writeln( 'mem at start = ', startmem );   { display statistics }
  44.    writeln( 'mem at end   = ', memavail );
  45. {$ENDIF}
  46. end;
  47.  
  48. { ----- Implement the Quit command. }
  49.  
  50. procedure quitObj.processItem;
  51. begin
  52.    pushKey( chr(27) );     { Simulate <Esc> keypress }
  53. end;
  54.  
  55. begin
  56. {$IFDEF DEBUG}
  57.    startmem := memavail;   { Record memavail at startup }
  58. {$ENDIF}
  59.    theMenu.init( 1, hi( windmax ) + 1, 'Test:', WHITE + BLUE * 16 );
  60. end.
  61.