/**C*
 *
 * Vaisala software source code file
 *
 * Copyright (c) Vaisala Oyj 1989, 1990, 1992, 1995, 1996, 1997, 1998, 2001,
 * 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013.
 * All rights reserved.
 *
 **C*/

/** @file
 *
 * User Library Related Structures
 *
 * $URL: https://subversion.vaisala.com/svn/repos/sigmet/wr_iris_rda/tags/release8.13.6/base/user_lib/user_lib.h $
 *
 * $Id: user_lib.h 30018 2014-05-27 09:25:46Z rke $
 *
 */

#ifndef SIGMET_USER_LIB_H
#define SIGMET_USER_LIB_H 1

#define USE_PDF_TAGS

#define USER_BADSEM              (USER_FACILITY + 1)
#define USER_BADEF               (USER_FACILITY + 2)
#define USER_BLANK_MESSAGE       (USER_FACILITY + 3)
#define USER_BWL_UNLEV           (USER_FACILITY + 4)
#define USER_CANTBE_OPER         (USER_FACILITY + 5)
#define USER_CANTBE_USERS        (USER_FACILITY + 10)
#define USER_CANTBE_ROOT         (USER_FACILITY + 11)
#define USER_CANTUID_OPER        (USER_FACILITY + 12)
#define USER_CANTGID_USERS       (USER_FACILITY + 13)
#define USER_CANT_SETPRI         (USER_FACILITY + 14)
#define USER_CLOSEDIR_SEQ        (USER_FACILITY + 15)
#define USER_CLUSTER_BAD         (USER_FACILITY + 20)
#define USER_CLUSTER_ERROR       (USER_FACILITY + 21)
#define USER_CLUSTER_CHANGE      (USER_FACILITY + 22)
#define USER_CLUSTER_UNDEF       (USER_FACILITY + 23)
#define USER_DAEMON_FD           (USER_FACILITY + 24)
#define USER_DEVALLOC            (USER_FACILITY + 25)
#define USER_DEVTIMEOUT          (USER_FACILITY + 30)
#define USER_ERROR_SIG           (USER_FACILITY + 31)
#define USER_EXIT_CALLED         (USER_FACILITY + 32)
#define USER_FILE_NAME           (USER_FACILITY + 33)
#define USER_HCLASS_MISSING      (USER_FACILITY + 34)
#define USER_HCLASS_CORRUPT      (USER_FACILITY + 35)
#define USER_HCLASS_MERGER       (USER_FACILITY + 40)
#define USER_HOST_RESOLVE        (USER_FACILITY + 41)
#define USER_HOST_UNREACHABLE    (USER_FACILITY + 42)
#define USER_HOST_NOLISTEN       (USER_FACILITY + 43)
#define USER_HOST_REACHABLE      (USER_FACILITY + 44)
#define USER_IMAPADDR            (USER_FACILITY + 45)
#define USER_IMAPCHAN            (USER_FACILITY + 50)
#define USER_IMAPFULL            (USER_FACILITY + 51)
#define USER_IMAPSIZE            (USER_FACILITY + 52)
#define USER_INTERNALERR         (USER_FACILITY + 53)
#define USER_INVENTORY_DUP       (USER_FACILITY + 54)
#define USER_INVENTORY_FULL      (USER_FACILITY + 55)
#define USER_LOCK_ORDER          (USER_FACILITY + 60)
#define USER_NETMAX_EXCEEDED     (USER_FACILITY + 61)
#define USER_NETPACKET_COMMAND   (USER_FACILITY + 62)
#define USER_NETPACKET_NOFILE    (USER_FACILITY + 63)
#define USER_NETPACKET_NOZERO    (USER_FACILITY + 64)
#define USER_NETPACKET_OVERFLOW  (USER_FACILITY + 65)
#define USER_NETPORT_INUSE       (USER_FACILITY + 70)
#define USER_NETPORT_INVALID     (USER_FACILITY + 71)
#define USER_NET_SERVER_DOWN     (USER_FACILITY + 72)
#define USER_NET_SERVER_UP       (USER_FACILITY + 73)
#define USER_NO_ENV              (USER_FACILITY + 74)
#define USER_NO_ENV_0ARG         (USER_FACILITY + 75)
#define USER_NO_FTOK             (USER_FACILITY + 76)
#define USER_NOTAFIFO            (USER_FACILITY + 80)
#define USER_NOTATTY             (USER_FACILITY + 81)
#define USER_NOT_LOCKED          (USER_FACILITY + 82)
#define USER_OPENDIR_SEQ         (USER_FACILITY + 83)
#define USER_PROCESS_START       (USER_FACILITY + 84)
#define USER_RELOCK              (USER_FACILITY + 85)
#define USER_REUNLOCK            (USER_FACILITY + 90)
#define USER_SCH_CONFLICT        (USER_FACILITY + 91)
#define USER_SHMEM_FOUND         (USER_FACILITY + 92)
#define USER_SHMEM_MISSING       (USER_FACILITY + 93)
#define USER_SIG_FREE            (USER_FACILITY + 94)
#define USER_SIG_MALLOC          (USER_FACILITY + 95)
#define USER_TEST_NUMBER         (USER_FACILITY + 100)
#define USER_TEST_STRING         (USER_FACILITY + 101)
#define USER_TEXTMSG             (USER_FACILITY + 102)
#define USER_UNCOMP_IN           (USER_FACILITY + 103)
#define USER_UNCOMP_OUT          (USER_FACILITY + 104)
#define USER_UNIX_SIG            (USER_FACILITY + 105)
#define USER_USE_MMAP            (USER_FACILITY + 110)
#define USER_USE_SHORT           (USER_FACILITY + 111)
#define USER_WAITEF              (USER_FACILITY + 112)
#define USER_ZLEN_FILE           (USER_FACILITY + 113)
#define USER_ETHTIMEOUT          (USER_FACILITY + 114)
#define USER_FIFOTIMEOUT         (USER_FACILITY + 115)
#define USER_DSPML               (USER_FACILITY + 116)
#define USER_DSPWRITE            (USER_FACILITY + 117)



/* Standard types are included in sigtypes.h.
 */

#ifdef __cplusplus
extern "C" {
#endif

#if 0
}
#endif
/* =============== Function prototypes for user library =================== */

/* Big Bit Field Set/Clear/Test routines.  These permit you to pack
 * bit fields more efficiently.  The return value is the value of the
 * bit prior to the call.  Three different routines are defined for
 * one-byte, two-byte, and four-byte internal accesses.  This is only
 * important if the array will also be accessed by other C code.
 */
UINT1 bbput_1( volatile void *barray_a, SINT4 ibit_a, UINT1 iVal_a ) ;
UINT1 bbput_2( volatile void *barray_a, SINT4 ibit_a, UINT1 iVal_a ) ;
UINT1 bbput_4( volatile void *barray_a, SINT4 ibit_a, UINT1 iVal_a ) ;

UINT1 bbclr_1( volatile void *barray_a, SINT4 ibit_a ) ;
UINT1 bbclr_2( volatile void *barray_a, SINT4 ibit_a ) ;
UINT1 bbclr_4( volatile void *barray_a, SINT4 ibit_a ) ;

UINT1 bbset_1( volatile void *barray_a, SINT4 ibit_a ) ;
UINT1 bbset_2( volatile void *barray_a, SINT4 ibit_a ) ;
UINT1 bbset_4( volatile void *barray_a, SINT4 ibit_a ) ;

UINT1 bbtst_1( volatile const void *barray_a, SINT4 ibit_a ) ;
UINT1 bbtst_2( volatile const void *barray_a, SINT4 ibit_a ) ;
UINT1 bbtst_4( volatile const void *barray_a, SINT4 ibit_a ) ;

/* Byte-fifo routines.  The FIFOs hold a string of bytes (actually,
 * unsigned shorts, so that extra bits can be passed with each byte if
 * needed).  Use the BFIFO macro to create the FIFO itself.
 */
void  bfifo_init ( volatile void *bfifo_a, SINT4 structsize_a ) ;
SINT4 bfifo_read ( volatile void *bfifo_a ) ;
SINT4 bfifo_read_array( volatile void *bfifo_a, UINT1 *chrs_a, SINT4 iMaxCount_a );
SINT4 bfifo_write( volatile void *bfifo_a, UINT2 chr_a ) ;
SINT4 bfifo_write_array( volatile void *bfifo_a, const UINT1 *chrs_a, SINT4 iCount_a );
SINT4 bfifo_used ( volatile void *bfifo_a ) ;
SINT4 bfifo_free ( volatile void *bfifo_a ) ;

/* Discrete Fourier Transform and Window routines
 */
float fSetWindowCoefficients
( int32_t iWinType_a, int32_t iSize_a, float fWinCoefs_a[3] ) ;

float fWindowValue( float fPoint_a, int32_t iSize_a, const float fWinCoefs_a[3] ) ;
float fWindowDepthDB( int32_t iWinType_a ) ;

MESSAGE dft_complex
( const float *freal_in_a,	/* Real input data */
  const float *fimag_in_a,	/* Imaginary input data */
  int32_t inc_in_a,		/* Increment between input values */
  float *freal_out_a,		/* Real and imaginary output data */
  float *fimag_out_a,		/*   (okay to overlap input data) */
  int32_t inc_out_a,		/* Increment between output values */
  int32_t iSize_a,		/* Transform size */
  uint32_t iflags_a ) ;		/* Control Flags (from FFT_xxx) */

/* Simple angle conversion and testing routines.  A few of these
 * functions are also available in macro form when you're concerned
 * about overhead in function calls.
 */
SINT4 binside( BIN2 left_a, BIN2 test_a, BIN2 right_a ) ;
SINT4 binEncompased( BIN2 left_a, BIN2 test_a, BIN2 right_a ) ;

double fElDegFromBin2( BIN2 binang ) ;
double fPDegFromBin2( BIN2 binang ) ;
double fRadianFromBin2( BIN2 binang ) ;
double fDegFromBin2( BIN2 binang ) ;

FLT8 fElDegFromBin4( BIN4 binang ) ;
FLT8 fPDegFromBin4( BIN4 binang ) ;
FLT8 fDegFromBin4( BIN4 binang ) ;
FLT8 fRadianFromBin4( BIN4 binang ) ;

FLT8 fDegFromText( const char *sAngle_a ) ;

BIN2 iBin2FromBcd( UINT2 ibcd_a ) ;
BIN2 iBin2FromFDeg( double angle ) ;
BIN2 iBin2FromRadian( double fRadian_a ) ;

BIN4 iBin4FromFDeg( FLT8 angle ) ;
BIN4 iBin4FromRadian( FLT8 angle ) ;

#define IBIN2FROMRADIAN( RADIAN )                               \
    ( (BIN2)( 0xFFFF & NINT( (RADIAN) * (32768.0 / FPI  ) ) ) )
#define IBIN2FROMFDEG( ANGLE )                                  \
    ( (BIN2)( 0xFFFF & NINT( (ANGLE)  * (32768.0 / 180.0) ) ) )

/* Latitude and Longitude conversion routines.  These are all
 * reentrent.
 */
char* sLatFromDegrees
( double fAngle_a,              /* Angle in degrees */
  char *sBuffer_a,
  int  iBufLen_a );
char* sLatFromRadian
( double fAngle_a,              /* Angle in radians */
  char *sBuffer_a,
  int  iBufLen_a );
char* sLonFromDegrees
( double fAngle_a,              /* Angle in degrees */
  char *sBuffer_a,
  int  iBufLen_a );
