home *** CD-ROM | disk | FTP | other *** search
/ PC Open 19 / pcopen19.iso / Zipped / CALMIR21.ZIP / SOURCE.ZIP / SRC / DEBUG.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-02-20  |  2.7 KB  |  85 lines

  1. {**************************************************************************}
  2. {                                                                          }
  3. {    Calmira shell for Microsoft« Windows(TM) 3.1                          }
  4. {    Source Release 2.0                                                    }
  5. {    Copyright (C) 1997-1998  Li-Hsin Huang                                }
  6. {                                                                          }
  7. {    This program is free software; you can redistribute it and/or modify  }
  8. {    it under the terms of the GNU General Public License as published by  }
  9. {    the Free Software Foundation; either version 2 of the License, or     }
  10. {    (at your option) any later version.                                   }
  11. {                                                                          }
  12. {    This program is distributed in the hope that it will be useful,       }
  13. {    but WITHOUT ANY WARRANTY; without even the implied warranty of        }
  14. {    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         }
  15. {    GNU General Public License for more details.                          }
  16. {                                                                          }
  17. {    You should have received a copy of the GNU General Public License     }
  18. {    along with this program; if not, write to the Free Software           }
  19. {    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.             }
  20. {                                                                          }
  21. {**************************************************************************}
  22.  
  23. unit Debug;
  24.  
  25. interface
  26.  
  27. uses
  28.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  29.   Forms, Dialogs, StdCtrls, Menus;
  30.  
  31. type
  32.   TConsole = class(TForm)
  33.     Listbox: TListBox;
  34.   private
  35.     { Private declarations }
  36.     TimeMark: Longint;
  37.     procedure WMSysCommand(var Msg : TWMSysCommand); message WM_SYSCOMMAND;
  38.   public
  39.     { Public declarations }
  40.     function StartTimer : Longint;
  41.     function StopTimer : Longint;
  42.     procedure Print(const s: string);
  43.   end;
  44.  
  45. var
  46.   Console: TConsole;
  47.  
  48. implementation
  49.  
  50. {$R *.DFM}
  51.  
  52. uses MiscUtil;
  53.  
  54. procedure TConsole.Print(const s: string);
  55. begin
  56.   with Listbox do begin
  57.     Items.Add(s);
  58.     ItemIndex := Items.Count-1;
  59.   end;
  60. end;
  61.  
  62. function TConsole.StartTimer : Longint;
  63. begin
  64.   TimeMark := GetTimerCount;
  65.   Result := TimeMark;
  66. end;
  67.  
  68.  
  69. function TConsole.StopTimer : Longint;
  70. begin
  71.   Result := GetTimerCount;
  72.   Print(IntToStr(Result - TimeMark));
  73. end;
  74.  
  75. procedure TConsole.WMSysCommand(var Msg : TWMSysCommand);
  76. begin
  77.   if Msg.CmdType = SC_CLOSE then Exit;
  78.   inherited;
  79. end;
  80.  
  81.  
  82. initialization
  83.   Console := TConsole.Create(Application);
  84. end.
  85.