/* *********************************************************************
 * *	                                                               *
 * *               Definitions for "iris/misc" Library                 *
 * *                                                                   *
 * *********************************************************************
 * File: include/misc_lib.h
 *
 *      COPYRIGHT (c) 1989, 1990, 1992, 1995, 1996, 1997, 1998, 1999,
 *               2000, 2001, 2002, 2003, 2004, 2006 BY
 *             VAISALA INC, WESTFORD MASSACHUSETTS, U.S.A.
 * 
 * THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND  COPIED
 * ONLY  IN  ACCORDANCE WITH  THE  TERMS  OF  SUCH  LICENSE  AND WITH THE
 * INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE  OR  ANY OTHER
 * COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
 * OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY
 * TRANSFERED.
 */
#ifndef SIGMET_MISC_LIB_H
#define SIGMET_MISC_LIB_H 1

#ifdef __cplusplus
extern "C" {
#endif


#define      BAD_COLORCNT   1
#define IRIS_BAD_COLORCNT   (IRIS_FACILITY + BAD_COLORCNT)
#define      BAD_PALETTE    2
#define IRIS_BAD_PALETTE    (IRIS_FACILITY + BAD_PALETTE)
#define      BAD_SEAM       3
#define IRIS_BAD_SEAM       (IRIS_FACILITY + BAD_SEAM )
#define      BWL_LEV        4
#define IRIS_BWL_LEV        (IRIS_FACILITY + BWL_LEV)
#define      CASE_DATA      5
#define IRIS_CASE_DATA      (IRIS_FACILITY + CASE_DATA)
#define      INGD_DUP       6
#define IRIS_INGD_DUP       (IRIS_FACILITY + INGD_DUP)
#define      INGD_FULL      7
#define IRIS_INGD_FULL      (IRIS_FACILITY + INGD_FULL)
#define      INGEST_DATA    8
#define IRIS_INGEST_DATA    (IRIS_FACILITY + INGEST_DATA)
#define      NODECOMP       9
#define IRIS_NODECOMP       (IRIS_FACILITY + NODECOMP)
#define      NOLICENSE      10
#define IRIS_NOLICENSE      (IRIS_FACILITY + NOLICENSE)
#define      NOR_AREA_FILE  11
#define IRIS_NOR_AREA_FILE  (IRIS_FACILITY + NOR_AREA_FILE)
#define      NOR_ERROR      12
#define IRIS_NOR_ERROR      (IRIS_FACILITY + NOR_ERROR)
#define      PRM_CONVPTR    13
#define IRIS_PRM_CONVPTR    (IRIS_FACILITY + PRM_CONVPTR)
#define      PRM_NOCONVERT  14
#define IRIS_PRM_NOCONVERT  (IRIS_FACILITY + PRM_NOCONVERT)
#define      PROD_XYSIZE    15
#define IRIS_PROD_XYSIZE    (IRIS_FACILITY + PROD_XYSIZE)
#define      PROD_ZSIZE     16
#define IRIS_PROD_ZSIZE     (IRIS_FACILITY + PROD_ZSIZE)
#define      RAW_WRITE      17
#define IRIS_RAW_WRITE      (IRIS_FACILITY + RAW_WRITE)
#define      RAW_CREATE     18
#define IRIS_RAW_CREATE     (IRIS_FACILITY + RAW_CREATE)
#define      RAW_BIGRAY     19
#define IRIS_RAW_BIGRAY     (IRIS_FACILITY + RAW_BIGRAY)
#define      VCV_FILE_SIZE  20
#define IRIS_VCV_FILE_SIZE  (IRIS_FACILITY + VCV_FILE_SIZE )
#define      VCV_IPTYPE     21
#define IRIS_VCV_IPTYPE     (IRIS_FACILITY + VCV_IPTYPE )
#define      VCV_ISCAN      22
#define IRIS_VCV_ISCAN      (IRIS_FACILITY + VCV_ISCAN  )
#define      VCV_NOHDR      23
#define IRIS_VCV_NOHDR      (IRIS_FACILITY + VCV_NOHDR  )
#define      VCV_NOPROD     24
#define IRIS_VCV_NOPROD     (IRIS_FACILITY + VCV_NOPROD )
#define      VCV_OP         25
#define IRIS_VCV_OP         (IRIS_FACILITY + VCV_OP     )
#define      VCV_STNAME     26
#define IRIS_VCV_STNAME     (IRIS_FACILITY + VCV_STNAME )
#define      VCV_INTERR     27
#define IRIS_VCV_INTERR     (IRIS_FACILITY + VCV_INTERR )
#define      PRODUCT_NOOVER 28
#define IRIS_PRODUCT_NOOVER (IRIS_FACILITY + PRODUCT_NOOVER)
#define      TCF_THRESHOLD  29
#define IRIS_TCF_THRESHOLD  (IRIS_FACILITY + TCF_THRESHOLD )

#ifndef MESSAGE_ONLY

/* Used to get a group of arenas implied by one protected area */
struct one_arena
{
  UINT1 lValid;
  UINT1 iArenaIndex;  /* index of arena along runway, (1-7), 0=not runway*/
  UINT4 iSetupMask;   /* bit indicating which (if any) protect_setup structure */
  char  sCorridor[16];
  char  sArena[16];
};

/* Filter information used in the 2-D filter routines in filters.c
 */
struct filter_info
{
  SINT4 asum, bsum ;	     /* Weighted sum of X terms (two sums in case of velocity) */
  SINT4 weight, uweight ;    /* Used and Unused weights for X sums */
  SINT4 iStartIndexY;        /* Index in info structure where Y sum begins */
  struct filter_info *pi ;   /* Points to info structure where Y sum begins(should replace)*/
  const SINT4 *coef ;	     /* ==> Y sum coefficients */
  SINT2 cnum ;		     /* # Y terms to sum */
  SINT2 val ;		     /* If non zero, then preserve the stated value */
} ;
  
/* --------------------------------------------------
 * Function prototypes for iris_misc library
 */
int ArenaCompare                /* File: protected.c */
(const struct one_arena *pArena1_a,
 const struct one_arena *pArena2_a);

#ifdef SIGMET_PRODUCT_H
MESSAGE BeamFromIngest          /* File: BeamFromIngest.C */
( struct GPPI_Global8 *pInfo_a,   /* Information about the beam product generation */
  const struct GPPI_Sweep Sweeps_a[NUM_GPPI_SWEEPS],        /* Sweep Information */
  struct product_hdr *phed_a,
  UINT1 *ioutput_a );
#endif  /* #ifdef SIGMET_PRODUCT_H */


#ifdef SIGMET_PRODUCT_H
void BuildDisplayTime         /* File: product_misc.c */
( struct ymds_time *pDisplayYmds_a,      /* Return ymds_time here */
  char sDisplayTZName_a[TZNAME_SIZE],    /* Return TZ Name here */
  SINT2 *pTimeOffset_a,                   /* Offset added to default time in minutes */
  UINT2 iOutFlags_a,                     /* Output control flags */
  const struct product_hdr *pProdHdr_a );/* The product header */
#endif  /* #ifdef SIGMET_PRODUCT_H */

  void BuildDisplayYmds          /* File: product_misc.c */
( struct ymds_time *pDisplayYmds_a,       /* Return ymds_time here */
  SINT2 *pTimeOffset_a,                   /* Offset added to default time in minutes */
  UINT2 iOutFlags_a,                      /* Output control flags */
  const struct ymds_time *pDefaultYmds_a, /* Time from the product header */
  SINT2 iLocalWest_a );                   /* local TZ offset */

void byte_fir_filter            /* File: filters.c */
(SINT4 cnum_a,
 const SINT4 coefs_a[],
 SINT4 count_a,
 UINT1 *in_a,
 UINT1 *out_a, SINT4 outinc_a ) ;

#ifdef SIGMET_SETUP_H
  void ColormapFromSetup        /* File: colormap_c.c */
  ( volatile struct color_def Colormap_a[256],
    volatile const struct colormap_setup *pSetup_a
    );
#endif  /* #ifdef SIGMET_SETUP_H */

#define XCELL_P (16)
#define YCELL_P (16)
void compress_pixels		/* File: compress_2d.c */
  (UINT1 ipixels_a[],
   SINT2 ipixlen_a,
   UINT1 ibytes_a[],
   SINT2 *ibytlen_a);

#ifdef SIGMET_PRODUCT_H
FLT4 compute_strength_centroid  /* File: protected.c */
(const struct warning_results *pwarn_a,
 UINT2 icentroid_label_a );  /* Specify label type, none means average */
#endif  /* #ifdef SIGMET_PRODUCT_H */

#ifdef SIGMET_PRODUCT_H
FLT8 compute_strength_sline     /* File: protected.c */
(const struct sline_results *psline_a );
#endif  /* #ifdef SIGMET_PRODUCT_H */

struct scale_text
{
  FLT4 fLowerSeam;    /* Lower seam for the scale, used for documentation */
  FLT4 fUpperSeam;    /* Upper seam for the scale, used for documentation */
  char left[8];
  char sLeftCenter[8];
  char sCenter[8];
  char sRightCenter[8];
  char right[8];
};

#ifdef SIGMET_HEADERS_H
#ifdef SIGMET_SETUP_H
void ComputeTextLabels
(UINT4 idtype_a,
 const struct color_scale_def *scaledef_a,
 const struct data_convert *pconvert_a,
 struct scale_text new_scale_a[16], /* Text returned here */
 UINT2 ilevel_seams_a[COLOR_MAP_ZOOM][17],   /* Seams in data units */
 const volatile struct class_label_setup *pClassLabel_a ); /* Optional custom class labels*/
#endif  /* #ifdef SIGMET_SETUP_H */
#endif  /* #ifdef SIGMET_HEADERS_H */

#ifdef SIGMET_HEADERS_H
FLT4 fcompute_one_label
(UINT4 idtype_a,
 const struct color_scale_def *scaledef_a,
 const struct data_convert *pconvert_a,
 UINT4 icolor_a );
#endif  /* #ifdef SIGMET_HEADERS_H */

#ifdef SIGMET_PRODUCT_H
void PendFillDataConvert        /* File: colormap_c.c */
( struct data_convert *pConvert_a,
  const struct product_end *pPend_a,
  UINT4 iColorFlags_a );
#endif  /* #ifdef SIGMET_PRODUCT_H */

#ifdef SIGMET_PRODUCT_H
#ifdef SIGMET_PROJECTION_H
const struct product_hdr *FindColorLegendHeader  /* File: colormap_c.c */
(const struct on_screen_picture8 *pOnScreen_a);
#endif  /* #ifdef SIGMET_PROJECTION_H */
#endif  /* #ifdef SIGMET_PRODUCT_H */

#ifdef SIGMET_HEADERS_H
FLT8 fMaxRangeFromArgs          /* File: product_region.c */
(UINT4 iPType_a,
 SINT4 ixsize_a,
 SINT4 ixscale_a,
 SINT2 iYSize_a,
 SINT4 iYScale_a,
 volatile const union product_specific_info *pPsi_a );
#endif  /* #ifdef SIGMET_HEADERS_H */

#ifdef SIGMET_PRODUCT_H
FLT8 fMaxNorthFromPCF		/* File: product_region.c */
(const struct product_configuration *ppcf_a );
#endif /* #ifdef SIGMET_PRODUCT_H */

#ifdef SIGMET_PRODUCT_H
FLT8 fMaxRangeFromOPF           /* File: product_region.c */
( volatile const struct one_product_file *pOpf_a );
#endif /* #ifdef SIGMET_PRODUCT_H */

#ifdef SIGMET_PRODUCT_H
FLT8 fMaxRangeFromPCF		/* File: psi_text.c */
(const struct product_configuration *product_region_a );
#endif /* #ifdef SIGMET_PRODUCT_H */

#ifdef SIGMET_HEADERS_H
#ifdef SIGMET_SETUP_H
void generic_map
  (UINT4 idtype,
   const struct color_scale_def *scaledef_a,
   const UINT2 icolscale_a[COLOR_MAP_ZOOM][16],
   UINT1 icol_thresh_a,
   UINT1 icol_no_data_a,
   union level_control *level_a,
   const struct data_convert *pconvert_a,
   struct scale_text newscale_a[16],
   const volatile struct class_label_setup *pClassLabel_a );/* Optional custom class labels*/
#endif /* #ifdef SIGMET_SETUP_H */
#endif /* #ifdef SIGMET_HEADERS_H */

/* Used to get a list of all the possible arenas. */
#ifdef SIGMET_SETUP_H
struct arena_list
{
  SINT4 iCount;
  struct one_arena List[4*IMAX_PROT_REGIONS];
};
#endif  /* #ifdef SIGMET_SETUP_H */

/* Get a group of arenas implied by a single protected area */
void GetArenaGroup              /* File: protected.c */
(const char *sName_a,
 struct one_arena Arenas[4],
 UINT1 iSetupIndex_a );

#ifdef SIGMET_SETUP_H
void GetArenaList               /* File: protected.c */
  (struct arena_list *pList_a,      /* List of arenas */
   volatile const struct protect_setup *pProtect_a,
   UINT4 iMask_a );                 /* Mask of protected areas to consider */
#endif  /* #ifdef SIGMET_SETUP_H */

#ifdef SIGMET_SETUP_H
#define ALL_AREAS_MASK (0xffffffff)
void GetCorridorList            /* File: protected.c */
  (struct corridor_list *pList_a,   /* List of corridors */
   volatile const struct protect_setup *pProtect_a,
   UINT4 iMask_a );                 /* Mask of protected areas to consider */
#endif  /* #ifdef SIGMET_SETUP_H */

#ifdef SIGMET_INGEST_H
const struct data_ray * GetRayFromFile /* File: getpointer.c */
  (UINT4 index_a,		/* Ray number, origin 0 */
   const struct ingest_data_file *header_a,
   UINT2 *last_a );
#endif /* #ifdef SIGMET_INGEST_H */

#ifdef SIGMET_HEADERS_H
void GetRawPsiMask             /* File: psi_test.c */
( struct dsp_data_mask *pDataMask_a,
  volatile const struct raw_psi_struct *pPsi_a );
#endif  /* #ifdef SIGMET_HEADERS_H */

/* Convert the hydro class number into an ASCII string, max 5 chars. */
void GetDefaultHClassLabel5  /* File: colormap.C */
( char  sLabel_a[8],
  UINT2 iValue_a );

/* Convert the hydro class number into an ASCII string, max 19 chars. */
void GetDefaultHClassLabel19  /* File colormap.C */
( char  sLabel_a[20],
  UINT2 iValue_a );

#ifdef SIGMET_PRODUCT_H
#ifdef SIGMET_INGEST_HEADER_DEFINED
void HeaderFromIngestNoShare    /* File: product_misc.c */
  (struct product_hdr *phdr_a,
   const struct ingest_header *sum_a,
   volatile const char sProductSitename_a[16],   /* Current sitename, space padded */
   SINT4 iReferenceHeight_a             /* Reference height in cm */   
   );
#endif  /* #ifdef SIGMET_INGEST_HEADER_DEFINED */
#endif  /* #ifdef SIGMET_PRODUCT_H */

#ifdef SIGMET_PRODUCT_H
void HeaderFromScratch          /* File: product_misc.c */
(struct product_hdr *phdr_a,              /* Header to be filled in */
 const struct full_time_spec *time_a,     /* Data time: optional */
 volatile const char sIngSitename_a[16],  /* Ingest sitename, space padded */
 volatile const char sProdSitename_a[16], /* Product sitename, space padded */
 const char *sProductName_a );            /* Product and task names, null terminated */
#endif  /* #ifdef SIGMET_PRODUCT_H */

#ifdef SIGMET_PRODUCT_H
SINT4 i2d_surface_count		/* File: product_misc.c */
( const struct product_configuration *pcf_a ) ;
#endif  /* #ifdef SIGMET_PRODUCT_H */

#ifdef SIGMET_INGEST_H
MESSAGE iconvert_ingest_param   /* File: rw_ingest_c.c */
  (const struct ingest_data_file *pIFile_a,
   UINT4 *outprm_a,
   struct ingest_data_file **outptr_a,
   SINT4 *isize_a,
   const struct data_convert *pconvert_a );
#endif /* #ifdef SIGMET_INGEST_H */

#ifdef SIGMET_PRODUCT_H
UINT4 iDataTypeOfLegend         /* File: colormap_c.c */
(const struct product_configuration *pcf_a,
 const union product_specific_options2 *pPSO_a );
#endif  /* #ifdef SIGMET_PRODUCT_H */

#ifdef SIGMET_PRODUCT_H
SINT4 iGet3DHeight                           /* File: product_misc.c */
( const struct product_configuration *pPCO_a,
  const struct wind_specific_options *pPSO_a,
  SINT4 *iDataOffset_a );
#endif /* SIGMET_PRODUCT_H */

#ifdef SIGMET_HEADERS_H
SINT4 iGetRainDwellSeconds                   /* File: ProductMisc.C */
( UINT2 iptype_a,
  volatile const union product_specific_info *pPsi_a);
#endif  /* #ifdef SIGMET_HEADERS_H */

/* Convert an arena name to the index 1-7 in airplane encounter order */
SINT4 iGetArenaIndex            /* File: product_misc.c */
( const char *sArena_a );

#ifdef SIGMET_INGEST_H
UINT1 lIsmIngestFilter          /* File: FileFilters.C */
(volatile const struct one_ingest_file *pfile_a,
 const struct server_filter *filter_a );
#endif  /* #ifdef SIGMET_INGEST_H */

SINT4 ilinear_list_insert
(SINT4 index_a,
 volatile struct linear_list_header *lhead_a,
 volatile SINT4 list_a[] );

#ifdef SIGMET_HEADERS_H
SINT4 ilinked_list_insert_	/* File: linked_list.c */
  (SINT4 index_a,
   struct full_linked_list* flst_a );
#endif /* #ifdef SIGMET_HEADERS_H */

UINT2 iprod_type		/* File: product_names_c.c */
  ( volatile const char* sproduct_a );

UINT2 iProductGeometry          /* File: product_misc.c */
(UINT4 iptype_a );

UINT4 iProductOfRank            /* file: product_misc.c */
( UINT4 iRank_a );

UINT4 iRankOfProduct            /* File: product_misc.c */
( UINT4 iPType_a );

#ifdef SIGMET_INGEST_HEADER_DEFINED
MESSAGE iread_summary           /* File: rw_ingest_c.c */
  (const char *sfile_a,
   struct ingest_header *ihd_a,
   SINT4 *isize_a );
#endif  /* #ifdef SIGMET_INGEST_HEADER_DEFINED */

#ifdef SIGMET_HEADERS_H
#ifdef SIGMET_PRODUCT_H
SINT4 itask_name_match          /* File: filelist.C */
  (const char sTName_a[12],	/* Input task name with possible hybrid suffix */
   const char sTaskMinorList_a[PCF_TASK_MINOR_SIZE],  /* Null terminated minor letter list */
   char smatch_a[MAX_PSC_TASKS_MINOR][12],	/* Output list of individual task names */
   SINT4 *ioffset_a,		/* Offset of the hybrid "_", if a hybrid name */
   UINT1 *pbWild_a );           /* Minor list had a "*" in it, skip if NULL */
#endif  /* #ifdef SIGMET_PRODUCT_H */
#endif  /* #ifdef SIGMET_HEADERS_H */

#ifdef SIGMET_HEADERS_H
void levelize_4bit		/* File: levelize.c */
  (const void *input_a,
   SINT4 len_a,
   const union level_control* level_a,
   UINT1 bwl_a, 
   UINT1 *pixels_a );
#endif  /* #ifdef SIGMET_HEADERS_H */

#ifdef SIGMET_HEADERS_H
void levelize_8bit		/* File: levelize.c */
  (const void *input_a,
   SINT4 len_a,
   const union level_control* level_a,
   UINT1 bwl_a, 
   UINT1 *pixels_a );
#endif  /* #ifdef SIGMET_HEADERS_H */

void linear_list_init
(volatile struct linear_list_header *lhead_a,  /* Number of elements in use */
 volatile SINT4 list_a[] );          /* The list */

void linear_list_delete
(SINT4 index_a,         /* Origin 1 index to remove */
 volatile struct linear_list_header *lhead_a,
 volatile SINT4 list_a[] );

#ifdef SIGMET_HEADERS_H
void linked_list_delete_	/* File: linked_list.c */
  (SINT4 index_a,
   struct full_linked_list* flst_a
   );

void linked_list_init_		/* File: linked_list.c */
  (struct full_linked_list* flst_a,
   SINT4 isize_a );
#endif /* #ifdef SIGMET_HEADERS_H */

#ifdef SIGMET_PRODUCT_H
UINT4 look_for_warning		/* File: protected.c */
  (const struct product_hdr *phdr_a,
   char *smessage_a,
   UINT2 icentroid_label_a );   /* Specify label type, none means average */
#endif /* #ifdef SIGMET_PRODUCT_H */

UINT1 lParseStartname
( const char *sfile_a, 
  char *sSite_a, 
  int iSiteSize_a,      /* Storage size available in sSite_a, assumed min 1 */
  struct ymds_time *time_a,
  SINT2 *pPlaybackVersion_a );

/* Check to see if the specified product file matches the filter. */
#ifdef SIGMET_PRODUCT_H
UINT1 lPomProductFilter         /* File: FileFilters.c */
  (volatile const struct one_product_file *pfile_a,
   struct one_product_file **pplast_header_a,  /*Filled in*/
   const struct server_filter *filter_a );
#endif  /* #ifdef SIGMET_PRODUCT_H */

/* Number of products available below */
#define NUM_APO_PRODUCTS    (20)
UINT2 iproduct_to_apoindex      /* File: product_misc.c */
  ( UINT4 iptype_a );

/* Product can be the input to a parent product type */
UINT1 lProductCanBeInput        /* File: product_misc.c */
(UINT4 iPType_a, 
 UINT4 iParentPType_a);

UINT1 lProductCanBeConfigured   /* File: product_misc.c */
  ( UINT4 iptype_a ) ;

UINT1 lProductCanBeDisplayed    /* File: product_misc.c */
  ( UINT4 iptype_a ) ;

UINT1 lProductCanBeScheduled    /* File: product_misc.c */
  ( UINT4 iptype_a ) ;

UINT2 lProductCanForecast       /* File: product_misc.c */
  ( UINT4 iptype_a );

/* Returns FALSE if the product type is displayed with a horizontal projection,
 * but does not have pixel dimensions or projection
 */
UINT2 lProductHasPixSize        /* File: product_misc.c */
  ( UINT4 iptype_a );

UINT1 lProductUsesDataIn        /* File: product_misc.c */
( UINT4 iptype_a );

UINT1 lProductUsesIngest        /* File: product_misc.c */
( UINT4 iptype_a );

#define lstart_name_int	lIrisStartName
UINT1 lIrisStartName		/* File: product_names_c.c */
( char *start_name_a,		              /* Output array holding name */
  const char *sitename3_a,                    /* 3-char site */
  volatile const struct ymds_time* time_a ) ; /* Data time */

UINT1 lIrisStartNameV		/* File: product_names_c.c */
( char *start_name_a,		            /* Output array holding name */
  const char *sitename3_a,                  /* 3-char site */
  volatile const struct ymds_time* time_a,  /* Data time */
  SINT2 iPlaybackVersion_a );               /* Playback version number */

void make_triangular_window     /* File: filters.C */
(FLT4 fwidth,
 UINT4 imaximum_coefs_cnt,
 UINT4 *iactual_coefs_cnt,
 SINT4 icoefs_array[] );

#ifdef SIGMET_TASK_H
#ifdef SIGMET_SETUP_H
#ifdef SIGMET_DSP_LIB_H
void menu_patch_tcf		/* File: IngestMisc.C */
(volatile struct task_configuration* tcf_a,
 volatile const struct iris_setup *piriscf_a,   /* Optional IRIS setup pointer */
 Dsp *pDsp_a                                    /* Optional DSP pointer */
 ) ;
#endif /* #ifdef SIGMET_DSP_LIB_H */
#endif /* #ifdef SIGMET_SETUP_H */
#endif /* #ifdef SIGMET_TASK_H */

#ifdef SIGMET_NRD_API_H
MESSAGE nor_load_areas          /* File: nor_areas.c */
  (struct nor_convert_header *pConvert_a );
#endif  /* #ifdef SIGMET_NRD_API_H */

void nor_signal                 /* File: nor_areas.c */
( const char *sroutine_a,
 SINT4 inor_status );

void pack_inplace		/* File: pack_copy.c */
  (volatile char* string_a,
   const SINT4 isize_a);

void pack_ncpy			/* File: pack_copy.c */
  (volatile char* ipacked_a,
   volatile const char* string_a,
   const SINT4 isize_a);

#ifdef SIGMET_PRODUCT_H
void PcfFromScratch
(struct product_configuration *pPcf_a,     /* Product configuration to fill */ 
 const struct ymds_time *pTime_a,          /* Data time (optional) */
 const char *sPName_a );                   /* Product and task names, null terminated */
#endif  /* #ifdef SIGMET_PRODUCT_H */

#ifdef SIGMET_PRODUCT_H
#ifdef SIGMET_PROJECTION_H
MESSAGE phdr_pin_region         /* In file: product_misc.c */
(struct mpj_projection8 *proj_a,
 struct mpj_region8 *region_a,
 const struct product_hdr *phead_a,
 const SINT4 ihit_size_a[2] );
#endif  /* #ifdef SIGMET_PROJECTION_H */
#endif  /* #ifdef SIGMET_PRODUCT_H */

#ifdef SIGMET_PROJECTION_H
MESSAGE pin_new_region          /* In file: product_misc.c */
( const struct mpj_projection8 *pProj_a,
  const struct mpj_region8 *pInputRegion_a,  /* Input region, already pinned */
  struct mpj_region8 *pOutputRegion_a, 
  FLT8  fOutputResolution_a );              /* Output resolution in km */
#endif  /* #ifdef SIGMET_PROJECTION_H */

void PlatformMotionCorrection1	/* File: PlatformMotion.c */
(SINT1* piarray_a,		/* Array to modify */
 SINT1 icorrection_a,		/* number to add to each bin */
 SINT4 ibytes_a );		/* Byte count */

void PlatformMotionCorrection2	/* File: PlatformMotion.c */
(SINT2* pIArray_a,     /* Array to modify */
 SINT2 iCorrection_a,  /* number to add to each bin */
 SINT4 iBytes_a );     /* Byte count */

#ifdef SIGMET_HEADERS_H
#ifdef SIGMET_SETUP_H
void ProtectSetupCopy           /* In file: protected.c */
( struct protect_setup *pProtectOut_a,
  const struct protect_setup *pProtectIn_a,
  const struct runway_direction RunwayDirs_a[MAX_RUNWAYS] );
#endif  /* #ifdef SIGMET_SETUP_H */
#endif  /* #ifdef SIGMET_HEADERS_H */

#ifdef SIGMET_HEADERS_H
void PutRawPsiMask              /* In file: product_misc.c */
( struct raw_psi_struct *pPsi_a,
  const struct dsp_data_mask *pDataMask_a );
#endif  /* #ifdef SIGMET_HEADERS_H */

#ifdef SIGMET_PRODUCT_H
MESSAGE RadPosFromPheader      /* File: product_misc.c */
(const struct product_hdr *phead_a,
 struct latlon8 *pRadPos_a );          /* Radar long/lat in radians */
#endif  /* #ifdef SIGMET_PRODUCT_H */

#ifdef SIGMET_PRODUCT_H
#ifdef SIGMET_INGEST_HEADER_DEFINED
void radpos_from_ingest        /* In file product_misc.c */
  (struct product_hdr *phdr_a,
   const struct ingest_header *sum_a );
#endif  /* #ifdef SIGMET_INGEST_HEADER_DEFINED */
#endif  /* #ifdef SIGMET_PRODUCT_H */

#ifdef SIGMET_PRODUCT_H
#ifdef SIGMET_INGEST_HEADER_DEFINED
MESSAGE RawFromIngest          /* File: RawFromIngest.c */
( const char *sPath_a,           /* Pathname to write the product to */
  const char *sStartPath_a,      /* Directory to look for ingest files in */
  struct product_hdr *phdr_a,    /* Copy of product header is returned */
  struct ingest_header *pIhdr_a,
  UINT1 lSwpMask_a[MAX_SWEEPS],
  volatile const char sProductSitename_a[16],   /* Current sitename, space padded */
  SINT4 iReferenceHeight_a );    /* Reference height in cm */   
#endif  /* #ifdef SIGMET_INGEST_HEADER_DEFINED */
#endif  /* #ifdef SIGMET_PRODUCT_H */

#ifdef SIGMET_PROJECTION_H
#ifdef SIGMET_PRODUCT_H
#define RPJ_SHIFT_ONLY (0)
#define RPJ_SHIFT_AND_SCALE (1)
void ReprojectProductCopy       /* File: ReprojectProd.c */
( const struct product_hdr *pInputPHead_a,
  const UINT1 *pnative_data_a,   /* Input data */
  const struct product_configuration  *pdesired_pcf_a,
  UINT1 *pdata_a,                /* Output data */
  const struct rpj_table *pTable_a,
  SINT4 iSurfaces_a,
  UINT4 iFlags_a );
#endif  /* #ifdef SIGMET_PRODUCT_H */

void RPJ_Interpolate             /* File: product_misc.c */
( struct rpj_shift *pResult_a,
  const struct rpj_weight *pWeights_a,
  const struct rpj_shift *p1_a,
  const struct rpj_shift *p2_a );
#endif  /* #ifdef SIGMET_PROJECTION_H */


void two_dim_byte_filter        /* File: filters.C */
(SINT4 xsize_a,
 SINT4 ysize_a,
 SINT4 iSkip_a,           /* Skip factor, must be odd. 1 means no skipping, inputs */
 SINT4 xwidth_a,
 SINT4 ywidth_a,
 const SINT4 *xcoefs_a,
 const SINT4 *ycoefs_a,
 UINT1 hival_a,
 const UINT1 *in_a,
 UINT1 *out_a,
 struct filter_info *info_a,
 SINT4 yline_a,
 SINT4 iCoverage_a );  /*Coverage factor range 0-255*/

/* Given a table of X and Y coefficient weights, filter a two dimensional array
 * of HydroClass bytes.  The X and Y directions are independently convolved to produce a
 * net 2D convolution. */
void two_dim_hcl1_filter
(const SINT4 iXSize_a,            /* Size of data array */
 const SINT4 iYSize_a,
 const SINT4 iSkip_a,            /* Skip factors, must be odd. 1 means no skipping, inputs */
                           /*  Larger than a multiple of skip are ignored */
 const SINT4 iXWidth_a,          /* Width of weighting table, must be odd. */
 const SINT4 iYWidth_a,
 const SINT4 *xcoefs_a,    /* Weighting coefficient array */
 const SINT4 *ycoefs_a,
 const UINT1 hival_a,            /* Values greater or equal to this are preserved as is */
 const UINT1 *in_a,        /* Original 2D array of bytes */
 UINT1 *out_a,             /* Smoothed output array, sized insize/skip */
 struct filter_info *info_a, /* Scratch storage */
 const SINT4 yline_a,            /* Byte increment from one row to the next */
 const SINT4 iCoverage_a );      /* Coverage ratio*256, range 0-255 */

void TwoDByteFilterSimple        /* File: filters.C */
(SINT4 xsize_a,
 SINT4 ysize_a,
 SINT4 xwidth_a,
 SINT4 ywidth_a,
 const SINT4 *xcoefs_a,
 const SINT4 *ycoefs_a,
 const UINT1 *in_a,
 UINT1 *out_a,
 struct filter_info *info_a,
 SINT4 yline_a );

void one_dim_vel_filter         /* File: filters_c.C */
(SINT4 iXSize_a,         /* Size of data array */
 SINT4 iXWidth_a,        /* width of weighting table must be odd */
 const SINT4 *xcoefs_a,  /* Array of coefficients, iXWidth_a count */
 const UINT1 *in_a,      /* Pointer to input array */
 UINT1 *out_a,           /* Pointer to output array */
 SINT4 iCoverage_a );    /* Coverage number to pass data */

void two_dim_vel_filter         /* File: filters_c.c */
(SINT4 xsize_a,
 SINT4 ysize_a,
 SINT4 iSkip_a,           /* Skip factors, must be odd. 1 means no skipping */
 SINT4 xwidth_a,
 SINT4 ywidth_a,
 const SINT4 *xcoefs_a,
 const SINT4 *ycoefs_a,
 const UINT1 *in_a,
 UINT1 *out_a,
 struct filter_info *info_a,
 SINT4 yline_a,
 SINT4 iCoverage_a );  /*Coverage factor range 0-255*/

void two_dim_word_filter        /* File: filters_c.c */
(SINT4 xsize_a,
 SINT4 ysize_a,
 SINT4 iXSkip_a,           /* Skip factors, must be odd. 1 means no skipping */
 SINT4 xwidth_a,
 SINT4 ywidth_a,
 const SINT4 *xcoefs_a,
 const SINT4 *ycoefs_a,
 UINT2 hival_a,
 const UINT2 *in_a,
 UINT2 *out_a,
 struct filter_info *info_a,
 SINT4 yline_a,
 SINT4 iCoverage_a );  /*Coverage factor range 0-255*/

void vct_filter			/* File: filters_c.c */
(SINT4 run_a,
 SINT4 count_a,
 const UINT1 *in_a , UINT4 ininc_a,
 UINT1 *out_a, UINT4 outinc_a ) ;

char* sdevice_name		/* File: device_name.c  */
  (UINT1 idev_a,
   SINT1 iunit_a );

char* sDeviceStatus             /* File: device_name.c */
( UINT2 iStatus_a );

const char* send_name		/* File: product_names_c.c */
(UINT2 iptype_a );

#ifdef SIGMET_PRODUCT_H
#ifdef SIGMET_SETUP_H
void SetDefaultColors           /* File: product_misc.c */
(struct product_hdr *phead_a,
 volatile const struct color_setup *pColorSetup_a );
#endif  /* #ifdef SIGMET_SETUP_H */
#endif  /* #ifdef SIGMET_PRODUCT_H */

const char * set_product_dir	/* File: product_misc.c */
( UINT2 iptype_a, char * where_a ) ;

const char* sIngestEnd		/* File: product_names_c.c */
(SINT4 iparam_a,		/* Null terminated */
 SINT4 isweep_a ) ;

#ifdef SIGMET_SETUP_H
UINT4 sitename16_to_num         /* File: product_names_c.c */
(volatile const char* sitename_a,   /* Null terminated */
 volatile const struct site_setup *psitecf_a );

const char* sitename16_to_name3 /* File: product_names_c.c */
(volatile const char* sitename_a,   /* Null terminated */
 volatile const struct site_setup* psitecf_a );

const char* sitename3_to_name16 /* File: product_names_c.c */
(volatile const char* sitename3_a,   /* Null terminated */
 volatile const struct site_setup* psitecf_a );

UINT4 sitename3_to_num          /* File: product_names_c.c */
(volatile const char* sitename3_a,   /* Null terminated */
 volatile const struct site_setup* psitecf_a );

const char* sitenum_to_name16   /* File: product_names_c.c */
( UINT4 isite_num_a,
  volatile const struct site_setup* psitecf_a );

const char* sitenum_to_name3    /* File: product_names_c.c */
( UINT4 isite_num_a,
 volatile const struct site_setup* psitecf_a );
#endif  /* #ifdef SIGMET_SETUP_H */

#ifdef SIGMET_HEADERS_H         /* File: psi_text.c */
const char *sNdopSiteList
(volatile const struct ndop_psi_struct *pNdop_a );
#endif  /* #ifdef SIGMET_HEADERS_H */

void solidify_taskname		/* File: filelist.c */
  (char swild_a[12],
   const char stask_a[12]) ;

char* sProcessMode              /* File: device_name.c */
( UINT2 iMode_a );

const char* sproduct_name16	/* File: product_names_c.c */
  ( UINT2 iproduct_a );

const char* sProductName3       /* File: product_names_c.c */
( UINT2 iproduct_a );

const char* sproduct_name5	/* File: product_names_c.c */
  ( UINT2 iproduct_a );

#ifdef SIGMET_PRODUCT_H
const char *sPsiIiaTextFromOPF  /* File: psi_text.c */
  (volatile const struct one_product_file *pOpf_a );
#endif /* #ifdef SIGMET_OUTPUT_H */

#ifdef SIGMET_PRODUCT_H
const char *sPsiTextFromOPF     /* File: psi_text.c */
  (volatile const struct one_product_file *pOpf_a );
#endif /* #ifdef SIGMET_PRODUCT_H */

#ifdef SIGMET_OUTPUT_H
const char *sPsiTextFromOTP     /* File: psi_text.c */
  (volatile const struct one_tape_product *pOtp_a );
#endif /* #ifdef SIGMET_OUTPUT_H */

char* stask_data_list		/* File: stask_data_list.c */
  ( const struct dsp_data_mask *pDataMask_a );

void unpack_inplace		/* File: pack_copy.c */
  (volatile char* string_a,
   const SINT4 isize_a);

void unpack_ncpy		/* File: pack_copy.c */
  (volatile char* string_a,
   volatile const char* ipacked_a,
   const SINT4 isize_a);

#define VCV_FROM_V1      0x100	/* Convert from version #1 */
#define VCV_FROM_V2      0x200	/* Convert from version #2 */
#define VCV_TO_V1        0x010	/* Convert to version #1 */
#define VCV_TO_V2        0x020	/* Convert to version #2 */
#define VCV_DIRECT       0x001	/* Direct (no swapping) translation */
#define VCV_SWAP         0x002	/* Byte swapped translation */
#define VCV_NATIVE       0x000	/* Automatic conversion to native, no need to specify */
#define VCV_NON_NATIVE  0x1000  /* Target format is not native swapping, must specify */

#ifdef SIGMET_HEADERS_H
MESSAGE vcv_nativeform       /* File: structs.c */
(const struct structure_header *hdr_a,   /* Pointer to unknown version of structure header */
 SINT4 *oper_a,			   /* Required operation returned here */
 UINT2 *lnative_a ) ;	           /* NZ if structure already is in native form */
#endif

#ifdef SIGMET_PRODUCT_H
MESSAGE vcv_nativeform_phdr  /* File: structs.c */
(struct product_hdr *hdr_a,    /* Pointer to unknown version of product_hdr */
 UINT2 *lnative_a, 	       /* NZ if structure already is in native form */
 UINT2 *lrepairs_required_a ); /* NZ if native and repairs required */
#endif

#ifdef SIGMET_GENERIC_PRODUCT_DEFINED
MESSAGE vcv_product          /* File: structs.c */
  (union generic_product *inptr_a,  /* ==> input product */
   union generic_product *outptr_a, /* ==> output product (NULL-->InPlace conversion) */
   SINT4 iFileSize_a,           /* Size of the file, used for checking */
   SINT4 oper_a ) ;		/* Operation to perform */
#endif  /* #ifdef SIGMET_GENERIC_PRODUCT_DEFINED */

MESSAGE vcv_struct           /* File: structs.c */
  (const char *sname_a,		/* Name of the structure */
   void *inptr_a,		/* ==> input structure */
   void *outptr_a,		/* ==> output structure (NULL-->InPlace conversion) */
   SINT4 oper_a,		/* Operation to perform */
   SINT4 dimension_a) ;		/* Number of elements to convert */

#ifdef SIGMET_HEADERS_H
MESSAGE vcv_version          /* File: structs.c */
  (const struct structure_header *hdr_a, /* Pointer to unknown version of structure header */
   SINT4 *version_a,		   /* Version number returned here */
   UINT2 *lswap_a) ;		   /* Returns NZ if byteswapped (non-DEC) data */
#endif

#ifdef SIGMET_PRODUCT_H
void vvp_results_at_height	/* File: product_misc.c */
( struct vvp_results *result_a,   	/* Output result */
  const struct vvp_product *pVvpFile_a, /* ==> VVP product */
  FLT4 fHeightMsl_a,		        /* Height of interest (km above MSL) */
  UINT2 *lvalid_a,	                /* Results are valid */
  UINT2 *linterpolated_a ) ;            /* Results are based on two heights */
#endif  /* SIGMET_PRODUCT_H */

#ifdef SIGMET_PRODUCT_H
void wind_compute_mean		/* File: product_misc.c */
  (const struct product_hdr *phdr_a,   /* Points to WIND product itself. */
   struct wind_results *pmean_a,        /* Mean value */
   UINT4 ithreshold_a );               /* Threshold in % points */
#endif  /* SIGMET_PRODUCT_H */

#ifdef SIGMET_PRODUCT_H
void wind_interpolate_point	/* File: product_misc.c */
  (const struct product_hdr *phdr_a,   /* Points to WIND product itself. */
   FLT4 fxpos_a, FLT4 fypos_a,	       /* X and Y location in km of trial point */
   struct wind_results *point_a,       /* Interpolated wind at (X,Y) */
   UINT4 ithreshold_a );               /* Threshold in % */
#endif

void word_fir_filter            /* File: filters.c */
(SINT4 cnum_a,
 const SINT4 coefs_a[],
 SINT4 count_a,
 SINT2 *in_a,
 SINT2 *out_a );

/*********************************************
** This is CLI/XUIF and SERVER RPC STUFF
********************************************/
#ifdef INCLUDE_RPCRPC_PROTOTYPES
#ifdef SIGMET_SIGNETWORK_H
int xdr_iris_data               /* File: iris_xdr.C */
(XDR *handle, struct iris_rpc_data *serv_cli_data);

int xdr_iris_startup_data       /* File: iris_xdr.C */
(XDR *handle, 
 struct iris_rpc_startup_data *startup_data);
#endif  /* #ifdef SIGMET_SIGNETWORK_H */
#endif  /* #ifdef INCLUDE_RPCRPC_PROTOTYPES */

#endif /* #ifndef MESSAGE_ONLY */

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