Google
 

Trailing-Edge - PDP-10 Archives - BB-JF18A-BM - sources/diu/diudeb.req
There are 4 other files named diudeb.req in the archive. Click here to see a list.
!	COPYRIGHT (C) DIGITAL EQUIPMENT CORPORATION 1986.
!	ALL RIGHTS RESERVED.
!
!	THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY  BE  USED  AND
!	COPIED ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH
!	THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.   THIS  SOFTWARE  OR
!	ANY  OTHER  COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE
!	AVAILABLE TO ANY OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE
!	SOFTWARE IS HEREBY TRANSFERRED.
!
!	THE INFORMATION IN THIS SOFTWARE IS  SUBJECT  TO  CHANGE  WITHOUT
!	NOTICE  AND  SHOULD  NOT  BE CONSTRUED AS A COMMITMENT BY DIGITAL
!	EQUIPMENT CORPORATION.
!
!	DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR  RELIABILITY  OF
!	ITS SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL.
!
!  DIUDEB.REQ

!++
! FACILITY:	PAT Parser
!
! ABSTRACT:
!
!	DEB.REQ is the specification for some internal PAT parser
!	debugging facilities.  (Also PATDEB.REQ).
!
! ENVIRONMENT:	VAX/VMS user mode
!
! AUTHOR:  C. Mitchell, CREATION DATE:  19-Feb-80
!
! MODIFIED BY:
!
!  253  Rename file to DIUDEB.
!       Gregory A. Scott 1-Jul-86
!
! 003 - C. Richardson 13-Aug-85
!
!	Allow debug compilation without debug output.
!
! 002 - C. Richardson 25-May-84 Remove VMS dependencies.
!
! C. Mitchell, 25-Jul-1983, Take out %if PATBLSEXT_DEBUGGING around
!			specs so will compile without /DEB.
!
!--

require 'DIUPATREQPRO';

library 'BLI:XPORT';                    ! 002

%IF %BLISS (BLISS36)				! 002
%THEN						! 002
macro						! 002
DEB_EVENT_TRACE		=	DEBETR %,	! 002
DEB_EVENT_BREAK		=	DEBEBR %;	! 002
%FI						! 002

external
    DEB_EVENT_TRACE,				! If true, display debugging output
    DEB_EVENT_BREAK;				! If true display and break on each debugging output
! Debugging I/O Macros


! PUT_MSG moves a quoted string to the debug output line buffer.
! For example:
!
!	PUT_MSG ('Skipping symbol ');

macro
    PUT_MSG (QUOTED_STR) =
	begin								! 002
	local d: $str_descriptor ();					! 002
	$str_desc_init (descriptor=d,					! 002
! used to be string=quoted_str, but this generated an xport bug!!
	    string = (%charcount(quoted_str), ch$ptr(uplit(quoted_str))));! 002
! force the length into the descriptor!
	d [STR$H_LENGTH] = %charcount (quoted_str);			! 002
	put_string (d);							! 002
	end %;								! 002

! PUT_MSG_EOL moves a quoted string to the debug output line buffer and
! writes it out.

macro
    PUT_MSG_EOL (QUOTED_STR) =
	begin
	PUT_MSG (QUOTED_STR);
	PUT_EOL ();
	end
    %;

! PUT_ASCII moves an ASCII string to the debug output line buffer.
!
! PARAMETERS:
!
!	LEN	- string length
!
! 002	REF_STR	- address of the string text (byte pointer)
!

macro
    PUT_ASCII (LEN, REF_STR) =
	begin
	local
	    D: $str_descriptor ();					! 002
	$str_desc_init (descriptor=d, string=(len, ref_str));		! 002
	PUT_STRING (D);							! 002
	end
    %;
! Debugging I/O Routines.


%IF %BLISS (BLISS36)						! 002
%THEN								! 002
macro								! 002
PUT_STRING			=	PUTSTR %;		! 002
%FI								! 002

