home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / devtools / dataflex / traceobj.pkg < prev    next >
Encoding:
Text File  |  1993-08-10  |  4.4 KB  |  149 lines

  1. //************************************************************************
  2. //
  3. // Copyright 1987-1992 Data Access Corporation, Miami FL, USA
  4. // All Rights reserved
  5. // DataFlex is a registered trademark of Data Access Corporation.
  6. //
  7. //
  8. //     $Source: /u3/source.30/product/pkg/RCS/traceobj.pkg,v $
  9. //     $Revision: 1.1 $
  10. //     $State: Exp $
  11. //     $Author: james $
  12. //     $Date: 1992/09/08 14:43:10 $
  13. //     $Locker:  $
  14. //
  15. //     $Log: traceobj.pkg,v $
  16. //Revision 1.1  1992/09/08  14:43:10  james
  17. //Initial revision
  18. //
  19. //Revision 1.5  92/05/29  14:41:27  lee
  20. //moved trace keys (again) to Alt+F3 for on/off and Ctrl+F3 for move.
  21. //
  22. //Revision 1.4  92/05/22  23:08:08  steve-l
  23. //Changed trace-toggling key from Shift+F10 to Alt+F10 (Shift+F10 will
  24. //be the kADD default) and replaced tabs in source file with spaces.
  25. //
  26. //Revision 1.3  92/05/14  17:10:00  SWM
  27. //Updated Copyright slug.
  28. //
  29. //Revision 1.2  92/03/09  19:05:19  james
  30. //Added #CHKSUB directive to insure source
  31. //only compiled with correct revision of 
  32. //compiler.
  33. //
  34. //Revision 1.1  91/10/23  10:23:01  elsa
  35. //Initial revision
  36. //
  37. //************************************************************************/
  38.  
  39. //************************************************************************
  40. //     File Name: TraceObj.Pkg
  41. // Creation Date: January 1, 1991
  42. // Modified Date: June 21, 1991
  43. //     Author(s): Steven A. Lowe
  44. //
  45. // This module contains the vTrace class definition, and an instance
  46. // of it named aTracer.
  47. //
  48. // It also defines global keys to toggle tracing on and off and to change
  49. // the position from the bottom of the screen to the top of the screen and
  50. // vice-versa.  In addition, the global indicator TRCON is defined to reflect
  51. // whether tracing is on or off.
  52. //************************************************************************/
  53.  
  54. #CHKSUB 1 1 // Verify the UI subsystem.
  55.  
  56. USE UI
  57.  
  58.  
  59. //
  60. // This preprocessor command forces the compiler to retain symbols
  61. //
  62. #SYM
  63.  
  64.  
  65. //
  66. // vtrace class writes output to sequential file ATRACER.TRC so that
  67. // a crash or reboot won't destroy the output file content.
  68. //
  69. class atracer is a trace
  70.   procedure construct_object
  71.     local integer rowcol
  72.     forward send construct_object
  73.     property integer Tracing_State public FALSE
  74.     property integer trow          public 0
  75.     property integer tcol          public 0
  76.     property integer tref          public 0
  77.     property integer file_empty    public TRUE
  78.     property string  file_name     public (module_name(desktop)+".TRC")
  79.     get location to rowcol
  80.     set trow to (hi(rowcol))
  81.     set tcol to (low(rowcol))
  82.     set tref to (hi(rowcol))
  83.   end_procedure
  84.   procedure insert string astr
  85.     local string modname
  86.     get file_name to modname
  87.     showln astr
  88.     if (file_empty(current_object)) begin
  89.       direct_output modname
  90.       set file_empty to false
  91.     end
  92.     else append_output modname
  93.     writeln astr
  94.     close_output
  95.   end_procedure
  96.   procedure key integer val
  97.   end_procedure
  98.   procedure Toggle_Tracing_State
  99.     if (Tracing_State(current_object)) begin
  100.       set Tracing_State to FALSE
  101.       send trace_Switch false false
  102.     end
  103.     else begin
  104.       set Tracing_State to TRUE
  105.       send trace_Switch true false
  106.     end
  107.   end_procedure
  108.   procedure Toggle_Location
  109.     local integer row col ref wason
  110.     get Tracing_State to wason
  111.     if wason send trace_Switch false false
  112.     get trow to row
  113.     get tcol to col
  114.     get tref to ref
  115.     move (ref - row) to row
  116.     set trow to row
  117.     set location to row col
  118.     if wason send trace_Switch true false
  119.   end_procedure
  120. end_class
  121.  
  122. //
  123. // an instance of the vtrace class which sets a global indicator TRCON
  124. // to reflect whether tracing is on or off.  TRCON may be used by
  125. // developers to guard debugging code.
  126. //
  127. object atracer is an atracer
  128.   indicator trcon
  129.   indicate trcon false
  130.   procedure set Tracing_State integer newval
  131.     forward set tracing_state to newval
  132.     indicate trcon as (newval = true)
  133.   end_procedure
  134. end_object
  135.  
  136. //
  137. // desktop (global) keys to toggle tracing and position
  138. //
  139. on_key key_alt+key_f3 send Toggle_Tracing_State to atracer
  140. on_key key_ctrl+key_f3 send Toggle_Location to atracer
  141.  
  142. //
  143. // The symbols KickMe, MoveMe, and IMON are defined for historical reasons.
  144. //
  145. #REPLACE KickMe Toggle_Tracing_State
  146. #REPLACE MoveMe Toggle_Location
  147. #REPLACE IMON   TRCON
  148.  
  149.