char* sLonFromRadian
( double fAngle_a,              /* Angle in radians */
  char *sBuffer_a,
  int  iBufLen_a );

SINT4 c_cmd_lookup		/* In file c_cmd_lookup.c */
(char* scmd_a,		/* Character string to lookup */
 char* slist_a[],		/* Array of strings to compare against */
 SINT4 ilistn_a,		/* Number of strings in the list */
 UINT2* lamb_a		/* Set to non-zero if ambiguous */
    );

void cancel_schedule_ef		/* File: schedule.c */
( void ) ;

#ifdef SIGMET_SIG_DATA_TYPES_H
const char *sClassifierName12      /* File: ClassifierNames.c */
( enum classifier Classifier_a,  ///< -i echo classifier ID 
  char *sName_a,                 ///< Name returned here
  int   iLength_a );             ///< Storage size of Name

/* Return a string showing the name of the classifier 
 * merger specified.
 */
const char *sClassifierMergerName12  /* File: ClassifierNames.c */
( enum classifier_merger Merger_a,  ///< -i echo classifier merger ID 
  char *sName_a,                    ///< Name returned here
  int   iLength_a );                ///< Storage size of Name;
#endif  /* #ifdef SIGMET_SIG_DATA_TYPES_H */

void compress_words		/* File: compress.c */
(const SINT2 inbuf_a[],	/* Input array of data to be compressed */
 SINT4 inlen_a,		/* Length of INBUF (Positive or zero) */
 SINT2 ioutbuf_a[],		/* Output array to hold compressed data */
 SINT4 *ioutlen_a) ;		/* Number of words written to IOUTBUF */

#ifdef SIGMET_SIG_DATA_TYPES_H
void convert_alt_data		/* File: data_types.c */
(uint32_t idtype_a,
 int32_t  icount_a,
 const uint8_t *in_a,
 uint8_t *out_a,
 const struct data_convert *pconvert_a ) ;

void ConvertDataFrom8           /* File: data_types.c */
(uint32_t iInDType_a,     /* Input data type */
 int32_t  icount_a,       /* Number of bins */
 const uint8_t *in_a,     /* Input pointer */
 uint16_t *out_a,         /* Output pointer */
 const struct data_convert *pconvert_a ); /* Convert structure */

void ConvertDataFrom16            /* File: data_types.c */
(uint32_t iInDType_a,     /* Input data type */
 int32_t  icount_a,       /* Number of bins */
 const uint16_t *in_a,    /* Input pointer */
 uint8_t *out_a,         /* Output pointer */
 const struct data_convert *pconvert_a ); /* Convert structure */
#endif /* #ifdef SIGMET_SIG_DATA_TYPES_H */

MESSAGE create_sem_set		/* File: semaphore.c */
( const char* sname_a,
  UINT4 isem_count_a,
  UINT4 iflg_count_a,
  UINT4 isem_cluster_a ) ;

#ifdef SIGMET_IRIS_DATA_TYPE_DEFINED
uint8_t is_data_enum       /* File: data_types.c */
( enum iris_data_type dtype_a );
#endif  /* #ifdef SIGMET_IRIS_DATA_TYPE_DEFINED */

/* Given two points on the earth, return the distance between them
 * and the azimuths from each to the other.
 */
void earth_to_polar
(volatile const struct latlon8 *earth1_a,
 volatile const struct latlon8 *fearth2_a,
 volatile FLT8 *frange_a,
 volatile FLT8 *faz1to2_a,
 volatile FLT8 *faz2to1_a) ;

/* Routine to convert a starting point, and a polar offset to an ending
 * point in earth coordinates.  This routine will not work if the starting
 * point is at either the North or South poles.  Also the range must be
 * less than half way around the earth.
 */
void EarthFromPolar
(volatile const struct latlon8 *Start_a,   /* Origin position in radians */
 volatile const struct D2Polar8 *pPolar_a,
 volatile struct latlon8 *End_a);

MESSAGE errno_to_message	/* File: error_report.c */
( int errno_a ); 

MESSAGE errno_to_message_va	
( int errno_a, UINT4 icount_a, ... ) ; 

double fambiguous_range           /* File: fambiguous_range.c */
( int32_t prf );

#ifdef SIGMET_DATA_CONVERT_DEFINED
double fDataScalePerBit           /* File: DataConvert.c */
(uint32_t idtype_a,
 const struct data_convert *pconvert_a );

double fDataStartValue            /* File: DataConvert.c */
( uint32_t idtype_a,
  const struct data_convert *pconvert_a );

/* Return the maximum value in user units */
double fuser_max_value            /* File: DataConvert.c */
(uint32_t idtype_a,
 const struct data_convert *pconvert_a );
#endif  /* #ifdef SIGMET_DATA_CONVERT_DEFINED */

double fDataScaleStartLimit
( uint16_t idata_a, double fNumIn_a );

double fDataScaleStepLimit
( uint16_t idata_a, double fNumIn_a );

#ifdef SIGMET_DATA_CONVERT_DEFINED
double  fdata_to_user		/* File: DataConvert.c */
(uint16_t idata,
 uint32_t idtype,
 const struct data_convert *pconvert_a );
#endif  /* #ifdef SIGMET_DATA_CONVERT_DEFINED */

FLT8 fear_from_slr_elv          /* File: earth.c */
( FLT8 fslr_a, FLT8 felv_a );

double fearthcurve                /* File: earth.c */
( double frange_a );

FLT8 felv_from_ear_hgt          /* File: earth.c */
( FLT8 fear_a, FLT8 fhgt_a, FLT8 fTow_a );

FLT8 felv_from_slr_hgt          /* File: earth.c */
( FLT8 fslr_a, FLT8 fhgt_a, FLT8 fTower_a );

FLT8 fhgt_from_ear_elv          /* File: earth.c */
( FLT8 fear_a, FLT8 felv_a, FLT8 fTow_a );

FLT8 fhgt_from_slr_ear          /* File: earth.c */
( FLT8 fslr_a, FLT8 fear_a, FLT8 fTow_a );

FLT8 fhgt_from_slr_elv          /* File: earth.c */
( FLT8 fslr_a, FLT8 felv_a, FLT8 fTow_a );

#ifdef SIGMET_SIG_DATA_TYPES_H
void FillDataConvert            /* File: DataConvert.c */
( volatile struct data_convert *pConvert_a,
  int32_t  iPrf_a,          /* PRF in Hertz */
  uint16_t iTriggerCase_a,  /* Type of dual PRF */
  int32_t  iWaveLength_a,   /* Wavelength in 1/100 of cm */
  uint16_t iPolarization_a, /* Polarization type */
  uint32_t iColorFlags_a    /* Flags containing units switches */
    );
#endif  /* #ifdef SIGMET_SIG_DATA_TYPES_H */

#ifdef SIGMET_SIG_DATA_TYPES_H
void FillDataConvertClasses     /* File: DataConvert.c */
( volatile struct data_convert *pConvert_a,
  int32_t  iPrf_a,          /* PRF in Hertz */
  uint16_t iTriggerCase_a,  /* Type of dual PRF */
  int32_t  iWaveLength_a,   /* Wavelength in 1/100 of cm */
  uint16_t iPolarization_a, /* Polarization type */
  uint32_t iColorFlags_a,   /* Flags containing units switches */
  enum classifier_merger iClassFlag_a, /* How to merge the classes */
  volatile const struct enum_convert EnumConvs_a[NR_CLASSIFIERS]); /* Enum switches */
#endif  /* #ifdef SIGMET_SIG_DATA_TYPES_H */

double fNyquistVelocity           /* File: fnyquist_vel.c */
(int32_t  iprf_a,            /* PRF used (higher one in dual mode) */
 uint16_t iprfcase_a,        /* The multiple prf mode. See dsp_lib.h */
 int32_t  iwavelength_a,     /* Wavelength in 1/100 of cm */
 uint16_t iPolarization_a ); /* Polarization mode, see dsp_lib.h */

double fNyquistWidth           /* File: fnyquist_vel.c */
(int32_t  iprf_a,            /* PRF used (higher one in dual mode) */
 int32_t  iwavelength_a,     /* Wavelength in 1/100 of cm */
 uint16_t iPolarization_a ); /* Polarization mode, see dsp_lib.h */

/* This function computes the low PRF given the high PRF and the 
 * dual PRF flag stored in IRIS products.
 */
double fPrfLowFromHighCase   /* File: fnyquist_vel.c */
( int32_t  iHighPrf_a,
  uint16_t iPrfCase_a );      /* The multiple prf mode. See dsp_lib.h */

/* Computes the PRF from the Nyquist velocity */
FLT8 fPrfFromNyquistVelocity /* File: fnyquist_vel.c */
(FLT8  fNyquist_a,        /* Nyquist velocity in m/s */
 UINT2 iprfcase_a,        /* The multiple prf mode. See dsp_lib.h */
 SINT4 iwavelength_a,     /* Wavelength in 1/100 of cm */
 UINT2 iPolarization_a ); /* Polarization mode, see dsp_lib.h */
       
FLT8 fslr_from_ear_elv          /* File: earth.c */
( FLT8 fear_a, FLT8 felv_a );

FLT8 fslr_from_ear_hgt          /* File: earth.c */
( FLT8 fear_a, FLT8 fhgt_a, FLT8 fTow_a );

FLT8 fslr_from_hgt_elv          /* File: earth.c */
( FLT8 fhgt_a, FLT8 felv_a, FLT8 fTow_a );

char *get_established_name	/* File: error_report.c */
( void );

void get_process_name           /* File: process.c */
(char *sname_a,
 SINT4 isize_a,      /* Size of name storage */
 int argc_a,
 char * const sargv_a[] );

void getbtime			/* File: timesubs.c */
( volatile UINT4* time );

#ifdef INCLUDE_SYSTIME_PROTOTYPES
UINT4 iGetBtimeTVal		/* File: timesubs.c */
( volatile struct timeval *pTVal_a ) ;
#endif /* #ifdef INCLUDE_SYSTIME_PROTOTYPES */

UINT4 btimeGrace		/* File: timesubs.c */
( UINT4 idiff_a ) ;

enum time_type_enum {
    TIME_FLG_LOCAL=0,
    TIME_FLG_UTC=1
};
/* #define TIME_FLG_GMT (1)  Use "UTC" in new code */

void GetTimeFull		/* File: timesubs.c */
(volatile struct full_time_spec* pTime_a,
 enum time_type_enum iFlags_a );

#ifdef INCLUDE_SYSTIME_PROTOTYPES
void TimeFullFromTimeval
(volatile struct full_time_spec *pFullTime_a,
 const struct timeval *pTV_a,
 enum time_type_enum iFlags_a );
#endif  /* #ifdef INCLUDE_SYSTIME_PROTOTYPES */

void GetTimeYmds		/* File: timesubs.c */
(volatile struct ymds_time* time,
 enum time_type_enum iFlags_a );

BIN2  iBin2NarrowMidPt( BIN2 ia_a, BIN2 ib_a ) ;
BIN2 iBin2OrderedMidPt( BIN2 ia_a, BIN2 ib_a ) ;

int32_t idata_alt_type		/* File: DataConvert.c */
(int32_t idata_a) ;

/* Return the maximum value in file storage units */
uint16_t idata_max_value           /* File: DataConvert.c */
(uint32_t idtype_a);

uint32_t idata_resolution          /* File: DataConvert.c */
( uint32_t idata_a );

uint32_t idatatype_from_index      /* File: data_types.c */
(uint32_t index_a);

uint32_t idatatype_from_gui_index  /* File: data_types.c */
(uint32_t index_a);

