snpplt_h

/*  SNPPLT.H
c 
c  Include file for SNPPLT, the SNP plot package PA interface.
*/
/*******************************************************************************
MODIFICATION HISTORY:
 
    R Joshel	22 Apr 92
      added modification history; added _SNPPLT_H macro;
      added SNP_TC_MAIL typecode and type snp_mail_t

    [@tbs@]...
*******************************************************************************/

#ifndef _SNPPLT_H
#define _SNPPLT_H

#include "cnsparam.h"

#define SNP_REC_OFFSET	4000	/* SNP record offset in PLOTCOMM.DAT */
#define SNP_EMPTY_RECORD (SNP_REC_OFFSET + 1)

#define WIN_ROWS	5	/* number of rows in SNP window */
#define WIN_COLS	62	/* number of columns in SNP window */

#define	SNP_PLOT_NUM_STRINGS	3	/* number of plot text strings */
#define	SNP_PLOT_STRING_LEN	48	/* length of plot text strings */
#define	SNP_PLOT_MAX_EVENTS	8	/* maximum number of arm events */


typedef struct SMGR_MSG
    {
    short sm_subsys;		/* SMgr subsystem number */
    short sm_recnum;		/* SMgr record number */
    short sm_userid;		/* SMgr user ID */
    short sm_ukey1;		/* SMgr user key 1 */
    short sm_ukey2;		/* SMgr user key 2 */
    } __attribute__((packed))SMGR_MSG;

typedef struct SDA_MSG
    {
    short sda_usage;		/* SDA usage number */
    short sda_file;		/* SDA file number */
    short sda_case;		/* SDA case number */
    short sda_subcase;		/* SDA subcase number */
    } __attribute__((packed)) SDA_MSG;
       
struct MSG {			/* message sent to the plot SA */
    char typecode;		/* command typecode */
#define TC_START	1	/* start new plot command code */
#define TC_STOP		2	/* stop plot command code */
#define TC_SDA		3	/* start SDA plot command code */
#define TC_SNPMGR	4	/* start Snapshot Manager plot command code */
    char flags;			/* command flags */
#define CFLG_NOERASE	0x80	/* erase disable command flag */
    short diag_flags;		/* diagnostic flags */
    char def_lettr[2];		/* default name letter, ":" */
    char text[SNP_PLOT_NUM_STRINGS][SNP_PLOT_STRING_LEN];	/* 3 rows of 48 chars from "X=" */
    short rate_code;		/* sample rate code */
#define RATE_AUTO	1	/* AUTO sample rate */
#define RATE_EXPLICIT	2	/* User specified sample rate */
    short ref_code;		/* arm reference code */
#define REF_SUPER	1	/* Supercycle arm reference */
#define REF_MI		2	/* Main Injector arm reference */
#define REF_TEV		3	/* Tevatron arm reference */
#define REF_RR		3	/* Recycler arm reference */
#define REF_BOO		4	/* Booster arm reference */
#define REF_EVENT	5	/* Clock Events arm reference */
#define REF_EXT		6	/* External arm reference */
    short mode;			/* plot/view mode */
#define MODE_ONCE	1	/* Once mode */
#define MODE_MULT	2	/* Multiple plot mode */
#define MODE_VIEW	3	/* View mode */
#define MODE_SMGR	4	/* Snapshot manager mode */
#define MODE_SDA	5	/* SDA mode */
#define MODE_MAIL	6	/* Mail snap data mode */
    short units;		/* display units */
#define UNIT_ENGIN	1
#define UNIT_VOLTS	2
#define UNIT_LOG	3
    short opt_flg;		/* display option flags: BL-X, etc. */
#define OPT_LINES	1
#define OPT_CHARS	2
#define OPT_BLINK	4
#define OPT_FAST	8
    short dcolor[5];		/* device color codes */
    char armevt[SNP_PLOT_MAX_EVENTS];	/* arm ref clock events */
    short ext_ref_num;		/* C190 ext ref spiggot number (1-4) */
    float smpkhz;		/* plot sample rate (KHz) */
    short spare;		/* */
    short spare2;		/* */
    int ext_ref_mask;		/* FRIG external reference mask */
    char ext_ref_name[DEVICE_NAME_LEN];	/* FRIG external reference device */
/* The following members are not saved in the PLOTCOMM.DAT file */
    SMGR_MSG	smgr_msg[4];
    SDA_MSG	sda_msg;
    } __attribute__((packed)) /* Added by the PACKINATOR(tm) */;
/*	 
**  SNP_TC_MAIL requests data to be mailed to specified user
**  reply is 2 bytes of ACNET error code
*/	 
#define	SNP_TC_MAIL 		5	/* request typecode to mail data */
#define	SNP_PLOT_NOW		0	/* get data for current/next plot */
#define	SNP_PLOT_LAST		1	/* get data for last completed plot */
#define	SNP_LEN_USER		64	/* max length of mail user */
#define	SNP_LEN_SUBJ		64	/* max length of mail subject */
#define	SNP_LEN_EXCEL_FILE	40	/* max length of an Excel file name */

#define SNP_DATA_X_REGULAR      0	/* display x data type in REGULAR */ 
#define SNP_DATA_X_ORDINAL      1	/* display x data type in ORDINAL */
#define SNP_DATA_X_NONE         2	/* don't display x data */

#define SNP_DATA_Y_FLOAT        0	/* display y data type in FLOAT */
#define SNP_DATA_Y_EXP        	1	/* display y data type in EXP */
#define SNP_DATA_Y_HEX          2	/* display y data type in HEX */

#define SNP_SUB_TC_EMAIL	1	/* export data by email */
#define SNP_SUB_TC_SCRATCH_FILE	2	/* export data to scratch file */
#define SNP_SUB_TC_EXCEL_FILE	3	/* export data to Excel file */
#define SNP_SUB_TC_PASTE_BUFFER	4	/* export data to the paste buffer */

#define SNP_FILE_FORMAT_INDIVIDUAL	1	/* export data with one device per file */
#define SNP_FILE_FORMAT_COMBINED	2	/* export data with all devices in one file */

typedef struct			/* request for mailed data */
    {
    unsigned short	sm_tc;			/* typecode: SNP_TC_MAIL */
    unsigned short	sm_get_plot;		/* which PLOT's data */
    unsigned short	sm_cnsnum;		/* console receiving request */
    unsigned short	sm_sltnum;		/* slot receiving request */
    char		sm_mail_to[SNP_LEN_USER];	/* mail to this user */
    char		sm_subject[SNP_LEN_SUBJ];	/* mail subject */
    unsigned short      sm_x_format;		/* x data format */
    unsigned short      sm_y_format;		/* y data format */
    unsigned short      sm_sub_tc; 		/* SNP_SUB_TC_EMAIL,
	    					   SNP_SUB_TC_SCRATCH_FILE, or
						   SNP_SUB_TC_EXCEL_FILE */
    int		sm_file_format;		/* output file format */
    } __attribute__((packed)) /* Added by the PACKINATOR(tm) */ snp_mail_t;

#endif