/*
 * Copyright 1990 by Baylor College of Medicine ALL RIGHTS RESERVED. 
 *
 * This program is subject to a license agreement between 
 * Baylor College of Medicine and MIT. Any use inconsistent with
 * said license and any use by persons other than the faculty, 
 * students and staff at MIT or any use on a computer not operated 
 * as part of the Athena Computing Environment (ACE) is expressly 
 * prohibited.
 */
/*******************************************************************************
* SYSTEM...: Virtual Notebook System
*
* MODULE...: pagelist.h
*
* PURPOSE..:
*   provide the data structures and functions to allow for the manipulation
*   of a pagelist/objectlist created to be sent to the VNS printing utility for
*   printing 
*
* TAG: PLL 
*
* REVISIONS:
*   Ross Dargahi                December 1990 Initial Coding
*
*******************************************************************************/

/*check to see if this header file has been previously included*/

#ifndef PAGELIST_H
#define PAGELIST_H

/*******************************************************************************
Include Files
*******************************************************************************/



/*******************************************************************************
Public Defines
*******************************************************************************/



/*******************************************************************************
Public Data Structures
*******************************************************************************/

typedef enum item_e  /*defines item to work on*/
{
  PLL_OBJECT,
  PLL_PAGE
} PLL_ITEM_E;

typedef enum position_e  /*absolute & relative list indexing*/
{
  PLL_FIRST = -4,
  PLL_LAST,
  PLL_NEXT,
  PLL_PREVIOUS
} PLL_POSITION_E;

typedef enum retCode_e
{
  PLL_NULLPAGELIST = -4,   /*no such handle exists*/
  PLL_EMPTYPAGELIST,       /*no pages in the specified page list*/
  PLL_EMPTYOBJLIST,        /*no objects in the specified object list*/
  PLL_NOSUCHITEM,          /*no such obj or page to goto*/
  PLL_OK,                  /*values 0> errors values 0< informational*/
  PLL_ATBEGOFOBJLIST,      /*at the beginning of object list for current page*/ 
  PLL_ATBEGOFPAGELIST,     /*at the beginning of the specified page list*/
  PLL_ATENDOFOBJLIST,      /*at the end of object list for current page*/
  PLL_ATENDOFPAGELIST      /*at the end of the specified page list*/
} PLL_RETCODE_E;

typedef struct listData_s  /*for passing data to and from functions*/
{
  int nid;  /*notebook id*/	
  int pid;  /*page id*/
  int oid;  /*object id*/
} PLL_LISTDATA_S;

/*******************************************************************************
External variable check
*******************************************************************************/

#ifdef PAGELIST_C
#define PUBLIC
#else
#define PUBLIC extern
#endif

/*******************************************************************************
Public Global Declarations
*******************************************************************************/



/*******************************************************************************
************************   PUBLIC FUNCTION PROTOTYPES   ************************
*******************************************************************************/

PUBLIC char *PLLcreate(/*void*/);

/*creates a handle that points to a header block for the page list*/

/*----------------------------------------------------------------------------*/
PUBLIC PLL_RETCODE_E 
PLLdelete(/*char       *handle,  handle to a page list created by PLLcreate
            PLL_ITEM_E type,     /*work with an OBJECT or PAGE list*/);

/*deletes the current object or page as specified by <type>. It then always
tries to set the current pointer to be the next item in the list, if there is
no next item it tries to set it to the previous item, if it does not exist the
list is empty. If a page that contains an object list is deleted then all the
objects on that page ARE ALSO DELETED*/

/*----------------------------------------------------------------------------*/
PUBLIC PLL_RETCODE_E
PLLgetData(/*char           *handle,  handle to a page list created by PLLcreate
             PLL_ITEM_E     type,     work with an OBJECT or PAGE list
             PLL_LISTDATA_S *data     data to work with*/);

/*Gets object or page data from the current position*/

/*----------------------------------------------------------------------------*/
PUBLIC PLL_RETCODE_E
PLLgoto(/*char           *handle,  handle to a page list created by PLLcreate
          PLL_ITEM_E     type,     work with an OBJECT or PAGE list
          PLL_LISTDATA_S *data     data to work with*/);

/*goes to the specified page in a page list or object in a page object list. Can
go to the first, last, next or previous items in a list if so desired*/

/*----------------------------------------------------------------------------*/
PUBLIC PLL_RETCODE_E PLLinsert(
 /*char           *handle,     handle to a page list created by PLLcreate
   PLL_ITEM_E     type,        insert an object or a page
   PLL_LISTDATA_S *data,       data values to insert into the list
   PLL_POSITION_E position,    position to insert at
   BOOLEAN        setCurrent,  T: make new node the current one*/);

/*inserts an item (page or object) into the list at the specified location*/

/*----------------------------------------------------------------------------*/
PUBLIC PLL_RETCODE_E 
PLLkillList(/*char **handle  handle to the page list to kill*/);

/*completely deletes a page list. This includes removing the pages, the objects
and setting the handle to NULL*/

/******************************************************************************/
#define PUBLIC
#endif