void sdata_name6_from_index        /* File: data_types.c */
(uint32_t index_a, char sdata_name_a[7]);

void sdata_name6_from_gui_index    /* File: data_types.c */
(uint32_t index_a, char sdata_name_a[7]);

UINT2 brtdisp_valid_datatype /* File: data_types.c */
(UINT4 index_a);


SINT2 iDataFromDspIndex         /* File: DataNames.c */
( UINT1 iIndex_a );

SINT2 iData2FromDspIndex        /* File: DataNames.c */
( UINT1 iIndex_a );

SINT2 iDataFromTaskIndex         /* File: DataNames.c */
( UINT1 iIndex_a );

SINT2 iDataFromName6            /* File: DataNames.c */
( const char *sDataName6_a );   /* Null terminated name */

#define DATATYPE_IN_SETUP    1
#define DATATYPE_IN_OPTIONS  2
UINT4 iflag_from_datatype       /* File: data_types.c */
( UINT4 data_type );

/* Routine to convert a data type into a flag indicating which type of
 * rtdata it is.  Types which are not supported by rtdisp are flagged
 * as -1.
 */
int iRtFlagFromDatatype         /* File: data_types.c */
(UINT4 data_type);

void ignore_next_signal		/* In error_report.c */
( int signal_a ) ;

SINT4 ihhmmss			/* File: TimeNames.c */
( volatile const char* );

MESSAGE imapclose		/* In file mapio.c */
( const void* iaddr_a,
  SINT4 isize_a,
  SINT4 ichan_a );

MESSAGE imapcreate		/* In file mapio.c */
( const char* sname_a,
  SINT4 idessize_a,
  void** iaddr_a,
  SINT4* isize_a,
  SINT4* ichan_a );

MESSAGE imapopen		/* In file mapio.c */
( const char* sname_a,
  UINT2 lwrite_a,
  void** iaddr_a,
  SINT4* isize_a,
  SINT4* ichan_a );

MESSAGE imapopen_short		/* In file mapio.c */
( const char* sname_a,
  UINT2 lwrite_a,
  void** iaddr_a,
  SINT4* isize_a,
  SINT4* ichan_a,
  UINT4 imaxsize_a);

MESSAGE iMessageMod_va		/* File: error_report.c */
( MESSAGE iMessage_a, UINT4 icount_a, ... ) ;

SINT4 imonth_from_txt		/* File: TimeNames.c */
( volatile const char* stext_a );

/* Low level math functions on simple integers and bit patterns.
 */
UINT4 iMpyU64
( UINT4 iarg1_a, UINT4 iarg2_a, UINT4 *iLowProd_a ) ;

UINT4 iEuclidGCD( UINT4 iM_a, UINT4 iN_a ) ;
UINT4 iEuclidLCM( UINT4 iM_a, UINT4 iN_a ) ;

SINT4 iRationalDenom( FLT8 fArg_a, SINT4 iMaxDenom_a ) ;

UINT4   ipower_of_two( UINT4 ivalue_a ) ;
int32_t   ilog_base_two( uint64_t ivalue_a ) ;
SINT4 ilowest_bit_set( UINT4 ivalue_a ) ;
SINT4    num_bits_set( UINT4 ivalue_a ) ;

#define ihighest_bit_set( VALUE ) ilog_base_two( VALUE )

/* Handy comparison functions of different data types for direct use
 * with the C-library QSORT() routine.
 */
int  iQsortCmpFLT4( const void *arg1_a, const void *arg2_a ) ;
int  iQsortCmpFLT8( const void *arg1_a, const void *arg2_a ) ;

int iQsortCmpSINT1( const void *arg1_a, const void *arg2_a ) ;
int iQsortCmpSINT2( const void *arg1_a, const void *arg2_a ) ;
int iQsortCmpSINT4( const void *arg1_a, const void *arg2_a ) ;

int iQsortCmpUINT1( const void *arg1_a, const void *arg2_a ) ;
int iQsortCmpUINT2( const void *arg1_a, const void *arg2_a ) ;
int iQsortCmpUINT4( const void *arg1_a, const void *arg2_a ) ;

/* Functions to find the Kth smallest element from an array of FLT4 or
 * SINT4 values.  Corresponding MEDIAN macros can also be used.
 */
FLT4  fKthSmallest(  FLT4 data_a[], SINT4 iSize_a, SINT4 kth_a ) ;
SINT4 iKthSmallest( SINT4 data_a[], SINT4 iSize_a, SINT4 kth_a ) ;

#define FMEDIAN( DATA, SIZE ) fKthSmallest( DATA, SIZE, ((SIZE)-1)/2 )
#define IMEDIAN( DATA, SIZE ) iKthSmallest( DATA, SIZE, ((SIZE)-1)/2 )


UINT4 index_from_datatype       /* In file data_types.c */
( UINT4 data_type ) ;

uint32_t gui_index_from_datatype       /* In file data_types.c */
( uint32_t data_type ) ;

MESSAGE init_sem_set		/* File: semaphore.c */
( UINT4 isem_cluster_a ) ;

SINT4 iPackTime                 /* File: timesubs.c */
( SINT2 ihour_a,
  SINT2 iminute_a,
  SINT2 isecond_a ) ;

/* This function computes the IRIS dual PRF flag given the high PRF
 * and low PRFs being used.
 */
uint16_t iPrfCaseFromHighLow      /* File: fnyquist_vel.c */
( double fHighPrf_a,
  double fLowPrf_a );

UINT1 iProjectionFromName16     /* File: ProjectionNames.c */
( const char* sProjection16_a );   /* Projection type string */

UINT1 iProjectionFromProj4       /* File: ProjectionNames.c */
( const char* sProj4Name_a );   /* Projection type string */

int is_message_errno            /* File: error_report.c */
(MESSAGE istatus_a, int errno_a );

SINT4 itrimlen			/* File: str_subs.c */
(volatile const char *string_a,	/* String to search */
 SINT4 ilength_a ) ;		/* Number of characters to search */

uint8_t bDataCanConvert           /* File: DataConvert.c */
( uint32_t idtype_a );

#ifdef SIGMET_SIG_DATA_TYPES_H
uint16_t iuser_to_data		/* File: DataConvertClass.c */
( double fuser,
  uint32_t idtype,
  const struct data_convert *pconvert_a );
#endif  /* #ifdef SIGMET_SIG_DATA_TYPES_H */

#ifdef SIGMET_SIG_DATA_TYPES_H
void data_to_enums           /* File: DataConvertClass.c */
(const uint16_t idata_a,       
 uint16_t UserEnums_a[], 
 const struct enum_convert Enums_a[NR_CLASSIFIERS] ); ///< -i how to decode enum data
#endif  /* #ifdef SIGMET_SIG_DATA_TYPES_H */

#ifdef SIGMET_ENUM_CONVERT_DEFINED
uint16_t ienums_to_data
(const uint16_t * const pUserEnums_a,
 const uint32_t idtype_a,
 const struct enum_convert Enums_a[NR_CLASSIFIERS] ); ///< -i how to encode enum data
#endif  /* #ifdef SIGMET_ENUM_CONVERT_DEFINED */

#ifdef SIGMET_ENUM_CONVERT_DEFINED
enum allClasses merge_enums     /* File: DataConvertClass.c */
( uint16_t UserEnums_a[NR_CLASSIFIERS],
  enum classifier_merger iMerger, /* Flag for classification set selection */
  const struct enum_convert Coding_a[NR_CLASSIFIERS] ); ///< -i how to decode enum data
#endif  /* #ifdef SIGMET_ENUM_CONVERT_DEFINED */

#ifdef SIGMET_CLASSIFIER_MERGER_DEFINED
enum allClasses merge_enums_indices
( uint16_t UserEnums_a[NR_CLASSIFIERS],
  enum classifier_merger iMerger_a,     ///< -i Flag for class set selection 
  const uint8_t iIndices_a[NR_CLASSIFIERS] ); ///< -i Pointers to input enums 
#endif  /* #ifdef SIGMET_CLASSIFIER_MERGER_DEFINED */

#ifdef SIGMET_ENUM_CONVERT_DEFINED
MESSAGE verify_class_list       /* File: DataConvertClass.c */
( const struct enum_convert Coding_a[NR_CLASSIFIERS] );
#endif  /* #ifdef SIGMET_ENUM_CONVERT_DEFINED */

#ifdef SIGMET_ENUM_CONVERT_DEFINED
void enum_convert_copy          /* File: DataConvertClass.c */
( volatile struct enum_convert EnumConvOut_a[],      ///< -o Enum switches
  volatile const struct enum_convert EnumConvIn_a[], ///< -i Enum switches,optional
  int iCount_a );  ///< -i Size of arrays
#endif  /* #ifdef SIGMET_ENUM_CONVERT_DEFINED */

#ifdef SIGMET_ENUM_CONVERT_DEFINED
MESSAGE find_required_hydroclasses   /* File: DataConvertClass.c */
( uint8_t iIndices_a[NR_CLASSIFIERS],
  enum classifier_merger iClassFlag_a,
  const struct enum_convert  iEnums_a[NR_CLASSIFIERS] );
#endif  /* #ifdef SIGMET_ENUM_CONVERT_DEFINED */


SINT4 iYearFromFile		/* File: timesubs.c */
(SINT4 iyear);

typedef SINT4 ( iYmdsCmpSub_f )
( volatile const struct ymds_time *time1_a,
  volatile const struct ymds_time *time2_a ) ;

/* Compare/Subtract two YMDS time structures, ignoring milliseconds
 */
#define MAX_SUBTRACT_SECONDS ( 366 * 24 * 3600 )

iYmdsCmpSub_f iymds_compare ;	/* File: timesubs.c */
iYmdsCmpSub_f iymds_subtract ;	/* File: timesubs.c */

/* Compare two YMDS time structures, including milliseconds.
 */
#define MAX_SUBTRACT_MILLISECONDS ( 21 * 24 * 3600 * 1000 )

iYmdsCmpSub_f iYmdsCompareMs ;	/* File: timesubs.c */
iYmdsCmpSub_f iYmdsSubtractMs ;	/* File: timesubs.c */

SINT4 iymds_compare_serv	/* File: timesubs.c */
(volatile const struct serv_ymds_time* time1,
 volatile const struct serv_ymds_time* time2 );

MESSAGE kill_sem_set		/* File: semaphore.c */
( UINT4 isem_cluster_a ) ;

void kilo_count_accum		/* File: KiloCount.c */
(volatile struct kilo_count *kcnt_a,
 SINT4 ival_a) ;

UINT2 lAutoRestartRequested	/* File: error_report.c */
( void ) ;

UINT1 lbin2_in_a_row( BIN2 ia_a, BIN2 ib_a, BIN2 ic_a ) ;

UINT2 liris_observer		/* File: username.c */
( const char *susername );

UINT2 liris_operator		/* File: username.c */
( const char *susername );

UINT2 c_lfind_command		/* File: c_lfind_command.c */
(int icount_a,		/* Number of strings to compare against */
 char* string_vector_a[],	/* Array of strings to compare */
 char* scommand_a		/* String to check against the array */
    );

void lock_sem			/* File: semaphore.c */
( UINT4 num_a ) ;

UINT2 locked_by_me		/* File: semaphore.c */
( UINT4 num_a ) ;

UINT2 read_sem			/* File: semaphore.c */
( UINT4 num_a, UINT4 *ipid_a ) ;

UINT2 lSemSetCheck              /* File: semaphore.c */
( UINT4 isem_cluster_a ); /* Cluster number parameter */

