/*
 * FILE:        FLIB.H
 *
 * MODULE:      FactoryLink Main Header File
 *
 * PROGRAM:     FactoryLink Multi-Platform version 2.0
 *
 * AUTHOR:      Clay Waldrop, Jr.
 *
 * HISTORY:       DATE   AUTHOR  DESCRIPTION OF ACTION
 *              08/06/90   CW    Finished Multi-Platform version 1.0
 *                               for OS/2, UNIX, and VMS platforms.
 *              09/05/90   CW    Finished Multi-Platform version 2.0
 *                               for OS/2, UNIX, and VMS platforms.
 *	             08/14/92   CAC	Wrapped #ifdef __cplusplus code around
 *                               function prototypes for linkage with C++
 *                               objects for CML++.
 *              03/18/93   FPJ   ( SPDT Project ) Copied this file from 4.1
 *                               library and placed in 4.2 library.  Updated
 *                               with ALOG and SPDT global tag ids.
 */

#ifndef _FL_INCLUDED
#define	_FL_INCLUDED 1

/* --- Definitions --- */

#ifdef OS2
#include <flibos2.h>
#endif
#ifdef WIN
#include <flibwin.h>
#endif
#ifdef UNIX
#include <flibunix.h>
#endif
#ifdef VMS
#include <flibvms.h>
#endif
#ifdef NT
#include <flibnt.h>
#endif

/* --- Global Tag identifiers --- */

/* 0 - 1000 are reserved for FL, values 1000 - n are for applications */

#define	GT_COMMAND	1	/* Run-Time Manager command */
#define	GT_ARGUMENT	2	/* Run-Time Manager command argument */
#define	GT_PASSWORD	3	/* Run-Time Manager password */
#define	GT_STARTUP	4	/* Run-Time Manager system startup flag */
#define	GT_SHUTDOWN	5	/* Run-Time Manager system shutdown flag */

#define	GT_SECONDS	10	/* Timer seconds */
#define	GT_MINUTES	11	/* Timer minutes */
#define	GT_HOURS	12	/* Timer hours */
#define	GT_DAY		13	/* Timer day of month */
#define	GT_MONTH	14	/* Timer month */
#define	GT_YEAR		15	/* Timer year */
#define	GT_DOW		16	/* Timer day of the week */
#define	GT_DOY		17	/* Timer day of the year */
#define	GT_DATE		18	/* Timer date string (day MM/DD/YYYY) */
#define	GT_TIME		19	/* Timer time string (HH:MM:SS) */
#define	GT_DATETIME	20	/* Timer date+time string */
#define	GT_YYMMDD	21	/* Timer date string (YY/MM/DD) */
#define	GT_SECDAY	22	/* Timer seconds this day */
#define	GT_SECYEAR	23	/* Timer seconds this year */
#define	GT_SECTIME	24	/* Timer secronds since "start of time" */

#define	GT_SPLRQST	30	/* Spooler request */
#define	GT_SPLRPLY	31	/* Spooler reply */
#define	GT_DDERQST	32	/* DDE Request */

#define GT_SNDMBX	39	/* Mailbox for FLLANSND */
#define	GT_FLLAN	40	/* Global FLLAN send timer */
#define	GT_TRENDMBX	41	/* Trend input mailbox */
#define	GT_GRAPHMBX	42	/* Graphics screen mailbox */
#define GT_SPCGMBX	43	/* SPC - Graphics input mailbox. */
#define GT_SPVRCVMBX	44	/* SPV - Receive mailbox for Datbase access. */
#define GT_SPCRCVMBX	45	/* SPC - Receive mailbox for Datbase access. */
#define GT_DBLOG1HISTMBX 46	/* Global Tag ID for DBLOG Receive Mailbox  */
#define GT_SPRGMBX     	47	/* SPR - graphics input Mailbox*/
#define GT_SPRRCVMBX  	48	/* SPR - Receive mailbox */
#define GT_BROWSEHISTMBX 49	/* Global Tag ID for DBBROWSE Receive Mailbox */

#define	GT_FLINK	50	/* FLINK directory */
#define	GT_FLAPP	51	/* FLAPP directory */
#define	GT_DOMAIN	52	/* FLDOMAIN variable */
#define	GT_NAME		53	/* FLNAME variable */
#define	GT_USER		54	/* FLUSER variable */

#define GT_ALOGMBX      55	/* ALOG Mailbox        */
#define GT_ALOGRFSH     56 /* ALOG Screen Refresh */
#define GT_ALOGSHMEM    57 /* ALOG Shared Memory  */
#define GT_ALOGVER      58 /* ALOG Version        */

