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

/*  Module PNLPSLVC.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          : Validation
            Source Language : C

    Modification History (Push-Down List):  

            28.12.85        : Separate module
            27.11.85        : Amiga save areas

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

#include <pnl4.h>

                            /* define limits for PANELS levels (for PAPSLV) */
int PAPSLO = 0;             /* lowest level to process */
int PAPSHI = 1;             /* highest level to process */
extern int PAFSVN;          /* number of field save pointers */

#ifdef AMIGA
#include <exec/types.h>
#include <graphics/gfx.h>
struct savearea {
uchar svao,svax,svay,sval,svah,sva1,sva2,sva3;
struct BitMap svbit; };
extern struct savearea PAFSVA[];
#else
extern uchar *PAFSVA[];     /* pointer array for save areas */
#endif

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

int PAPSLV(ov)

/*  PAPSLV is a utility function for PANELS, included here for reference and
    possible modification.  It returns zero if the passed overlay level number
    is to be processed by PANELS, and returns non-zero if the field at that
    level is to be skipped.
    
    Using the global symbols PAPSLO and PAPSHI you can adjust the processing
    for PANELS.  The default is to process levels zero and one only.  This 
    routine controls PASCNL as well as PANELS.

    Note that ov is taken from the fcb 'so' field.  If the field has already
    been displayed, this field will contain the index number of the pointer
    to the field save area, with its high bit set.  The first five bytes of
    the field save area contain the real overlay number, and the x,y,l,h of 
    the save block.  This is followed by the screen save elements.

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

int ov;

{
    if (ov & 0x80)              /* overlay is in progress, ov has PAFSVA # */
        {
        ov &= 0x7f;                     /* mask off high bit */
        if (ov >= PAFSVN) return 1;     /* invalid index number */ 
#ifdef AMIGA
        ov = PAFSVA[ov].svao;
#else
        ov = UCI(PAFSVA[ov][0]);        /* get saved level number */
#endif
        if (ov & 0x80) return 1;        /* should never happen ! */
        }
    return (ov < PAPSLO) || (ov > PAPSHI);
}