UINT2 lshmem_inuse		/* In shmem.c */
(const char *segname_a,
 UINT2 lprint_a ); 

UINT2 lsig_process_exists	/* In process.c */
(volatile const UINT4 ipid_a	/* Process ID */
    ) ;

UINT2 lsig_user_is_root(void) ;	/* In username.c */

void mapcache			/* In file mapio.c */
( UINT4 cachesz_a ) ;

void MapGetYmds			/* In file mapio.c */
(struct ymds_time *pYmds_a,
 int iFlags_a );

void mapmmap			/* In file mapio.c */
( UINT2 luse_mmap_a ) ;

/* Simple array operations.  These are included to make the transition
 * from TI320 code a little easier, i.e., because the TI320 "int" and
 * "float" has a sizeof() one.  But they're handy for initializing any
 * non-byte array.
 */
void memset_f4( volatile  FLT4 f4Array_a[],  FLT4 f4Value_a, SINT4 iCount_a ) ;
void memset_f8( volatile  FLT8 f8Array_a[],  FLT8 f8Value_a, SINT4 iCount_a ) ;
void memset_s4( volatile SINT4 s4Array_a[], SINT4 s4Value_a, SINT4 iCount_a ) ;
void memset_s2( volatile SINT2 s2Array_a[], SINT2 s2Value_a, SINT4 iCount_a ) ;
void memset_u4( volatile UINT4 u4Array_a[], UINT4 u4Value_a, SINT4 iCount_a ) ;
void memset_u2( volatile UINT2 u2Array_a[], UINT2 u2Value_a, SINT4 iCount_a ) ;


#ifdef STDARG_INCLUDED
/* Default size of message text */
#define MESSAGE_SIZE (160)
char *message_to_text		/* File: error_report.c */
( MESSAGE istatus_a, uint32_t icount_a, va_list ap ) ;
char *message_to_text_r		/* File: error_report.c */
( MESSAGE istatus_a, 
  char sMessageRet_a[],
  uint32_t isize_a,
  uint32_t icount_a,
  va_list ap ) ;
#endif

#define MSG_TYPE_INFO      (1)	/* Informational, do not pop-up */
#define MSG_TYPE_NORMAL    (2)	/* Normal, pop-up */
#define MSG_TYPE_SAY       (3)	/* pop-up and speak */
#define MSG_TYPE_IGNORE    (4)	/* Ignore entirely */

#define MSG_FAULT_NONE     (1)	/* No fault implications */
#define MSG_FAULT_WARNING  (2)	/* Warning-level fault */
#define MSG_FAULT_CRITICAL (3)	/* Critical-level fault */

void mneg_2_to_1		/* File: byteops.c */
( const void* in_a, void* out_a, SINT4 icount_a );
void mneg_4_to_1		/* File: byteops.c */
( const void* input, void* output, SINT4 count );
void movb_2_to_1		/* File: byteops.c */
( const void* input, void* output, SINT4 count );
void movb_4_to_1		/* File: byteops.c */
( const void* input, void* output, SINT4 count );
void movb_4_to_2                /* File: byteops.c */
(const void* in_a, void* out_a, SINT4 icount_a );
void move_neg_words		/* File: byteops.c */
( const void* input, void* output, SINT4 count );

/* Convert Julian day to month day */
void MonthDayFromJulian         /* File: timesubs.c */
( int iYear_a, int iYDay_a, int *piMonth_a, int*piDay_a );

void ServFromYmds             /* File: timesubs.c */
(volatile struct serv_ymds_time *pYmdsOut_a,
 volatile const struct ymds_time *pYmdsIn_a );

/* Terminal I/O support
 */
struct ttyspec {		/* Specifications for opening a TTY */
    char sDevice[PATHNAME_SIZE] ;	/*   Pathname of device/FIFO file */
    SINT4 iBaud ;			/*   Baud rate of the interface */
    UINT1 iParity ;		/*   One of TTYPARITY_XXX */
    char  iIntrChar ;		/*   Interrupt character, if non-null */
    UINT1 lLockDevice ;		/*   Lock the device */
    UINT1 lPreserveAll ;		/*   Make no changes to the TTY settings */
    UINT1 lReadOnly, lWriteOnly ;	/*   We will only be doing reads/writes */
    char  iProtocol ;		/*   Serial protocol, one of TTYPROTO_XXX */
    char  pad171x1[1] ;
} ;

#ifdef INCLUDE_TERMIOS_PROTOTYPES
struct ttydev {			/* An open TTY device */
    UINT1 lOpenOkay ;		/*   The device is opened successfully */
    UINT1 lRealTTY ;		/*   Real TTY, versus FIFO pair */
    char pad2x2[2] ;
    struct ttyspec spec ;		/*   Settings used to open the device */
    FILE *Tx, *Rx ;		/*   Send/Receive stream pointers */
    int  fdOrig ;			/*   File descriptor for lock/attributes */
    struct termios tioOrig ;	/*   Original TTY settings */
#ifdef LINUX
    char pad245x3[3] ;
#endif /* #ifdef LINUX */
} ;
MESSAGE   openTTYDev( struct ttydev *tty_a, const struct ttyspec *spec_a ) ;
MESSAGE  closeTTYDev( struct ttydev *tty_a ) ;
void   drainTxTTYDev( const struct ttydev *tty_a ) ;
void   flushRxTTYDev( const struct ttydev *tty_a ) ;
UINT1 lGetInfoTTYDev( const struct ttydev *tty_a, struct ttyspec *spec_a ) ;

#endif /* #ifdef INCLUDE_TERMIOS_PROTOTYPES */

UINT1 lReadAvailFD( int iFD_a, SINT4 iTimeoutMS_a ) ;
UINT1 lWriteFreeFD( int iFD_a, SINT4 iTimeoutMS_a ) ;

/* Real time vector modeling package (RTVEC) definitions
 */
#define RTVECMAXDIM          16	/* Maximum vector dimension */
#define RTVECMAXSLOTS       500	/* Maximum number of history slots */
#define RTVECMAXTIMESPAN  60000	/* Maximum time span within the model */
struct rtvec_dhdr {		/* Data vector header */
    UINT4 iBtime ;		/*   Binary time of this data point */
    UINT1 lValidData ;		/*   This data point is valid */
    char  pad5x3[3] ;
} ;
struct rtvec_info {		/* Information/Control structure */
    UINT4 iSlotWidthMS ;		/*   Slot width in milliseconds */
    SINT4 nSlots ;		/*   Number of data history slots */
    SINT4 iVecDim ;		/*   Dimension of data vectors */
    SINT4 iTopSlot ;		/*   Index of most recent slot */
    UINT1 iModulos[RTVECMAXDIM] ;	/*   Modulous interval for the data */
#define RTVEC_MOD_NONE   0	/*     None (linear floating values) */
#define RTVEC_MOD_UBIN   1	/*     UnSigned binary angle (0,+360) */
#define RTVEC_MOD_SBIN   2	/*     Signed binary angle (-180,+180) */
#define RTVEC_MOD_EBIN   3	/*     Elevation binary angle (-90,+270) */
} ;
#define RTVECALLOCATE( NSLOTS, VECDIM ) struct {                        \
        struct rtvec_info info ;					\
        struct { struct rtvec_dhdr dhdr ; FLT8 fData[ VECDIM ] ; }	\
            slots[ NSLOTS ] ; }

struct rtvec {			/* Per-process structure for model access */
    struct rtvec_info *info ;	/*   ==> The (public) model area */
    void *pLock, *pUnLock ;	/*   Optional Lock/Unlock routines */
} ;

void rtvecInitFirst		/* First time global inits */
( volatile struct rtvec_info *info_a, SINT4 nSlots_a, SINT4 iVecDim_a ) ;
void rtvecAttach		/* Per-process inits */
( struct rtvec *rtvec_a, volatile struct rtvec_info *info_a,
  void (*pLock_a)(void), void (*pUnLock_a)(void) ) ;
void rtvecInsertPoint
( struct rtvec *rtvec_a, UINT4 iBtime_a, const FLT8 fData_a[] ) ;
void rtvecJumpData
( struct rtvec *rtvec_a, const FLT8 fData_a[] );

#define RTVEC_LOOKUP_EMPTY        (0x0001)
#define RTVEC_LOOKUP_EXTRAPOLATE  (0x0002)
#define RTVEC_LOOKUP_SHORT        (0x0004)
UINT4 rtvecLookupPoint
( struct rtvec *rtvec_a, UINT4 iBtime_a, FLT8 fData_a[] ) ;

/* Message Queue routines
 */
MESSAGE msgQueCreate(UINT4 *imsgqid_a, const char *sname_a);
MESSAGE msgQueCreateFind(UINT4 *imsgqid_a, const char *sname_a);
MESSAGE msgQueFind(UINT4 *imsgqid_a, const char *sname_a);
MESSAGE msgQueSend(UINT4 imsgqid_a, const char *send_str);
MESSAGE msgQueRecv(UINT4 imsgqid_a, char **recv_str);
MESSAGE msgQueRemove(UINT4 imsgqid_a);
MESSAGE msgQueGetData(UINT4 imsgqid_a, UINT2 *inum_msgs_on_que_a);

char* nullify			/* File: str_subs.c */
(volatile const char* input,
 volatile const SINT4 isize );

char* nullify_ncpy		/* File str_subs.c */
(volatile char* output_a,
 volatile const char* input_a,
 const SINT4 isize_a );

#define SIGNAL_KILL_ON     (0x01)
#define SIGNAL_KILL_OFF    (0x00)
#define SIGNAL_RESTART_ON  (0x02)
#define SIGNAL_RESTART_OFF (0x00)
#define SIGNAL_MESSAGE_ON  (0x04)
#define SIGNAL_MESSAGE_OFF (0x00)
void OverrideSignalResponse     /* File: error_report.c */
(int iSignal_a,
 int iResponse_a );

void PolarFromEarth              /* File: sphere.c */
(volatile const struct latlon8 *Earth1_a,
 volatile const struct latlon8 *Earth2_a,
 volatile struct D2Polar8 *pPolar_a );
  
/* Given a starting point on the earth and a range and direction,
 * return the ending point.
 */
void polar_to_earth           /* File: sphere.c */
(volatile const struct latlon8 *Start_a,
 FLT8 frange_a,
 FLT8 fangle_a,
 volatile struct latlon8 *End_a) ;

void PrintFromString            /* File: str_subs.c */
( char *sPrintableString_a,    /* Printable String output */
  const char *sRawString_a,    /* Raw String input */
  SINT4 iOutLength_a );	       /* Length of the output string */


/** Count number of actual characters in UTF8 string */
size_t strlen_utf8(const char * str);

uint32_t rain_file_to_long		/* File: DataConvert.c */
(uint16_t iout );

void rain_long_to_file		/* File: DataConvert.c */
(const uint32_t *input,
 int32_t icount,
 uint16_t *iout );
    
typedef const char* (*message_translator_proc)( MESSAGE message_a ) ;

int register_message_translator  /* File: message_support.c */
( MESSAGE iFacility_a,
  message_translator_proc Translater_a );

UINT2 iPackIQFromFloatIQ_( FLT4 fIQVal_a, UINT4 iFlags_a ) ;
FLT4  fFloatIQFromPackIQ_( UINT2 iCode_a, UINT4 iFlags_a ) ;

void vecPackIQFromFloatIQ_
( volatile UINT2 iCodes_a[], volatile const FLT4 fIQVals_a[],
  SINT4 iCount_a, UINT4 iFlags_a ) ;
