dabbel_h

/*
**	Copyright 2014-2017, Fermi Research Alliance, LLC.  All rights reserved.
*/
/******************************************************************************/
/* dabbel.h
**
**	function prototypes and defined constants for argument values for
**	routines to interface with DABBEL
**
**	V0.0	G Johnson / Accelerator Controls		05-Aug-14
**	Created
**
*/
/******************************************************************************/

#ifndef DABBEL_DEFINED		/* do this only once */
#define DABBEL_DEFINED

/******************************************************************************/
/*
**	structure definitions
*/
/******************************************************************************/

typedef struct DABBEL_RETURN_DATA	/* Dabbel return data */
    {
    int last_syntax_error;	/* Most-recent syntax error or zero */
    ulong last_dbl_status;	/* Most-recent DBL error or zero */
    int count_added;		/* count of devices added */
    int count_changed;		/* count of devices having name change */
    int count_deleted;		/* count of devices deleted */
    int count_modified;		/* count of devices modified */
    int count_obsoleted;	/* count of devices obsoleted */
    int count_restored;		/* count of devices restored */
    int count_documented;   	/* count of devices documented */
    int count_undocumented; 	/* count of devices un-documented */
    int count_commented;	/* count of device comments written */
    char fast_ftd;		/* Boolean: TRUE if ftd > 1 Hz seen */
    char never_save;		/* Boolean: TRUE if NEVER_SAVE seen */
    char notyet_seen; 		/* Boolean: TRUE if WARN_NOTYET seen */
    char nullpdb_seen; 		/* Boolean: TRUE if NULL PDB created */
    char dupssdn_seen; 		/* Boolean: TRUE if duplicate SSDN seen */
    char anymods;		/* Boolean: TRUE if any DB mods seen */
    } __attribute__((packed)) DABBEL_RETURN_DATA;

typedef struct DABBEL_READ_SET_PDB_DATA	/* data needed to format a read/set PDB line */
    {
    int		primary_transform;	/* primary transform index */
    int		common_transform;	/* common transform index */
    int		scaling_length;		/* scaling length */
    char	primary_units_text[LEN_DEV_UNITS+2];	/* primary units text */
    char	common_units_text[LEN_DEV_UNITS+2];	/* common units text */
    int		default_display_notation;	/* default display notation */
    int		default_display_length;		/* default display length */
    int		is_motor_controller;	/* flag inidicating if this is a motor controller device */
    int		num_constants;		/* number of constants present */
    double	constants[DIO_PDB_EXT_MAX_CONSTANTS];	/* scaling constants */
    int		include_minimum_value;	/* flag indicating whether or not to include a minimum value */
    double	minimum_value;		/* scaled minimum value */
    int		include_maximum_value;	/* flag indicating whether or not to include a maximum value */
    double	maximum_value;		/* scaled maximum value */
    } __attribute__((packed)) DABBEL_READ_SET_PDB_DATA;

/******************************************************************************/
/*
**	miscellaneous definitions
*/
/******************************************************************************/

#define MAX_FILE_LEN	100		/* Max filespec len (incl NUL) */
#define DAB_SYNTAX	0		/* Run type: Syntax */
#define DAB_LIST	1		/* Run type: List   */
#define DAB_MODIFY	2		/* Run type: Modify */
#define DAB_DEFAULT_LOG	0		/* Log flag: Default */
#define DAB_NOLOG	1		/* Log flag: No Log  */
#define DAB_LOG		2		/* Log flag: Log     */

/******************************************************************************/
/*
**	returned status definitions
*/
/******************************************************************************/

#define	DAB_OK		0	/* Success */
#define DAB_SOME_ERROR	1	/* Some DBL/SYNTAX error occurred */
#define DAB_NOINFILE	2	/* Cannot open the input file */
#define DAB_CLXSRV	20	/* Cannot run on node CLXSRV */
#define DAB_LISFILE	22	/* Cannot open the listing file */
#define DAB_BADUSER	23	/* Illegal user name */
#define DAB_LOGFILE	24	/* Cannot open the LOG file */
#define DAB_IFILETYP	25	/* Illegal input file type */
#define DAB_LOCFILE	26	/* Cannot open the location file */
#define DAB_OUTFILE	27	/* Cannot open the .OUT file */
#define DAB_POUTFILE	28	/* Cannot write to the .OUT file */

/*
 Rarely occurring exception codes begin at +100
*/
#define DAB_CRVMZONE	100	/* Failure to create virtual memory zone */
#define DAB_RSVMZONE	101	/* Failure to reset virtual memory zone */
#define DAB_FRVMZONE	102	/* Failure to free virtual memory zone block */
#define DAB_GTVMZONE	103	/* Failure to get virtual memory zone block */
#define DAB_REMQUE	104	/* Failure on LIB_REMQUE */
#define DAB_INSQUE	105	/* Failure on LIB_INSQUE */
#define DAB_UFILENAM	106	/* Failure to determine unique filenames */
				/*   for .out and .log files             */

/******************************************************************************/
/* 
**	function prototype typedefs
*/
/******************************************************************************/

int dabbel(char *filespec, char *filespec_lis, char *user_name,
	   int run_type, int log_flag, char print_stdout,
	   char print_stderr, DABBEL_RETURN_DATA *ret_data);
int dabbel_format_read_set_pdb_line_c(short property,
				      DABBEL_READ_SET_PDB_DATA *pdb_data,
				      int max_return,
				      char *dabbel_line=(char *) NULL);

#endif