#define GT_SPDTSHMEM    59 /* SPDT Shared Memory size Global tag */

#define GT_SPCDATAMBX   60 /* SPC server receive mailbox */
#define GT_SPCDATATRIG  61 /* SPC server re-start flag */
#define GT_SPCGRPHMBX   62 /* SPC client recieve mailbox */

#define GT_TRENDHISTMBX 63 /* Historian to TREND MBX communications.  */
#define GT_ACKMBX	64 /* Distributed Alog Acknowlegded alarms via mbox */
#define GT_ALOGRCVMBX	65 /* Distributed Alog Historian receive mailbox */
#define GT_VIEWMBX	66 /* Distributed Alog View alarms via mailbox */
#define GT_OPERATOR	67 /* FactoryLink Operator */

#define GT_DPLOG1HISTMBX 68 /* Global Tag ID for DPLOGGER Receive Mailbox  */
#define	GT_SECEVENT	69 /* Security Event Message Tag */
#define GT_SECUSER	70 /* Operator of last security event message tag */
#define GT_CONNSRVINIT  72 /* Connection Server Initialization flare */
#define GT_CONNSRVMBX   73 /* Connection Server Receive Mailbox */
#define GT_DATASRVMBX   74 /* Data Server Receive Mailbox */
#define GT_CONNSRVTOTAL 75 /* Number of available webclient nodes */
#define GT_CONNSRVACTIVE 76 /* Number of active webclient nodes */
#define GT_GRAPHCONNTYPE 77 /* Tag indicating connection type of graph*/

#include <fldefs.h>
#ifndef NOCT
#include <ctdefs.h>
#endif

#ifdef __cplusplus
extern "C" {	/* Used by Zortech C++ compiler for CML++ */
#endif

/* --- Library Prototypes --- */

/* Path Manipulation Routines */

void	ENTRY make_nice_path(char FAR *pathp);
int	ENTRY is_abs_path(char FAR *pathp);
int	ENTRY is_full_path(char FAR *pathp);
void 	ENTRY make_full_path(char FAR *fpathp, char FAR *dpathp,
                             char FAR *rpathp);
uint	ENTRY get_path_drive(char FAR *pathp);
uint	ENTRY get_curr_drive(void);
void	ENTRY get_curr_dir(uint driven,char FAR *pathp);
void	ENTRY get_name_ext(char FAR *pathp, char FAR *namep, char FAR *extp);
void	ENTRY get_tmvals(int *hr, int *min, int *sec);
void	ENTRY get_dtvals(int *dow, int *dom, int *mon, int *yr);
void	ENTRY gettime(char *s);
void	ENTRY getdate(char *s);

int	ENTRY fl_global_tag(TAG FAR *tagp, uint n, uint *ids);
int	ENTRY fl_find_global_tag(TAG *tagp, uint ntags, uint *ids,
  	      			 char *app, char *curr_domain);

/* Format Version Number Routine */

char FAR * ENTRY format_version(uint ver, char FAR *buffp);
int     ENTRY fl_dbfmtt(id_t id, int maxlen, char FAR *bp0, char FAR *fp,
                        TAG *args);

/* Message Translation Routines */

int        ENTRY fl_xlate_init(char FAR *name, char FAR *bp, uint blen);
int        ENTRY fl_xlate_set_progpath(char FAR *progpath);
char FAR * ENTRY fl_xlate(char FAR *key);
int        ENTRY fl_xlate_load(char FAR *name) ;
void FAR * ENTRY fl_xlate_set_tree( void FAR *tree ) ;
void FAR * ENTRY fl_xlate_get_tree( void ) ;
void     * ENTRY fl_xlate_load2(void *tbl, char *file);
void     * ENTRY fl_xlate_load_lang(void *tbl, char *file, char *lang);
char     * ENTRY fl_xlate2(void *tbl, char *key);
void       ENTRY fl_xlate_free(void *table);
void       ENTRY set_xl_parm( void FAR *tree ) ;

int     ENTRY spool(id_t id, char FAR *flags, char FAR *message, int length);

/* Make EDI tasks happy */
#ifdef NO_TSPRINTF
#ifdef tsprintf
#undef tsprintf
#define tsprintf sprintf
#endif
#endif

#ifndef tsprintf
int     ENTRY tsprintf(char *bp, char *fp, ...);
int     ENTRY tvsprintf(char *bp, char *fp, ...);
#endif

/* Sleep Routine */

void    ENTRY fl_sleep(ulong msecs);

/* string functions */

void ENTRY strlower(char FAR *) ;

#ifdef __cplusplus
}	/* Used by Zortech C++ compiler for CML++ */
#endif

#endif /* _FL_INCLUDED */