void vecFloatIQFromPackIQ_
( volatile FLT4 fIQVals_a[], volatile const UINT2 iCodes_a[],
  SINT4 iCount_a, UINT4 iFlags_a ) ;
void vecFloatIQFromPackIQ_comp
( volatile FLT4 fIQVals_a[], volatile const UINT2 iCodes_a[],
  SINT4 iCount_a, UINT4 iFlags_a ) ;

#define PACKIQ_HIGHSNR   0x0001	/* Use High-SNR packed format */
#define PACKIQ_BYTESWAP  0x0002	/* UINT2 data are byte-swapped */

void schedule_cbf               /* File: schedule.c */
( void (*callback_a)(int),
  SINT4 imilli_a );

void schedule_ef		/* File: schedule.c */
(UINT4 ief_a,
 SINT4 imilli_a );

char* sTaskScanName10_r         /* File: DataNames.c */
( UINT2 iscan_a, char sText_a[11] );

const char* sTaskScanName4_r    /* File: DataNames.c */
( SINT2 iscan_a, char sText_a[5] );

char* sDataName3		/* File: DataNames.c */
( UINT4 idata_a );

const char* sdata_name6         /* File: DataNames.C */
( uint32_t idata_a );

const char* sdata_name6_ns      /* File: DataNames.C */
( uint32_t idtype_a );

const char* sdata_name15	/* File: DataNames.c */
( UINT4 idata_a );

const char* sdata_name15_nls	/* File: DataNames.c */
( UINT4 idata_a );

const char* sdata_units8        /* File: DataNames.C */
( uint16_t idata_a,
  uint32_t iFlags_a );

const char* sdata_units8_nls    /* File: DataNames.C */
( uint16_t idata_a,
  uint32_t iFlags_a );

const char* sDataSpan12         /* File: DataNames.c */
( uint16_t idata_a,
  uint32_t iFlags_a );

#ifdef SIGMET_SIG_DATA_TYPES_H
const char* sDataSpanClass12    /* File: DataNames.c */
( uint16_t idata_a,
  uint32_t iFlags_a,
  enum classifier iClassifier_a );
#endif  /* #ifdef SIGMET_SIG_DATA_TYPES_H */

const char *sMonth3( SINT4 iMonth_a ) ;

/* Return a ddD hh:mm string, given the number of seconds.
 * Maximum displayable value is "99D 23:59". */
char* sddhhmm_r                 /* File: TimeNames.c */
( const SINT4 isec_a,
  char sBuffer_a[10] );  /* Result is 9 chars + null */
  
/* Convert character string to seconds. */
SINT4 iddhhmmss                 /* File: TimeNames.c */
( volatile const char* stime_a );
  
char* sddmonyyyy_r		/* File: TimeNames.c */
( SINT4 iyear_a,
  SINT4 imonth_a,
  SINT4 iday_a,
  char sBuffer_a[12] );

void set_say_on_error           /* File: error_report.c */
( UINT1 lsay_it_a );

MESSAGE SetTimeYmds		/* File: timesubs.c */
(volatile const struct ymds_time *pYmds_a);

char* sfilelist			/* File: fileops.c */
(const char *dir_a, const char* file_a, UINT2 lforward_a ) ;

#define TIMENAME_SIZE (25)
char* shhmmssmmm_ddmonyyyy      /* File: TimeNames.c */
( volatile const struct ymds_time *ymds_a,
  char sBuffer_a[TIMENAME_SIZE] );

char* shhmmssmmm_ddmonyyyy_serv /* File: TimeNames.c */
( volatile const struct serv_ymds_time *ymds_a,
  char sBuffer_a[TIMENAME_SIZE] );

char* shhmmssddmonyyyy_r	/* File: TimeNames.c */
(volatile const struct ymds_time *ymds,
 char sBuffer_a[TIMENAME_SIZE] );

char* shhmmssddmonyyyy_serv_r	/* File: TimeNames.c */
(volatile const struct serv_ymds_time *ymds,
 char sBuffer_a[TIMENAME_SIZE] );

char* shhmmddmonyyyy_r		/* File: TimeNames.c */
(volatile const struct ymds_time *ymds,
 char sBuffer_a[18] );

char* shhmmddmonyyyy_serv_r	/* File: TimeNames.c */
(volatile const struct serv_ymds_time *ymds,
 char sBuffer_a[18] );

char* shhmmssmmm_r		/* File: TimeNames.c */
( const SINT4 isec_a,
  UINT2 iMills_a,
  char sBuffer_a[13] );  /* Result is 12 chars + null */

char* shhmmss_r			/* File: TimeNames.c */
( const SINT4 isecs,
  char sBuffer_a[9] );  /* Result is 8 chars + null */

char* shhmm_r			/* File: TimeNames.c */
( const SINT4 isecs,
  char sBuffer_a[6] );  /* Result is 5 chars + null */

void shmsdmy_to_ymds		/* File: TimeNames.c */
(volatile const char*,
 volatile struct ymds_time *ymds );

MESSAGE sig_copy_file		/* File: fileops.c */
(const char *sdest_path_a,
 const char *source_path_a,
 UINT2 okay_to_clobber_a,
 UINT2 (*lstop_e)(void) ) ;

MESSAGE sig_copy_partial_file   /* File: fileops.c */
(const char *sdest_path_a,
 const char *source_path_a,
 UINT2 okay_to_clobber_a,
 UINT4 isize_a );

UINT2 sig_clref			/* File: semaphore.c */
( UINT4 num_a ) ;

UINT2 sig_readef		/* File: semaphore.c */
( UINT4 num_a ) ;

UINT2 sig_setef			/* File: semaphore.c */
( UINT4 num_a ) ;

void sig_waitef			/* File: semaphore.c */
( UINT4 num_a ) ;

#ifdef INCLUDE_UNISTD_PROTOTYPES
int sig_system_int
(const char *command_a,           /* Shell command to run */
 void (*watchdog_a)(pid_t iPid_a) );   /* Function which can interrupt the call*/
#endif  /* #ifdef INCLUDE_UNISTD_PROTOTYPES */

MESSAGE sig_closedir		/* File: fileops.c */
( void );

/* This clears initial state as needed for a daemon process
 */
MESSAGE sig_daemon_init(void);  /* File: process.c */

MESSAGE sig_delete_file		/* File: fileops.c */
(const char *spath_a );

MESSAGE sig_delete_file_wild	/* File: fileops.c */
(const char *sdirectory_a,
 const char *smatch_a );

#ifdef STDARG_INCLUDED
void sig_establish		/* File: error_report.c */
(MESSAGE (*handler_a)(MESSAGE istatus, UINT4 icount, va_list va ),
 const char *sprocess_a );
void sig_establish_opt
( MESSAGE (*handler_a)(MESSAGE istatus, UINT4 icount, va_list va ),
  const char *sprocess_a, UINT1 lTrapSignals_a ) ;
#endif

MESSAGE sig_free		/* In sig_subs.c */
(void* addr_a);

UINT2 sig_fnmatch		/* File: fileops.c */
( const char *wild_a, const char *name_a ) ;

MESSAGE sig_ftok		/* In shmem.c */
(const char *sname_a, SINT4 *key_a ) ;

int sig_fork_execv              /* In process.c */
(const char *spath_a,         /* Path of file to execute */
 char * const sargv_a[],      /* Vector of arguments to process */
 MESSAGE *istatus_a );        /* Error status returned here */

int sig_fork_execv_pipe  /* In process.c */
( const char *spath_a,       /* Program to execv */
  char * const sargv_a[],    /* Args to execv */
  int *pwrite_pipe_a,        /* Write end of pipe returned here, NULL if not wanted */
  int *pread_pipe_a,         /* Read end of pipe returned here, NULL if not wanted */
  MESSAGE *istatus_a);       /* Error return info */

MESSAGE sig_fork_process      /* In process.c */
(volatile UINT4 *ipid_a,    /* Process ID returned */
 const char *spath_a,	      /* Path of file to execute */
 const char *sname_a	      /* Process name, (supplied as second arg on UNIX platforms) */
    ) ;

MESSAGE sig_fork_daemon		/* Create a daemon (Parent = INIT) process */
( const char *spath_a,		/* Path of file to execute */
  const char *sname_a ) ;	/* Process name */

#ifdef INCLUDE_STDIO_PROTOTYPES
MESSAGE sig_init_serial         /* In sig_subs.c */
(const char *sdevice_a,
 FILE **pstream_a,
 UINT2 lwrite_a      /* Set to true if you are going to write, else false*/
    );
#endif  /* #ifdef INCLUDE_STDIO_PROTOTYPES */

MESSAGE sig_kill_process	/* In process.c */
(UINT4 ipid_a			/* Process ID to kill */
    ) ;

void sig_microSleep		/* File: schedule.c */
( SINT4 iMicroSeconds_a ) ;
void sig_microSleepExact	/* File: sig_microSleepExact.c */
( SINT4 iMicroSeconds_a ) ;

MESSAGE sig_malloc		/* In sig_subs.c */
(const UINT4 size_a,
 void**   addr_a) ;

MESSAGE sig_opendir		/* File: fileops.c */
(const char *sdirectory_a,
 const char *smatch_a );

/* Returns an educated guess of the largest file descriptor which
 * can be open.
 */
int sig_open_max(void);		/* File: process.c */

UINT2 sig_os_byteswap(void) ;	/* sig_subs.c */
int   sig_rand(void) ;		/* sig_subs.c */

void sig_periodicSleep		/* File: schedule.c */
( SINT4 iMicroSeconds_a, FLT8 *fLastWakeupSec_a ) ;

MESSAGE sig_readdir		/* File: fileops.c */
(char *spath_a,
 UINT4 path_len_a,
 UINT4* iname_a,
 UINT2* lvalid_a );

MESSAGE sig_run_as_operator(void) ;	/* In process.c */
MESSAGE sig_run_as_real    (void) ;    	/* In process.c */
MESSAGE sig_run_as_root    (void) ;	/* In process.c */

MESSAGE sig_setpriority( SINT4 ) ; /* In process.c */

MESSAGE sig_shmem_map		/* In shmem.c */
(UINT4   dessize_a,
 const char* sname_a,
 UINT2   lwrite_a,
 void**  actaddr_a,
 SINT4*  actsize_a,
 SINT4*  iden_a,
 UINT2*  lcreated_a) ;

MESSAGE sig_shmem_unmap        /* In shmem.c */
(volatile void*   addr_a,
 int32_t  size_a,
 int32_t  iden_a ) ;

MESSAGE sig_shmem_unmap_v      /* In shmem.c */
(volatile void*   addr_a,
 int32_t  size_a,
 int32_t  iden_a,
 uint8_t *lDestroyed_a);     /* Returns TRUE if we think we destroyed it */

#ifdef INCLUDE_SYSUTSNAME_PROTOTYPES
MESSAGE sig_uname		/* File: sig_subs.c */
( struct utsname *pName_a ) ;
#endif /* INCLUDE_SYSUTSNAME_PROTOTYPES */

const char *sig_username	/* In username.c */
( void ) ;

char *sigtok                    /* File: str_subs.c */
( char *sline_a, 
  UINT4 *ioffset_a );		/* Modifies offset each time. */

/* These are the 4 possible states which the socket connection can
 * cycle between.  SocketConnectNoBlock will signal when state
 * transitions are made.  Be sure to pass in the previous state.
 * For the first call, a good choice is to set it to OK.
 */
