The current Debug routine

This code is in a file called "subroutines.rex" and is included from the main routine using ::Requires 'subroutines.rex'

-- Initialisation code
If .local~debug.state = .Nil then do						/* If we have not initialised debug	*/
  Debug.0 = 0									/* Create the stem variable		*/
  .local['DEBUG'] = debug.							/* Create pointer to it in .local	*/
  .local~debug.state = 0							/* Turn debugging off by default	*/
  End
Exit

::Routine Debug public
Parse arg text,line,email							/* Debug: Save debug data		*/
If email<>'' then if .local~owner.email=.Nil then .local~owner.email=email	/* Email to use if we hit a fatal error	*/
If text \== '' then do								/* If a non null text is passed...	*/
  D = .debug[0]+1								/* Increment the line count		*/
  If line <>  '' then .debug[D] = line text					/* Record source line and comment	*/
  Else .debug[D] = text								/* Record just the comment		*/
  .debug[0]=D									/* Save new line count			*/
  End
Else .local~debug.state = 1							/* Null comment? Turn debugging on	*/
Return