/**---------------------------------------------------------------------------
 ** 
 ** manip.h -- 
 ** 
 ** Author          : Pierre Jaccard
 ** Created On      : 1999/07/15 22:29:34
 ** Last Modified By: Pierre Jaccard
 ** Last Modified On: 1999/07/16 19:36:08
 ** Update Count    : 6
 ** Directory       : /home/pego/pcd1/codas3c/gfi/src/libs/db/
 ** Version         : 0.0
 ** Status          : Unknown
 ** ---------------------------------------------------------------------- ** 
 ** DESCRIPTION: 
 ** 
 **    See associated file manip.c
 **
 **    These file defines in addition CODAS error filters to cancel
 **    unnecessary CODAS error messages, such as those generated by seeking 
 **    databases.   
 ** 
 ** ---------------------------------------------------------------------- ** 
 ** REVISIONS: 
 ** ---------------------------------------------------------------------- ** 
 ** CHANGES: 
 **------------------------------------------------------------------------**/

#ifndef gfilib_db_manip_already_included
#define gfilib_db_manip_already_included

#include "geninc.h"
#include "dbglo.h"
#include "ioserv.h"

/* 
	 The following macros are used to test if the returned error status
   is related to end or beginning of database
	 */
#define db_eof(x)      (((x) && ((x) == (SEARCH_BEYOND_END))) ? \
												(x) : (0)) 
#define db_bof(x)      (((x) && ((x) == (SEARCH_BEFORE_BEGINNING))) ? \
												(x) : (0))
#define db_beof(x)     (((x) && (db_eof(x) || db_bof(x)))	? \
												(x) : (0))

/*
  The following macros are used to cancel messages about end or beginning of
  database errors
*/
#define db_not_eof(x)  (((x) && ((x) != (SEARCH_BEYOND_END))) ? \
												(x) : (0))
#define db_not_bof(x)  (((x) && ((x) != (SEARCH_BEFORE_BEGINNING))) ? \
												(x) : (0))
#define db_not_beof(x) (((x) && db_not_eof(x) && db_not_bof(x))	? \
												(x) : (0))


#if PROTOTYPE_ALLOWED

int close_blk(void);
int close_prf(void);
int open_blk(void);
int open_prf(YMDHMS_TIME_TYPE *time);
int close_db(void);
int create_db(int db_id, FILE_NAME_TYPE dbname, FILE_NAME_TYPE prdname);
int open_db(int dbid, char *dbname, int dba);
int search_db(int search_type, char *search_param);

#else

int close_blk();
int close_prf();
int open_blk();
int open_prf();
int close_db();
int create_db();
int open_db();
int search_db();

#endif  /* PROTOTYPE_ALLOWED */


#endif /* gfilib_db_manip_already_included */