#define SIG_CONNECT_OK       (0)  /* Connected fine */
#define SIG_CONNECT_NOSERVER (1)  /* Host is reachable, but the server is off */
#define SIG_CONNECT_NOHOST   (2)  /* Host is not reachable */
#define SIG_CONNECT_ERROR    (3)  /* Error in socket call */
int SocketConnectNoBlock      /* In SocketConnect.c  */
( int iFamily_a,                /* Address family to use */
  const char *sHost_a,          /* Host name to connect to */
  UINT2       iPort_a,          /* Port number to connect to */
  void (*IoHandler)(int),       /* Handler for sigio signals */
  volatile UINT4 *istat_a );

int SocketConnectBlock     /* Returns the socket */
( int iFamily_a,                /* Address family to use */
  const char *sHost_a,          /* Host name to connect to */
  UINT2       iPort_a,          /* Port number to connect to */
  volatile UINT4 *istat_a       /* Status summary, suggest SIG_CONNECT_OK on first call */
    );

void SocketDisconnect         /* File: SocketConnect.c */
( int iSocket_a );

#ifdef INCLUDE_SYSSOCKET_PROTOTYPES
/* Function called each time the NoBlock listener wakes up.  If it returns
 * nonzero the listener will continue.
 */
typedef int (*ContinueTestProc)( void );
/* Function called each time an accept is called.  If it returns
 * a negative number, then the connection is rejected, and the
 * abs of the number is signaled as the max connection count.
 */
typedef int (*ConnectionTestProc)( const struct sockaddr_in *cliaddr_a );

typedef void (*ParentHandlerProc)( pid_t iChildPid_a, int iConnectNumber_a );

typedef void (*ConnectionHandlerProc)
( int iSocket_a, const struct sockaddr_in *cliaddr_a, int iConnectNumber_a );

void SocketListenBlock        /* File: SocketSupport.c */
(UINT2 iPort_a,		/* Port number to listen on */
 ConnectionTestProc    ConnectionTester_a,
 ConnectionHandlerProc ConnectionHandler_a,
 ParentHandlerProc     ParentHandler_a
    );

void SocketListenNoBlock	/* File: SocketSupport.c */
(UINT2 iPort_a,		/* Port number to listen on */
 UINT4 iEventFlag_a,		/* Event flag to block on */
 ContinueTestProc      lContinueTester_a,  /* Function to detect if we should return */
 ConnectionTestProc    ConnectionTester_a,
 ConnectionHandlerProc ConnectionHandler_a,
 ParentHandlerProc     ParentHandler_a
    );
#endif  /* #ifdef INCLUDE_SYSSOCKET_PROTOTYPES */


MESSAGE CheckSocketAck   /* File: SocketIo.c */
( const char *sBuffer_a,
  SINT4 iSize_a );

char *ReadSocketPacketTcp   /* File: SocketIo.c */
( int iSocket_a,
  SINT4 *pBufferSize_a,
  UINT1 lVerbose_a,
  SINT4 iTimeoutMS_a,     /* Timeout in milliseconds, 0=no timeout */
  UINT1 *pTimedOut_a      /* Flag to indicate that timeout happened */
    );

char *ReadSocketPacketUdp   /* File: SocketIo.c */
( int iSocket_a,
  SINT4 *pBufferSize_a,
  UINT1 lVerbose_a,
  UINT4 *pFromAddress_a,  /* From address returned in network byte order */
  SINT4 iTimeoutMS_a,     /* Timeout in milliseconds, 0=no timeout */
  UINT1 *pTimedOut_a      /* Flag to indicate that timeout happened */
    );

MESSAGE ReadSocketAck       /* File: SocketIo.c */
( int iSocket_a,
  UINT1 lVerbose_a,
  SINT4 iTimeoutMS_a );     /* Timeout in milliseconds, 0=no timeout */
  
MESSAGE WriteSocketData1   /* File: SocketIo.c */
(int iSocket_a,
 const char *pData_a,
 SINT4 iSize_a,
 UINT1 lVerbose_a );
  
MESSAGE WriteSocketString   /* File: SocketIo.c */
(int iSocket_a,
 const char *sString_a,
 UINT1 lVerbose_a );
  
MESSAGE WriteSocketData2    /* File: SocketIo.c */
(int iSocket_a,
 const char *pData1_a,
 SINT4 iSize1_a,
 const char *pData2_a,
 SINT4 iSize2_a,
 UINT1 lVerbose_a );

#define UDP_FLG_MULTICAST (0x0001)  /* Use multicast addresses */
#define UDP_FLG_UNICAST   (0x0002)  /* Do not allow broadcast addresses */

/* Open a socket for UDP reading
 */
#ifdef INCLUDE_NETINET_IN_PROTOTYPES
int OpenUdpReader
(UINT2 iPort_a,            /* Port number to read from */
 const char *sAddress_a,   /* Address to read from (can be 0.0.0.0 for any) */
 const char *sInterface_a, /* Interface name needed for multicasting only */
 struct in_addr *pAddress_a,/* Returns the local address for those who might want it */  
 int   iFlags_a
    );
#endif  /* #ifdef INCLUDE_NETINET_IN_PROTOTYPES */
/* Open a socket for UDP writing
 */
int OpenUdpWriter
(UINT2 iPort_a,             /* Port number to write to */
 const char *sAddress_a,    /* Address to write to */
 const char *sInterface_a,  /* Interface name needed for multicasting only */
 int   iFlags_a
    );

#ifdef INCLUDE_STDIO_PROTOTYPES
struct sig_logging_spec
{
    UINT1 lLogToFile;
    UINT1 lLogToTerm;
    UINT1 lVerbose;		/* Log more details */
    UINT1 lAppendToLog;		/* Append to previous log file */
    FILE *iLogFile;		/* Open file descriptor to log file */
};

void LoggingPrintf		/* File: SocketSupport.c */
( const struct sig_logging_spec *pLogging_a, const char *sString_a );

#endif  /* #ifdef INCLUDE_STDIO_PROTOTYPES */

void spacify_ncpy		/* File: str_subs.c */
( volatile char* output,
  volatile const char* input,
  const SINT4 isize );

const char* sProjectionName16     /* File: ProjectionNames.c */
( UINT1 iProjectionType_a );

const char* sProjectionName16_nls     /* File: ProjectionNames.c */
( UINT1 iProjectionType_a );

const char* sProjectionName3      /* File: ProjectionNames.c */
( UINT1 iprojection_type_a );

const char* sProjectionName3_nls      /* File: ProjectionNames.c */
( UINT1 iprojection_type_a );

const char* sProjectionName32     /* File: ProjectionNames.c */
( UINT1 iProjectionType_a );

const char* sProjectionName32_nls     /* File: ProjectionNames.c */
( UINT1 iProjectionType_a );

const char *sProj4Name            /* File: ProjectionNames.c */
(UINT1 iProjectionType_a);

/* Tell me if the projection uses the reference latitude. */
UINT1 lProjectionHasRefLat        /* File: ProjectionNames.c */
(UINT1 iProjectionType_a);

/* Tell me if the projection uses standard parallels */
UINT1 lProjectionHasStdPar        /* File: ProjectionNames.c */
(UINT1 iProjectionType_a);

/* Get name and value for one of the standard ellipses.
 * Can produce up to IMAP_EARTH_ELLIPSE_COUNT different values. */
FLT8 fGetEllipseByIndex   /* Returns radius here */
(char sName_a[16],       /* Returns name here */
 FLT8 *fFlattening_a,    /* Returns flattening here */
 UINT4 iIndex_a);

/* Get the origin 0 index for one of the standard ellipses.
 * Can produce up to IMAP_EARTH_ELLIPSE_COUNT different values.
 * Returns -1 if not found. */
SINT4 iGetEllipseByName 
( const char sName_a[16] );

void StringFromPrint              /* File: str_subs.c */
( char *sRawString_a,              /* Raw output strint to fill in */
  const char *sPrintableString_a,  /* Printable input string */
  SINT4 iOutLength_a );		   /* Length of the output string */

void strcpy_filesafe           /* File: strsubs.c */
(char* sOutput_a,
 const char* sInput_a );

const char* strmessage           /* File: message_support.c */
(MESSAGE istatus_a);

void strncpy_filter
( char* output_a, const char* input_a, SINT4 isize_a );
void strncpy_safe
( char* output_a, const char* input_a, SINT4 isize_a );
void strnpad
( char* output_a, const char* input_a, SINT4 isize_a );

SINT2 iSwapS2(SINT2 iWord_a); /* File: swap.c */

void SwapS2(SINT2 *pWord_a);
void SwapU2(UINT2 *pWord_a);

void SwapF4(FLT4  *pWord_a);
void SwapS4(SINT4 *pWord_a);
void SwapU4(UINT4 *pWord_a);

/* Copy and swap an array
 */
void SwapS2cpy
( SINT2 *pOut_a, const SINT2 *pIn_a, SINT4 iCount_a  ) ;

void SwapS2Array( SINT2 *pOut_a, SINT4 iCount_a ) ;
void SwapU2Array( UINT2 *pOut_a, SINT4 iCount_a ) ;
void SwapS4Array( SINT4 *pOut_a, SINT4 iCount_a ) ;
void SwapU4Array( UINT4 *pOut_a, SINT4 iCount_a ) ;


void TZNameBuild
( char sTZNameOut_a[TZNAME_SIZE],
  const char *sTZNameIn_a,	/* Local TZ name */
  SINT4 iMinutesWest_a,		/* Recorded TZ offset */
  UINT2 iFlags_a );             /* Flags indicating the type of TZ recording */

UINT4 iunique_sum		/* File: byteops.c */
( const void *array_a, SINT4 count_a ) ;

MESSAGE uncompress_cowords	/* File: compress.c */
(void get_a( SINT2 *buf_a, SINT4 cnt_a), /* Input coroutine */
 SINT4 insize_a,               /* Maximum # usable words from input buffer */
 SINT4 *inlen_a,		/* Number of words read from INBUF */
 SINT2 ioutbuf_a[],		/* Output array to hold UnCompressed data */
 SINT4 ioutsize_a,             /* Maximum # usable words from output buffer */
 SINT4 *ioutlen_a) ;		/* Number of words written to IOUTBUF */

MESSAGE uncompress_cowords_skip	/* File: compress.c */
(void get_a( SINT2 *buf_a, SINT4 cnt_a), /* Input coroutine */
 SINT4 insize_a,               /* Maximum # usable words from input buffer */
 SINT4 *inlen_a,		/* Number of words read from INBUF */
 SINT4 *ioutlen_a) ;		/* Number of words written to IOUTBUF */

MESSAGE uncompress_words	/* File: compress.c */
(SINT2 inbuf_a[],		/* Input array of data to be uncompressed */
 SINT4 insize_a,               /* Maximum # usable words from input buffer */
 SINT4 *inlen_a,		/* Number of words read from INBUF */
 SINT2 ioutbuf_a[],		/* Output array to hold UnCompressed data */
 SINT4 ioutsize_a,             /* Maximum # usable words from output buffer */
 SINT4 *ioutlen_a) ;		/* Number of words written to IOUTBUF */

MESSAGE uncompress_words_skip	/* File: compress.c */
(SINT2 inbuf_a[],		/* Input array of compressed data */
 SINT4 insize_a,               /* Maximum # usable words from input buffer */
 SINT4 *inlen_a,		/* Number of words read from INBUF */
 SINT4 *ioutlen_a) ;		/* Number of words of output that would have
                                   resulted, had the data been UnCompressed. */

void unlevelize_4bit		/* In file unlevelize.c */
( const UINT1* pix_a,		/* Array of pixels */
  UINT4 pnum_a,			/* Number of pixels in PIX_A (may be odd or even) */
  const void* pmap_a,  		/* 16-element mapping table of bytes, words, or longs */
  UINT4 bwl_a,			/* 8, 16, or 32, conveying size of items in OUTPUT_A. */
  void* output_a		/* Resulting array of data */
    );

