home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / pascal / visionix / vdebugu.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-12-23  |  3.1 KB  |  184 lines

  1. {
  2.  ════════════════════════════════════════════════════════════════════════════
  3.  
  4.  Visionix DEBUG Unit
  5.    Version 0.13
  6.  Copyright 1991,92,93 Visionix
  7.  ALL RIGHTS RESERVED
  8.  
  9.  ────────────────────────────────────────────────────────────────────────────
  10.  
  11.  Revision history in reverse chronological order:
  12.  
  13.  Initials  Date      Comment
  14.  ────────  ────────  ────────────────────────────────────────────────────────
  15.  
  16.  jrt       11/15/93  First logged version.
  17.  
  18.  --------------------------------------------------------------------------
  19.  
  20.  ════════════════════════════════════════════════════════════════════════════
  21. }
  22.  
  23. (*-
  24.  
  25. [TEXT]
  26.  
  27. <Overview>
  28.  
  29. This unit provides a simple set a functions which can be used to debug
  30. a program.  It provides functions to write "information" lines to a
  31. specified text file.
  32.  
  33.  
  34. -*)
  35.  
  36. Unit VDebugu;
  37.  
  38. Interface
  39.  
  40. Uses
  41.  
  42.   DOS;
  43.  
  44. (*-
  45.  
  46. [TEXT]
  47.  
  48. <About this unit>
  49.  
  50. This unit provides a simple set a functions which can be used to debug
  51. a program.  It provides functions to write "information" lines to a
  52. specified text file.
  53.  
  54.  
  55.  
  56. -*)
  57.  
  58.  
  59. Var
  60.  
  61.   DebugFile : TEXT;
  62.   DebugStr  : STRING;
  63.   DebugLvl  : WORD;
  64.  
  65.  
  66.  
  67. Procedure DebugOpen( FName : STRING );
  68. Procedure DebugFlush;
  69. Procedure DebugClose;
  70.  
  71. Procedure DebugBegin;
  72. Procedure DebugEnd;
  73.  
  74. Procedure DebugWrite(   S : STRING );
  75. Procedure DebugWriteLn( S : STRING );
  76.  
  77.  
  78. {────────────────────────────────────────────────────────────────────────────}
  79.  
  80.  
  81. Implementation
  82.  
  83.  
  84.  
  85.  
  86. {────────────────────────────────────────────────────────────────────────────}
  87.  
  88. Procedure DebugOpen( FName : STRING );
  89.  
  90. Var
  91.  
  92.   err : word;
  93.  
  94. BEGIN
  95.  
  96.   Assign( DebugFile, FName );
  97.   Rewrite(  DebugFile );
  98.  
  99.   DebugStr := '';
  100.  
  101.   DebugLvl := 0;
  102.  
  103. END;
  104.  
  105. {────────────────────────────────────────────────────────────────────────────}
  106.  
  107. Procedure DebugFlush;
  108.  
  109. BEGIN
  110.  
  111.   Flush( DebugFile );
  112.  
  113. END;
  114.  
  115. {────────────────────────────────────────────────────────────────────────────}
  116.  
  117. Procedure DebugClose;
  118.  
  119. BEGIN
  120.  
  121.   Close( DebugFile );
  122.  
  123. END;
  124.  
  125. {────────────────────────────────────────────────────────────────────────────}
  126.  
  127. Procedure DebugBegin;
  128.  
  129. BEGIN
  130.  
  131.   Inc( DebugLvl );
  132.  
  133.   DebugStr := DebugStr + '  ';
  134.  
  135. END;
  136.  
  137. {────────────────────────────────────────────────────────────────────────────}
  138.  
  139. Procedure DebugEnd;
  140.  
  141. BEGIN
  142.   If DebugLvl>0 Then
  143.   BEGIN
  144.     Dec( DebugLvl );
  145.     DebugStr := Copy( DebugStr, 1, Length(DebugStr)-2 );
  146.   END;
  147. END;
  148.  
  149. {────────────────────────────────────────────────────────────────────────────}
  150.  
  151. Procedure DebugWrite( S : STRING );
  152.  
  153. BEGIN
  154.  
  155.   Write( DebugFile, DebugStr+S );
  156.   Close( DebugFile);
  157.   Append( DebugFile        );
  158.  
  159. END;
  160.  
  161. {────────────────────────────────────────────────────────────────────────────}
  162.  
  163. Procedure DebugWriteLn( S : STRING );
  164.  
  165. BEGIN
  166.  
  167.   WriteLn( DebugFile, DebugStr+S );
  168.    Close( DebugFile);
  169.   Append( DebugFile        );
  170.  
  171.  
  172. END;
  173.  
  174. {────────────────────────────────────────────────────────────────────────────}
  175. {────────────────────────────────────────────────────────────────────────────}
  176. {────────────────────────────────────────────────────────────────────────────}
  177.  
  178.  
  179. BEGIN
  180.  
  181.  
  182. END.
  183.  
  184.