/*	Title	All-Pro Diagnostics Editor Support*/
/******************************************************************************/
/*				     Diagfunc				      */
/*			       All-pro Diagnostic Functions		      */
/*									      */
/* Module ...................... DIAGFUNC				      */
/* Title ....................... All-pro Diagnostic Functions		      */
/* Developing Engineer ......... Steven T. Harr 			      */
/* Company ..................... Logical Devices			      */
/* Revision Level .............. 1.00					      */
/* Date of Last Revision ....... 02-13-87				      */
/* Last Revision by ............ STH					      */
/* Developing System .......... IBM PC or compatible			      */
/* Target System .............. IBM PC or compatible			      */
/* Language ................... C					      */
/* Compiler ................... Manx Aztec C v3.20e			      */
/* Compiler Command(s) ........ cc Diagpars				      */
/*									      */
/* Interpreter ................ none					      */
/*									      */
/* Synopsis ................... This module contains the Diagnostic Funcions  */
/*				which will be executed via execution control. */
/*									      */
/* Revision History:							      */
/*  v1.00   02-13-87		Original version - STH			      */
/*									      */
/******************************************************************************/
/*	Subttl	Includes*/
#include <stdio.h>
#include <ctype.h>
#include "cmdfile.h"
#include "keybrd.h"
#include "diag2.h"
#include "pindrivr.h"
#include "diagedit.h"

/*     Subttl  Defines*/

int current_print_line = 4;
int execution_flag;


/*     Subttl  externals */
int phys_pin_offset = 0;





/*	Subttl	function PRINT */

func_print (strng_ptr)
{
    if (execution_flag == TRUE)
    {
	crt_pos_cursor (current_print_line, 0, 0);
	printf ("%s", strng_ptr);
	if (++current_print_line > 20)
	{
	    current_print_line = 4;
	}
    }
    else
    {
	/* process function parameter(s) */
	if (strlen (strng_ptr) <64)
	{
	    return (TRUE);
	}
	else
	{
	    return (FALSE);
	}
    }
}



/*	Subttl	function WRPINDAC */
func_wrpindac (pin_num, voltage)
{
    if (execution_flag == TRUE)
    {
	write_pin_dac (pin_num, voltage);
    }
    else
    {
	/* process function parameter(s) */
	if ((pin_num >= 1) && (pin_num <= MAX_DEVICE_PINS))
	{
	    return (TRUE);
	}
	else
	{
	    return (FALSE);
	}
    }
}



/*	Subttl	function WRPINCNF */

func_wrpincnf (pin_num, state)
{

    if (execution_flag == TRUE)
    {
	phys_pin_offset = 0;
	set_pin_cnf (pin_num, state);
    }
    else
    {
	/* process function parameter(s) */

	if ((pin_num < 1) || (pin_num > MAX_DEVICE_PINS))
	{
	    return FALSE;
	}
	else
	{
	    switch (state)
	    {
		case PU_DRIVER_ON:
		case PD_DRIVER_ON:
		case GD_DRIVER_ON:
		case GD_DRIVER_ON | PU_DRIVER_ON:
		case SRC_DRIVER_ON:
		case SRC_DRIVER_ON | PU_DRIVER_ON:
		case TTL_HI_DRIVER_ON:
		case TTL_HI_DRIVER_ON | PU_DRIVER_ON:
		case TTL_LOW_DRIVER_ON:
		case TTL_LOW_DRIVER_ON | GD_DRIVER_ON:
		case DISCONNECT:
		{
		    return (TRUE);
		}
		return (FALSE);
	    }
	}
    }
}