void unlevelize_8bit		/* In file unlevelize.c */
( const UINT1* byte_a,		/* Array of bytes */
  UINT4 pnum_a,			/* Number of pixels in PIX_A (may be odd or even) */
  const UINT4 pmap_a[256],     /* 256-element mapping table */
  UINT4 bwl_a,			/* 8, 16, or 32, conveying size of items in OUTPUT_A. */
  void* output_a		/* Resulting array of data */
    );

void unlock_sem			/* File: semaphore.c */
( UINT4 num_a ) ;

void unpacktime			/* File timesubs.c */
(UINT4           isec_a, 
 volatile UINT2* idays,
 volatile UINT2* ihours,
 volatile UINT2* iminutes,
 volatile UINT2* iseconds
    );

void user_lib_nls_init(void);  /* File: user_lib_message_init.c */
#define USER_LIB_INIT user_lib_nls_init()

/* Convert SIGMET ymds time structure to UTC.  It may already be so.
 */
void UtcFromYmds               /* File: timesubs.c */
( struct ymds_time *pYmdsUtcOut_a,
  const struct ymds_time *pYmdsIn_a,
  SINT4 iMinutesWest_a );          /* Time offset to standard time */

enum HELP_ENUM {
    HELP_MENU,
    HELP_CONTEXT,
    HELP_INDEX
};

enum MANUALS_ENUM {
    MANUALS_IRIS,
    MANUALS_UTIL,
    MANUALS_PROG,
    MANUALS_INST,
    MANUALS_NOTE,
    MANUALS_RCP8,
    MANUALS_RVP8,
    MANUALS_RVP900,
    MANUALS_IRISRAD,
    MANUALS_EXTRA,
    MANUALS_DUALPOL
};

#define MANUALS_IRIS_NAME    "IRIS_Product_and_Display_Manuals.pdf"
#define MANUALS_UTIL_NAME    "IRIS_and_RDA_Utilities_Manual.pdf"
#define MANUALS_PROG_NAME    "IRIS_Programmers_Manual.pdf"
#define MANUALS_INST_NAME    "Software_Installation_Manual.pdf"
#define MANUALS_NOTE_NAME    "release_notes/"
#define MANUALS_RCP8_NAME    "RCP8_Users_Manual.pdf"
#define MANUALS_RVP8_NAME    "RVP8_Users_Manual.pdf"
#define MANUALS_RVP900_NAME  "RVP900_Users_Manual.pdf"
#define MANUALS_IRISRAD_NAME "IRIS_Radar_Manual.pdf"
#define MANUALS_EXTRA_NAME   "extraspdf/"
#define MANUALS_DUALPOL_NAME "IRIS_and_RDA_Dual_Polarization_Users_Manual.pdf"

#ifdef USE_PDF_TAGS
#define MANFILE_DUMMY "dumfilename"
#else
#define MANFILE_DUMMY ""
#endif

/* IRIS/Radar related menus(MANUALS_IRISRAD):
   Adding (not yet used):
   MANFILE_IRISRAD_TSC_MON
*/
#ifdef USE_PDF_TAGS
#define MANFILE_IRISRAD_RUNNING  "IRISMenubar"
#define MANFILE_IRISRAD_SIGAUDIO "AudioSetupUtility"
#define MANFILE_IRISRAD_IRISNET  "IRISNetUtility"
#define MANFILE_IRISRAD_RST      "RadarStatusMenu"
#define MANFILE_IRISRAD_MESSAGE  "MessageMenu"
#define MANFILE_IRISRAD_TCF      "TaskConfigMenu"
#define MANFILE_IRISRAD_TSC      "TSCEditorMenu"
#define MANFILE_IRISRAD_TSC_MON  "TSCMonitorMenu"
#else
#define MANFILE_IRISRAD_RUNNING  "2running.pdf"
#define MANFILE_IRISRAD_SIGAUDIO "2running.pdf"
#define MANFILE_IRISRAD_IRISNET  "3irisnet.pdf"
#define MANFILE_IRISRAD_RST      "4radstat.pdf"
#define MANFILE_IRISRAD_MESSAGE  "5errors.pdf"
#define MANFILE_IRISRAD_TCF      "6tskconf.pdf"
#define MANFILE_IRISRAD_TSC      "7tskschd.pdf"
#define MANFILE_IRISRAD_TSC_MON  "7tskschd.pdf"
#endif

/* Other IRIS menubar menus(MANUALS_IRISPROD): */
#ifdef USE_PDF_TAGS
#define MANFILE_IRIS_DPYOPT     "DisplayOptionsMenu"
#define MANFILE_IRIS_ISM        "IngestSummaryMenu"
#define MANFILE_IRIS_OVR        "OverlayMenu"
#define MANFILE_IRIS_POM        "ProductOutMenu"
#define MANFILE_IRIS_PSC        "ProductSchedMenu"
#define MANFILE_IRIS_TAP        "ArchiveMenu"
#define MANFILE_IRIS_INTRO      "Introduction"
#define MANFILE_IRIS_PRJ        "MapProjections"
#else
#define MANFILE_IRIS_DPYOPT     "6prdout.pdf"
#define MANFILE_IRIS_ISM        "8ingest.pdf"
#define MANFILE_IRIS_OVR        "9overly.pdf"
#define MANFILE_IRIS_POM        "6prdout.pdf"
#define MANFILE_IRIS_PSC        "4prodsch.pdf"
#define MANFILE_IRIS_TAP        "7archiv.pdf"
#define MANFILE_IRIS_INTRO      "1intro.pdf"
#define MANFILE_IRIS_PRJ        "2prodcon.pdf"
#endif

/* All the different product configuration menus(MANUALS_IRISPROD): */
#ifdef USE_PDF_TAGS
#define MANFILE_IRIS_PCF_BASE    "pcfBASEmenu"
#define MANFILE_IRIS_PCF_BEAM    "pcfBEAMmenu"
#define MANFILE_IRIS_PCF_CAPPI   "pcfCAPPImenu"
#define MANFILE_IRIS_PCF_CATCH   "pcfCATCHmenu"
#define MANFILE_IRIS_PCF_COMP    "pcfCOMPmenu"
#define MANFILE_IRIS_PCF_DWELL   "pcfDWELLmenu"
#define MANFILE_IRIS_PCF_FCAST   "pcfFCASTmenu"
#define MANFILE_IRIS_PCF_HMAX    "pcfHMAXmenu"
#define MANFILE_IRIS_PCF_LAYER   "pcfLAYERmenu"
#define MANFILE_IRIS_PCF_MAX     "pcfMAXmenu"
#define MANFILE_IRIS_PCF_MLHGT   "pcfMLHGTmenu"
#define MANFILE_IRIS_PCF_NDOP    "pcfNDOPmenu"
#define MANFILE_IRIS_PCF_PPI     "pcfPPImenu"
#define MANFILE_IRIS_PCF_RAIN1   "pcfRAIN1menu"
#define MANFILE_IRIS_PCF_RAINN   "pcfRAINNmenu"
#define MANFILE_IRIS_PCF_RAW     "pcfRAWmenu"
#define MANFILE_IRIS_PCF_RHI     "pcfRHImenu"
#define MANFILE_IRIS_PCF_RTI     "pcfRTImenu"
#define MANFILE_IRIS_PCF_SHEAR   "pcfSHEARmenu"
#define MANFILE_IRIS_PCF_SLINE   "pcfSLINEmenu"
#define MANFILE_IRIS_PCF_SRI     "pcfSRImenu"
#define MANFILE_IRIS_PCF_THICK   "pcfTHICKmenu"
#define MANFILE_IRIS_PCF_TOPS    "pcfTOPSmenu"
#define MANFILE_IRIS_PCF_TRACK   "pcfTRACKmenu"
#define MANFILE_IRIS_PCF_VAD     "pcfVADmenu"
#define MANFILE_IRIS_PCF_VIL     "pcfVILmenu"
#define MANFILE_IRIS_PCF_VVP     "pcfVVPmenu"
#define MANFILE_IRIS_PCF_WARN    "pcfWARNmenu"
#define MANFILE_IRIS_PCF_WIND    "pcfWINDmenu"
#define MANFILE_IRIS_PCF_XSECT   "pcfXSECTmenu"
#else
#define MANFILE_IRIS_PCF_BASE    "22base.pdf"
#define MANFILE_IRIS_PCF_BEAM    "23beam.pdf"
#define MANFILE_IRIS_PCF_CAPPI   "24cappi.pdf"
#define MANFILE_IRIS_PCF_CATCH   "31catch.pdf"
#define MANFILE_IRIS_PCF_COMP    "32comp.pdf"
#define MANFILE_IRIS_PCF_DWELL   "33dwell.pdf"
#define MANFILE_IRIS_PCF_FCAST   "25fcast.pdf"
#define MANFILE_IRIS_PCF_HMAX    "26hmax.pdf"
#define MANFILE_IRIS_PCF_LAYER   "27layer.pdf"
#define MANFILE_IRIS_PCF_MAX     "28max.pdf"
#define MANFILE_IRIS_PCF_MAX     "XXmlhgt.pdf"
#define MANFILE_IRIS_PCF_NDOP    "34ndop.pdf"
#define MANFILE_IRIS_PCF_PPI     "29ppi.pdf"
#define MANFILE_IRIS_PCF_RAIN1   "210rain1.pdf"
#define MANFILE_IRIS_PCF_RAINN   "211rainn.pdf"
#define MANFILE_IRIS_PCF_RAW     "212raw.pdf"
#define MANFILE_IRIS_PCF_RHI     "213rhi.pdf"
#define MANFILE_IRIS_PCF_RTI     "214rti.pdf"
#define MANFILE_IRIS_PCF_SHEAR   "35shear.pdf"
#define MANFILE_IRIS_PCF_SLINE   "36sline.pdf"
#define MANFILE_IRIS_PCF_SRI     "215sri.pdf"
#define MANFILE_IRIS_PCF_THICK   "217thick.pdf"
#define MANFILE_IRIS_PCF_TOPS    "218tops.pdf"
#define MANFILE_IRIS_PCF_TRACK   "219track.pdf"
#define MANFILE_IRIS_PCF_VAD     "220vad.pdf"
#define MANFILE_IRIS_PCF_VIL     "221vil.pdf"
#define MANFILE_IRIS_PCF_VVP     "222vvp.pdf"
#define MANFILE_IRIS_PCF_WARN    "223warn.pdf"
#define MANFILE_IRIS_PCF_WIND    "224wind.pdf"
#define MANFILE_IRIS_PCF_XSECT   "225xsect.pdf"
#endif

