
/****************************************************************************/

/*  Module PNLXVALC.C 

    Copyright 1986 Roundhill Computer Systems Limited
    All rights reserved

    Use and disclosure of this code are prohibited unless in accordance
    with the terms of the PANEL software licence.

    ************************************************************************
    *** THE OBJECT CODE VERSION OF THIS MODULE IS INCLUDED IN THE PANEL  ***
    *** LIBRARY.  IF YOU AMEND AND COMPILE THIS MODULE AND LINK IT WITH  ***
    *** YOUR APPLICATION IT WILL SUPERSEDE THE LIBRARY VERSION.          ***
    ************************************************************************

    PANEL:  Type 4          : General Validation
            Source Language : C

    Modification History (Push-Down List):  

            28.12.85        : Convert for table-driven operation

******************************************************************************/

#include <pnl4.h>

int PARDHI = 0;             /* highlight code to be used for each field read */

extern int (*PAXVTB[])();   /* general validation function table */
extern int PAXVPM;          /* max index into function table */

/****************************************************************************/

int PAXVAL(fn,fp)

/*  PAXVAL is a general-purpose exit which is called before and after each
    field operation by routines readpa and looppa which process a complete
    panel.  The passed function number is positive before the function is
    processed, negative afterwards.
    
    Here's where to put in routines which change fields before display: for
    example displaying the system date.  

    Note that PACRF does NOT contain the current field on this exit.  The
    current field control block is referenced by fp.  Remember that it may be 
    either a full or an abbreviated fcb. (The latter if (abbr & fp->sa)).

******************************************************************************/

int fn;
panfcb *fp;

{
    (*PAXVTB[0])(fn,fp);    /* do nothing, or perhaps do HP150 touch process */
    if ( (fn == 2) && (UCI(fp->charvaln) == 8) ) /* special for toggle */
        {
        (*PAXVTB[2])(fn,fp);    /* do toggle list initialise if defined */
        }
    if (PARDHI)             /* highlighting on each field read required */
        {
        (*PAXVTB[1])(fn,fp);    /* do PARDHI process */
        }
    (*PAXVTB[3])(fn,fp);    /* do date display */
    return(0);              /* clean return value */
}