external routine
    PUT_STRING : novalue;

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine moves a character string to the debug output
!	buffer.
!
! FORMAL PARAMETERS:
!
!	S	- Address of a static string descriptor
!
!--
%IF %BLISS (BLISS36)						! 002
%THEN								! 002
macro								! 002
PUT_NUMBER				= PUTNUM %;		! 002
%FI								! 002

external routine
    PUT_NUMBER : novalue;

!++
! FUNCTIONAL DESCRIPTION:
!
!	PUT_NUMBER moves the ASCII representation of an integer value
!	to the debug output line buffer.
!
! FORMAL PARAMETERS:
!
!	NUMBER	- integer value.
!
! IMPLICIT INPUTS:
!
!	NONE
!
! IMPLICIT OUTPUTS:
!
!	NONE
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	NONE
!
!--
%IF %BLISS (BLISS36)						! 002
%THEN								! 002
macro								! 002
PUT_EOL				=	PUTEOL %;		! 002
%FI								! 002

external routine
    PUT_EOL : novalue;

!++
! FUNCTIONAL DESCRIPTION:
!
!	PUT_EOL writes the debug output line buffer and then clears it.
!
! FORMAL PARAMETERS:
!
!	NONE
!
! IMPLICIT INPUTS:
!
!	NONE
!
! IMPLICIT OUTPUTS:
!
!	NONE
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	NONE
!
!--
%IF %BLISS (BLISS36)						! 002
%THEN								! 002
macro								! 002
PUT_HEX_LONG			= PUTHEX %;			! 002
%FI								! 002

external routine
    PUT_HEX_LONG : novalue;

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine moves the HEX or OCTAL representation of a long word to
!	the debug output line buffer.
!
! FORMAL PARAMETERS:
!
!	NONE
!
! IMPLICIT INPUTS:
!
!	NONE
!
! IMPLICIT OUTPUTS:
!
!	NONE
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	NONE
!
!--
%IF %BLISS (BLISS36)						! 002
%THEN								! 002
macro								! 002
PUT_LINE_FULL			=	PUTLNF %;		! 002
%FI								! 002

external routine
    PUT_LINE_FULL;

!++
! FUNCTIONAL DESCRIPTION:
!
!	PUT_LINE_FULL checks if the addition of NUM_CHAR characters to
!	the debug output line buffer would overflow the line.
!
! FORMAL PARAMETERS:
!
!	NUM_CHAR	- Number of characters in next item to be output.
!
! IMPLICIT INPUTS:
!
!	NONE
!
! IMPLICIT OUTPUTS:
!
!	NONE
!
! ROUTINE VALUE:
!
!	TRUE	- if they won't fit.
!	FALSE	- if they will.
!
! SIDE EFFECTS:
!
!	NONE
!
!--
%IF %BLISS (BLISS36)						! 002
%THEN								! 002
macro								! 002
PUT_START_AUTOEOL		= PUTSTA %;			! 002
%FI								! 002

external routine
    PUT_START_AUTOEOL : novalue;

!++
! FUNCTIONAL DESCRIPTION:
!
!	Start writing the debug output buffer automatically when it
!	is full.  Parameters specify the number of columns to
!	indent when a new line is started automatically and a
!	separator that can be used to automatically insert ", "
!	between each item in a list.
!
! FORMAL PARAMETERS:
!
!	INDENT		- Number of columns to indent when a new line
!			  is started.
!
!	SEPARATOR_LEN	- Length of separator.
!
!	SEPARATOR_PTR	- Text of separator.
!
! IMPLICIT INPUTS:
!
!	NONE
!
! IMPLICIT OUTPUTS:
!
!	NONE
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	Automatic end-of-line's will continue until PUT_END_AUTOEOL
!	is called.
!
!--
%IF %BLISS (BLISS36)						! 002
%THEN								! 002
macro								! 002
PUT_END_AUTOEOL			=	PUTENA %;		! 002
%FI								! 002