/* Quick Look Window (MANUALS_IRISPROD):
   Adding (not yet used):
   MANFILE_WIN_DPYOPT_CAPPI
   MANFILE_WIN_DPYOPT_NDOP
   MANFILE_WIN_DPYOPT_VAD
   MANFILE_WIN_DPYOPT_WARN
*/
#ifdef USE_PDF_TAGS
#define MANFILE_WIN_APPLSHELL    "QuickLookWindow"
#define MANFILE_WIN_ANIM         "QLWAnimationMenu"
#define MANFILE_WIN_CATCH        "QLWCATCHPopup"
#define MANFILE_WIN_CURS         "QLWCursorMenu"
#define MANFILE_WIN_DPYOPT       "QLWDPYOptionsMenu"
#define MANFILE_WIN_DPYOPT_VVP   "QLWDPYVVPMenu"
#define MANFILE_WIN_DPYOPT_WND   "QLWDPYWINDMenu"
#define MANFILE_WIN_DPYOPT_CAPPI "QLWDPYCAPPIMenu"
#define MANFILE_WIN_DPYOPT_NDOP  "QLWDPYNDOPMenu"
#define MANFILE_WIN_DPYOPT_VAD   "QLWDPYVADMenu"
#define MANFILE_WIN_DPYOPT_WARN  "QLWDPYWARNMenu"
#define MANFILE_WIN_DPYOPT_COLR  "QLWColorScaleMenu"
#define MANFILE_WIN_EXPORT       "QLWExportMenu"
#define MANFILE_WIN_FCAST        "QLWForecastMenu"
#define MANFILE_WIN_LIVE         "QLWLiveActionMenu"
#define MANFILE_WIN_LONLAT       "QLWCursorSetMenu"
#define MANFILE_WIN_MULTI        "QLWProdOverMenu"
#define MANFILE_WIN_SLIDE        "QLWSlideShowMenu"
#define MANFILE_WIN_TRACK        "QLWTrackMenu"
#define MANFILE_WIN_XSECT        "QLWXSectMenu"
#define MANFILE_IRIS_RIB_SETUP   "RibbonSetupUtility"
#define MANFILE_IRIS_RUNWAYS     "RunwaysUtility"
#define MANFILE_IRIS_VIR_RIB     "VribbonUtility"
#else
#define MANFILE_WIN_APPLSHELL    "5qlw.pdf"
#define MANFILE_WIN_ANIM         "53qlanim.pdf"
#define MANFILE_WIN_CATCH        "31catch.pdf"
#define MANFILE_WIN_CURS         "55qlcurs.pdf"
#define MANFILE_WIN_DPYOPT       "52qldisp.pdf"
#define MANFILE_WIN_DPYOPT_VVP   "59qlopt.pdf"
#define MANFILE_WIN_DPYOPT_WND   "59qlopt.pdf"
#define MANFILE_WIN_DPYOPT_CAPPI "59qlopt.pdf"
#define MANFILE_WIN_DPYOPT_NDOP  "59qlopt.pdf"
#define MANFILE_WIN_DPYOPT_VAD   "59qlopt.pdf"
#define MANFILE_WIN_DPYOPT_WARN  "59qlopt.pdf"
#define MANFILE_WIN_DPYOPT_COLR  "51qlcol.pdf" /* Color Scale Tool */
#define MANFILE_WIN_EXPORT       "510qlexp.pdf"
#define MANFILE_WIN_FCAST        "57qlforc.pdf"
#define MANFILE_WIN_LIVE         "5qlw.pdf"
#define MANFILE_WIN_LONLAT       "5qlw.pdf"  /*Cursor Set/Plant Tool*/
#define MANFILE_WIN_MULTI        "5qlw.pdf"
#define MANFILE_WIN_SLIDE        "54qlslid.pdf"
#define MANFILE_WIN_TRACK        "56qltrak.pdf"
#define MANFILE_WIN_XSECT        "58qlxsec.pdf"
#define MANFILE_IRIS_RIB_SETUP   "etdwr.pdf"
#define MANFILE_IRIS_RUNWAYS     "etdwr.pdf"
#define MANFILE_IRIS_VIR_RIB     "etdwr.pdf"
#endif

/* TAGS for utility programs (MANUALS_UTIL):
   Adding (not yet used):
   MANFILE_UTIL_COLOR_HCLASS
*/
#ifdef USE_PDF_TAGS
#define MANFILE_UTIL_ANTENNA          "AntennaUtility"
#define MANFILE_UTIL_ASCOPE           "AscopeUtility"
#define MANFILE_UTIL_BITEX            "BitexUtility"
#define MANFILE_UTIL_COLOR_SPECIAL    "SpecialColorsMenu"
#define MANFILE_UTIL_COLOR_APPLSHELL  "ColorUtility"
#define MANFILE_UTIL_COLOR_SET        "ColorSetMenu"
#define MANFILE_UTIL_COLOR_HCLASS     "HydroClassNameMenu"
#define MANFILE_UTIL_RTDISP           "RtdispUtility"
#define MANFILE_SETUP_INTRO           "SetupUtility"
#define MANFILE_SETUP_DSP             "SetupDspMenu"
#define MANFILE_SETUP_RCP             "SetupInputMenu"
#define MANFILE_SETUP_INPUT           "SetupRcpMenu"
#define MANFILE_SETUP_IRIS            "SetupGeneralMenu"
#define MANFILE_SETUP_LICENSE         "SetupLicenseMenu"
#define MANFILE_SETUP_INGEST          "SetupIngestMenu"
#define MANFILE_SETUP_PRODUCT         "SetupProductMenu"
#define MANFILE_SETUP_OUTPUT          "SetupOutputMenu"
#define MANFILE_RCP8_SWITCHING_MENU   "SwitchingMenu"
#define MANFILE_UTIL_UTILS            "UtilsUtility"
#define MANFILE_UTIL_ZAUTO7           "ZautoUtility"
#else
#define MANFILE_UTIL_ANTENNA          "2antenna.pdf"
#define MANFILE_UTIL_ASCOPE           "3ascope.pdf"
#define MANFILE_UTIL_BITEX            "4bitex.pdf"
#define MANFILE_UTIL_COLOR_SPECIAL    "5colors.pdf"
#define MANFILE_UTIL_COLOR_APPLSHELL  "5colors.pdf"
#define MANFILE_UTIL_COLOR_SET        "5colors.pdf"
#define MANFILE_UTIL_COLOR_HCLASS     "5colors.pdf"
#define MANFILE_UTIL_RTDISP           "8rtdisp.pdf"
#define MANFILE_SETUP_INTRO           "9setup.pdf"
#define MANFILE_SETUP_DSP             "92rvp.pdf"
#define MANFILE_SETUP_RCP             "93rcp.pdf"
#define MANFILE_SETUP_INPUT           "94in.pdf"
#define MANFILE_SETUP_IRIS            "95gen.pdf"
#define MANFILE_SETUP_LICENSE         "96lic.pdf"
#define MANFILE_SETUP_INGEST          "97ing.pdf"
#define MANFILE_SETUP_PRODUCT         "98pro.pdf"
#define MANFILE_SETUP_OUTPUT          "99out.pdf"
#define MANFILE_UTIL_UTILS            "1intro.pdf"
#define MANFILE_RCP8_SWITCHING_MENU   "dummy.pdf"
#define MANFILE_UTIL_ZAUTO7           "12zauto7.pdf"
#endif 

/* TAGS for Installation manual (MANUALS_INST): */
#ifdef USE_PDF_TAGS
#define MANFILE_INST_SIGPRINTER       "PrintSetupUtility"
#define MANFILE_INST_SIGBRU           "SigbruUtility"
#else
#define MANFILE_INST_SIGPRINTER       "cprinter.pdf"
#define MANFILE_INST_SIGBRU           "dsigbru.pdf"
#endif

/* TAGS for RVP900 manual (MANUALS_RVP900): */
#ifdef USE_PDF_TAGS
#define MANFILE_RVP900_TSARCH         "TsarchiveUtility"
#define MANFILE_RVP900_TSSWITCH       "TsSwitchUtility"
#else
#define MANFILE_RVP900_TSARCH         "ftsarch.pdf"
#define MANFILE_RVP900_TSSWITCH       "dummy.pdf"
#endif

void helpStart(int imanual_a, const char *stag_name_a, int ioption_type_a);
void helpExit(void);


/* Functions used to read/write VAX formats.  These deal with
 * byte swapping, byte alignment, and the floating point format.
 */
UINT2 GetVaxUint2( const UINT1 p[]);
UINT4 GetVaxUint4( const UINT1 p[]);
FLT4 GetVaxFlt4( const UINT1 p[]);
void PutVaxUint2( UINT1 p[], UINT2 value);
void PutVaxUint4( UINT1 p[], UINT4 value);
void PutVaxFlt4( UINT1 p[], FLT4 number);

void YmdsAddMs                  /* In file: timesubs.c */
( SINT4 iMillSec_a, 
  volatile struct ymds_time *ymds_a );

void YmdsFromServ               /* In file: timesubs.c */
(volatile struct ymds_time *pYmdsOut_a,
 volatile const struct serv_ymds_time *pYmdsIn_a );

#ifdef INCLUDE_TIME_PROTOTYPES
void YmdsFromTm                /* In file: timesubs.c */
(struct ymds_time *pYmds_a,
 const struct tm *pTm_a,
 uint16_t iMilliseconds_a,
 enum time_type_enum iFlags_a );
#endif  /* #ifdef INCLUDE_TIME_PROTOTYPES */

#ifdef INCLUDE_SYSTIME_PROTOTYPES
void YmdsFromTime_t            /* In file: timesubs.c */
(struct ymds_time *pYmds_a,
 time_t iTime_a,
 uint16_t iMilliseconds_a, 
 enum time_type_enum iFlags_a );

time_t time_tFromYmds          /* In file: timesubs.c */
(volatile const struct ymds_time *pYmds_a,
 MESSAGE *iStatus_a );
#endif  /* #ifdef INCLUDE_SYSTIME_PROTOTYPES */

#ifdef INCLUDE_TIME_PROTOTYPES
time_t time_tAndTmFromYmds
(volatile const struct ymds_time *pYmds_a,
 struct tm *pUnpackedTime_a,
 long timezone_a);  /* Time offset of local time in seconds west */

time_t TmFromYmds
(volatile const struct ymds_time *pYmds_a,
 struct tm *pUnpackedTime_a);
#endif  /* #ifdef INCLUDE_TIME_PROTOTYPES */

void ymds_add_seconds		/* In file timesubs.c */
( SINT4 ioffset_a,
  volatile struct ymds_time* time_a );

/* --------------------------------------------------------------
 * ---------------- Custom Shared DSP Support -------------------
 * --------------------------------------------------------------
 *
 * These DSP related routines reside in the USER library for the benefit
 * of applications that are forbidden to link to the DSP library (e.g.,
 * RVP8/Main and RVP8/Proc).
 */
#ifdef SIGMET_DSP_H

#define BATCHOPARGLENGTH   11	/* Length of 16-bit encoding */
#define BATCHOPARGSET  0x2000 	/* Opcode bits for SET */
#define BATCHOPARGGET  0x1000 	/* Opcode bits for GET */

void dspDecodeBatchOpcode
( volatile struct dspBatchSetup *pUser_a,
  const UINT2 args_a[], SINT4 nArgs_a ) ;

SINT4 dspEncodeBatchOpcode
( volatile const struct dspBatchSetup *pUser_a,
  UINT2 args_a[ BATCHOPARGLENGTH ] ) ;

void dspDecodeSpecFilt
( volatile struct dspSpecFilt *pUser_a,
  volatile const struct dspSpecFiltIO *pCode_a ) ;

void dspEncodeSpecFilt
( volatile struct dspSpecFiltIO *pCode_a,
  volatile const struct dspSpecFilt *pUser_a ) ;


MESSAGE dspEncodeML
( const char* pName, 
  const void* ptrProduct_a,    
  const struct rvpxMLinfo *pMLinfo_a,
  const float *pR_a, 
  const BIN2 *pStaticAngs_a, 
  const BIN2 *pRayAngs_a, 
  uint8_t *pMLbuffer_a );
#endif /* #ifdef SIGMET_DSP_H */

#ifdef __cplusplus
}
#endif
#endif /* #ifndef SIGMET_USER_LIB_H */
