NET/MASTER Network Control Language (NCL) Programmer's Guide

Examples Used to Illustrate DEBUG Commands
Debugging an NCL Process
9–14 106160 Tandem Computers Incorporated
EXIT
/**************************** TOP_TITLE *****************************/
/* The top_title function returns the top and bottom lines of the */
/* histogram. The line shows the number of words having a certain */
/* number of characters. The line looks like this: */
/* ---| 1 | 2 | */
/* and so on to the value of MAX_WORDS. */
/********************************************************************/
top_title: FUNCTION
DO &i = 1 TO MAX_WORDS
/* Is a plus sign (+) needed? */
IF &i = MAX_WORDS THEN
&plus = '+'
ELSE
&plus = ' '
/* Construct title line */
&line = &line || OVERLAY( &i || &plus, ' |', 2, 3, ' ', R )
END
/* Return title line with leading hyphens (-) */
RETURN( copies( '-', length( MAX_CHARS ) + 2 ) || '| ' || &line )
END top_title
/*************************** LEFT_TITLE *****************************/
/* The left_title function returns the left part of each bar of the */
/* histogram. This part of the histogram shows the number of */
/* characters for each word. The left part looks like this: */
/* 1 | */
/* 2 | */
/* and so on to the value of MAX_CHARS. */
/********************************************************************/
left_title: FUNCTION
/* Is a plus sign (+) needed? */
IF &1 = MAX_CHARS THEN
&plus = '+'
ELSE
&plus = ' '
/* Return left part of bar */
RETURN( OVERLAY( &1 || &plus, '', 1, LENGTH( MAX_CHARS )+1, ' ', R ) )
END left_title
/****************************** BAR *********************************/
/* The bar function returns the right part of each bar of the */
/* histogram. This part of the histogram shows the number of words */
/* having a certain number of characters using a bar constructed */
/* with asterisks (*). The right part looks like this: */
/* ***** */
/* and so on to the number of words with that number of characters. */
/********************************************************************/
bar: FUNCTION
IF &1 = 0 THEN
RETURN( '' )
/* Construct bar */
RETURN( COPIES( '*****', MIN( &1, MAX_WORDS ) ) )
END bar
END zex0902n