external routine
    PUT_END_AUTOEOL : novalue;

!++
! FUNCTIONAL DESCRIPTION:
!
!	PUT_END_AUTOEOL stops automatic end-of-line's.
!
! FORMAL PARAMETERS:
!
!	NONE
!
! IMPLICIT INPUTS:
!
!	NONE
!
! IMPLICIT OUTPUTS:
!
!	NONE
!
! ROUTINE VALUE:
!
!	NONE
!
! SIDE EFFECTS:
!
!	NONE
!
!--
! Misc. debugging routines and internal errors


%IF %BLISS (BLISS36)						! 002
%THEN								! 002
macro								! 002
DEB_SIGNAL_DEBUG		=	DEBSGD %;		! 002
%FI								! 002

external routine
    DEB_SIGNAL_DEBUG : novalue;

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine signals SS$_DEBUG to invoke DEBUG-32.
!--
! DEB_ASSERT is called to make an internal consistency check.
! This macro is only expanded if compiling with the debug
! switch on.
!
! Parameters:
!
!	CONDITION	- Condition asserted to be true.
!
!	MESSAGE		- Message to be written if CONDITION
!			  is not true.
! 002			  Quoted string or string descriptor.
!
!	%remaining	- Optional list of expressions to be
!			  to be executed if CONDITION is not
!			  true.
!
! Example of use:
!
!	DEB_ASSERT (.XXX leq MAX, 'XXX is too big',
!		PUT_MSG ('XXX = '),
!		PUT_NUMBER (.XXX),
!		PUT_EOL ());
!

macro
    DEB_ASSERT (CONDITION, MESSAGE) =
	begin
	%if PATBLSEXT_DEBUGGING
	%then
	    if (CONDITION)
	    then
		0
	    else
		begin
		%if %isstring (MESSAGE)
		%then
		    local d: $str_descriptor (string = message);	! 002
		%else
		    bind
			map message: ref $str_descriptor ();		! 002
			bind d=message;					! 002
		%fi
		%if PATBLSEXT_DEBUGGING
		%then
		    PUT_MSG ('Assert error in parser:  ');
		    PUT_STRING (d);					! 002
		    DEB_EXPAND_EXPRS (%remaining)	! Expand the list of expressions
		    PUT_EOL();
		    DEB_SIGNAL_DEBUG ();
		%fi
		end
	    %else
	    0
	%fi
	end
    %;

macro
    DEB_EXPAND_EXPRS (EXPR) [] =
	EXPR;
	DEB_EXPAND_EXPRS (%remaining) %;
! Debugging Events
!
! 	Conditionally compiled and conditionally executed debugging code.

! DEB_EVENT provides the ability to display debugging info.
! This can be done by setting DEB_EVENT_TRACE or
! DEB_EVENT_BREAK to the value 1.  If DEB_EVENT_BREAK is
! set, DEBUG-32 is signalled at each event after the display.
!
! The Ada compiler has a more complete version that permits
! trace/break points on particular events.
!
! Parameters:
!
!	Q_EVENT_NAME	- Quoted string that identifes the event.
!
!	%remaining	- List of expressions to be executed when
!			  tracing the event.
!
! Example of use:
!
!	DEB_EVENT ( 'PAR_LEX_TOKEN'
!	    PUT_MSG_EOL ('Creating lexical token'),
!	    PAR_DUMP_TOKEN ());

macro
    DEB_EVENT (Q_EVENT_NAME) =
	%if PATBLSEXT_DEBUGGING
	%then
	    begin
	    local
		ev: $str_descriptor (string=q_event_name),		! 002
		S;
	    if .DEB_EVENT_TRACE or .DEB_EVENT_BREAK
	    then
		begin
		DEB_EXPAND_EXPRS (%remaining)
		end;				! Expand the expression list
	    if .DEB_EVENT_BREAK then DEB_SIGNAL_DEBUG ();
	    end
	%fi
    %;


! End of DEB.REQ