/* **********************************************************************
 * *	                                                                *
 * *     IRIS Setup Structure Minimum, Maximum, and Default Values      *
 * *                                                                    *
 * **********************************************************************
 * File: libs/config/setup_limits.c
 *
 *  COPYRIGHT (c) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
 *                       2004, 2005, 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.
 */
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#include "sigtypes.h"
#include "sigversion.h"
#include "headers.h"
#include "product.h"
#include "setup.h"
#include "dsp.h"
#include "signetwork.h"
#include "sig_rtdisp.h"
#include "antenna_lib.h"
#include "dsp_lib.h"
#include "fileformats_lib.h"
#include "user_lib.h"
#include "vtv_lib.h"

#define LIM_DEFINITIONS
#define LIM_KERNEL setup_limits_kernel
#include "config_lib.h"

static MESSAGE LIM_KERNEL
( const char *sname_a,		/* Name of structure */
  void *item_a,			/* Pointer to structure */
  SINT4 ioper_a,		/* Operation to perform */
  const char *spath_a,		/* Full path name of fields */
  void *ioarg_a ) ;		/* Diagnostic messages, or NULL */

MESSAGE setup_limits
( const char *sname_a,		/* Name of structure */
  volatile void *item_a,	/* Pointer to structure */
  SINT4 ioper_a,		/* Operation to perform */
  void *file_a )		/* Diagnostic messages, or NULL */
{
  return( lim_toplevel( sname_a, item_a, ioper_a, file_a, LIM_KERNEL ) ) ;
}

/* ======================================================================
 * Internal routine to recursively descend the structures.
 */
static MESSAGE LIM_KERNEL
( const char *sname_a,		/* Name of structure */
  void *item_a,			/* Pointer to structure */
  SINT4 ioper_a,		/* Operation to perform */
  const char *spath_a,		/* Full path name of fields */
  void *ioarg_a )		/* Diagnostic messages, or NULL */
{
  char spath[PATHNAME_SIZE], *sItem ; struct lim_inLine **pLine ;
  SINT4 idim1=0, idim2=0 ; MESSAGE istatus = SS_NORMAL ;
  UINT1 lActualSizes = USEACTUALSIZES( ioper_a ) ;

  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  if( 0 == strcmp( "ant_manual_setup", sname_a ) ) {
    struct ant_manual_setup *item = item_a ;

    STRING   (              sVersion, IRIS_VERSION ) ;
    SCALAR   (         lAntAvailable,         0,          1,        TRUE ) ;
    SCALAR   (        iInterfaceType,         0,          3, ANTIFACE_SERIAL ) ;
    SCALAR   (      lControllingHost,         0,          1,        TRUE ) ;

    SCALAR   (            lLogToFile,         0,          1,        TRUE ) ;
    SCALAR   (        lLogPacketsAnt,         0,          1,       FALSE ) ;
    SCALAR   (       lLogPacketsBITE,         0,          1,        TRUE ) ;
    SCALAR   (       lLogPacketsTime,         0,          1,        TRUE ) ;
    SCALAR   (        lLogPacketsErr,         0,          1,        TRUE ) ;
    SCALAR   (           lLogDataAnt,         0,          1,       FALSE ) ;
    SCALAR   (           lLogDataINU,         0,          1,       FALSE ) ;
    SCALAR   (          iLogDaysKept,         1, ANTLOGMAXFILES,       5 ) ;

    SCALAR   (     iAntExportPortNum, MIN_USER_PORT, 65535, PORT_ANTLIB_SERVER ) ;
    STRING   (        sAntExportHost, "RCP8" ) ;

    SCALAR   (                ielmin,     -7281,       7281,        -910 ) ; /* -40 to +40 */
    SCALAR   (                ielmax,         0,      40049,       17294 ) ; /*   0 to 220 */
    SCALAR   (             fazvelmax,         0,        100,          36 ) ;
    SCALAR   (             felvelmax,         0,         48,          18 ) ;
    SCALAR   (                  ilat,         0, 0xFFFFFFFF,           0 ) ;
    SCALAR   (                  ilon,         0, 0xFFFFFFFF,           0 ) ;
    SCALAR   (              ignd_hgt,      -100,      12000,           0 ) ;
    SCALAR   (              irad_hgt,         0,       1000,           0 ) ;
    SCALAR   (       icontrol_format,         0,         6, ANTFMT_XMT02 ) ;
    SCALAR   (        istatus_format,         0,         6, ANTFMT_RCV02 ) ;
    SCALAR   (          itoggle_time,         0,      86400,         300 ) ;
    SCALAR   (  fRadiateTogglePeriod,         0,         60,           1 ) ;
    SCALAR   (     inu_height_offset,   -100000,     100000,           0 ) ;
    SCALAR_1D(      iplatform_offset,   -100000,     100000,           0, 3 ) ;
    SCALAR   (    fnoise_toggle_time,         0,         60,           0 ) ;
    SCALAR   (           isiggen_max,      -100,        100,          10 ) ;
    SCALAR   (           isiggen_min,      -200,          0,        -100 ) ;
    SCALAR   (        fsiggen_warmup,         0,         60,          10 ) ;
    SCALAR   (        fsiggen_settle,         0,         60,           3 ) ;
    SCALAR   (       iazmode_initial,         0,         2, ANTMODE_STOP ) ;
    SCALAR   (       ielmode_initial,         0,         2, ANTMODE_STOP ) ;
    SCALAR   (        iazpos_initial,         0,     0xFFFF,           0 ) ;
    SCALAR   (        ielpos_initial,         0,     0xFFFF,           0 ) ;
    SCALAR   (          fazv_initial,      -100,        100,           0 ) ;
    SCALAR   (          felv_initial,      -100,        100,           0 ) ;
    SCALAR   ( isiggen_value_initial,      -200,        100,           0 ) ;

    SCALAR   (           ipri_antrcv,       -20,         20,         -15 ) ;
    SCALAR   (           ipri_antxmt,       -20,         20,         -15 ) ;
    SCALAR   (      icontrol2_format,         0,       6, ANTFMT_XMTVOID ) ;
    SCALAR   (       istatus2_format,         0,       6, ANTFMT_RCVVOID ) ;

    STRING   (             schannel1, "" ) ;
    STRING   (             schannel2, "" ) ;
    STRING   (        sNetInterface1, "eth0" ) ;

    SCALAR   (            iBaudRate1,        75,     115200,        9600 ) ;
    SCALAR   (            iBaudRate2,        75,     115200,        9600 ) ;
    SCALAR   (              iParity1,         0,       2, TTYPARITY_NONE ) ;
    SCALAR   (              iParity2,         0,       2, TTYPARITY_NONE ) ;
    SCALAR   (           iNetDelayMs,         0,        100,           0 ) ;

    SCALAR   (       lStartSimulator,         0,          1,       FALSE ) ;
    SCALAR   (         lUseTimeStamp,         0,          1,        TRUE ) ;

    SCALAR   (          iAngleSource,         0,     2, ANTANGSRC_NORMAL ) ;

    SUBSTRUCTURE( rcp_bit_def, cont_servo_power      ) ;
    SUBSTRUCTURE( rcp_bit_def, cont_tr_power         ) ;
    SUBSTRUCTURE( rcp_bit_def, cont_radiate          ) ;
    SUBSTRUCTURE( rcp_bit_def, cont_reset            ) ;
    SUBSTRUCTURE( rcp_bit_def, cont_noise            ) ;
    SUBSTRUCTURE( rcp_bit_def, cont_siggen           ) ;
    SUBSTRUCTURE( rcp_bit_def, cont_sigcw            ) ;
    SUBSTRUCTURE( rcp_bit_def, cont_pwbw             ) ;
    SUBSTRUCTURE( rcp_bit_def, cont_pw_unset         ) ;
    SUBSTRUCTURE( rcp_bit_def, cont_polar            ) ;
    SUBSTRUCTURE( rcp_bit_def, cont_nst              ) ;

    SUBSTRUCTURE( rcp_status_def, status_low_airflow    ) ;
    SUBSTRUCTURE( rcp_status_def, status_low_wgp        ) ;
    SUBSTRUCTURE( rcp_status_def, status_interlock_open ) ;
    SUBSTRUCTURE( rcp_status_def, status_standby        ) ;
    SUBSTRUCTURE( rcp_status_def, status_radiate        ) ;
    SUBSTRUCTURE( rcp_status_def, status_mag_current    ) ;
    SUBSTRUCTURE( rcp_status_def, status_local          ) ;
    SUBSTRUCTURE( rcp_status_def, status_trlocal        ) ;
    SUBSTRUCTURE( rcp_status_def, status_shutdown       ) ;
    SUBSTRUCTURE( rcp_status_def, status_tr_power       ) ;
    SUBSTRUCTURE( rcp_status_def, status_servo_power    ) ;
    SUBSTRUCTURE( rcp_status_def, status_siggen         ) ;
    SUBSTRUCTURE( rcp_status_def, status_sigcw          ) ;
    SUBSTRUCTURE( rcp_status_def, status_pwbw           ) ;
    SUBSTRUCTURE( rcp_status_def, status_polar          ) ;
    SUBSTRUCTURE( rcp_status_def, status_sigfault       ) ;
    SUBSTRUCTURE( rcp_status_def, status_calib_az       ) ;
    SUBSTRUCTURE( rcp_status_def, status_calib_el       ) ;

    STRING_1D(          sreport_mode,        "",     8 ) ;
    STRING_1D(         sreport_sites,        "",     4 ) ;
    SCALAR   (    freport_mode_delay,         0,         20,       1 ) ;
    SCALAR   (          iDeadModeReq,         0,          7,       0 ) ;
    SCALAR   (        lTimePacketUtc,         0,          1,       1 ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "tape_device", sname_a ) ) {
    struct tape_device *item = item_a ;

    STRING( sdevice, "" ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "mo_device", sname_a ) ) {
    struct mo_device *item = item_a ;

    STRING( sMountPoint, "" ) ;
    STRING(     sdevice, "" ) ;
    STRING( sdevice_raw, "" ) ; 
    SCALAR(     iFsType,  0,  ARCHIVE_MO_HPVXFS, 0 ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "lda_device", sname_a ) ) {
    struct lda_device *item = item_a ;

    STRING( sDirectory, "" ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "dvd_device", sname_a ) ) {
    struct dvd_device *item = item_a ;

    STRING( sMountPoint, "" ) ;
    STRING(     sdevice, "" ) ;
    SCALAR(    iBufSize, 100,  1000, 200 ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "archive_device", sname_a ) ) {
    struct archive_device *item = item_a, itemref = *item ;

    SCALAR(   isub_type,  ARCHIVE_TAPE,  ARCHIVE_DVD, ARCHIVE_TAPE ) ;

    CONDITIONAL_DISCRIMINANT { itemref.isub_type = item->isub_type ; }
    switch( itemref.isub_type ) {
    case ARCHIVE_TAPE:
      SUBSTRUCTURE( tape_device, asi.Tape ) ;
      break ;
    case ARCHIVE_MO:
      SUBSTRUCTURE(   mo_device, asi.Mo   ) ;
      break ;
    case ARCHIVE_LDA:
      SUBSTRUCTURE(  lda_device, asi.Lda  ) ;
      break ;
    case ARCHIVE_DVD:
      SUBSTRUCTURE(  dvd_device, asi.Dvd  ) ;
      break ;
    }
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "customTrig", sname_a ) ) {
    struct customTrig *item = item_a ; SINT4 iLength ;

    SCALAR( iNumPeriods, 0, MAXTRIGPERIODS, 0 ) ;

    iLength = lActualSizes ? item->iNumPeriods : MAXTRIGPERIODS ;
    iLength = MAX( 0, MIN( MAXTRIGPERIODS, iLength ) ) ;
    SCALAR_1D( iPeriods, 10000, 100000000, 1000000, iLength ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "device_def", sname_a ) ) {
    struct device_def *item = item_a, itemref = *item ;

    SCALAR(  idev_type, 2, IDEVTYPE_MAXVALUE, IDEVTYPE_WINDOW );
    SCALAR(  iunit_num, 1,   MAX_OUT_DEVICES,               1 );
    /* Max 3600 seconds */
    SCALAR( iskip_time, 0,              3600,               0 ); 

    STRING( salias, "" ) ;

    CONDITIONAL_DISCRIMINANT { itemref.idev_type = item->idev_type ; }
    switch( itemref.idev_type ) {
    case IDEVTYPE_WINDOW:
      SUBSTRUCTURE(  window_device, dsi.window  ) ;
      break ;
    case IDEVTYPE_LINK:
      SUBSTRUCTURE(    link_device, dsi.link    ) ;
      break ;
    case IDEVTYPE_NETWORK:
      SUBSTRUCTURE( network_device, dsi.network ) ;
      break ;
    case IDEVTYPE_ARCHIVE:
      SUBSTRUCTURE( archive_device, dsi.archive ) ;
      break ;
    case IDEVTYPE_PRINTER:
      SUBSTRUCTURE( printer_device, dsi.printer ) ;
      break ;
    }
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "device_setup", sname_a ) ) {
    struct device_setup *item = item_a ; SINT4 iCount ;

    STRING(  sVersion, IRIS_VERSION ) ;
    SCALAR( idevcount, 0, MAX_OUT_DEVICES, 0 ) ;

    iCount = lActualSizes ? item->idevcount : MAX_OUT_DEVICES ;
    iCount = MAX( 0, MIN( MAX_OUT_DEVICES, iCount ) ) ;
    SUBSTRUCTURE_1D( device_def, def, iCount ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "dsp_agc_cal", sname_a ) ) {
    struct dsp_agc_cal *item = item_a ;

    SCALAR_1D(       iagctable,       0,   255,   0, DSP_AGC_TABLE_SIZE ) ;
    SCALAR   (     fsaturation,  -100.0, 100.0, 0.0 ) ;
    SCALAR   (         fmargin,  -100.0, 100.0, 0.0 ) ;

    SCALAR   (        fiagc_hi,  -100.0, 100.0, 5.0 ) ;
    SCALAR   (      fiagc_goal,  -100.0, 100.0, 3.0 ) ;
    SCALAR   (       fiagc_low,  -100.0, 100.0, 1.0 ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "dsp_cal", sname_a ) ) {
    struct dsp_cal *item = item_a ;

    SUBSTRUCTURE( dsp_cal_polar, Horiz ) ;
    SUBSTRUCTURE( dsp_cal_polar, Vert   ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "dsp_refl_cal", sname_a ) ) {
    struct dsp_refl_cal *item = item_a ;

    STRING      (  sVersion, IRIS_VERSION ) ;
    SUBSTRUCTURE( ymds_time, CurrentSiggenTime ) ;
    STRING      (            sCurrentSiggenId, "" ) ;
    SUBSTRUCTURE(   dsp_cal, Reference ) ;
    SUBSTRUCTURE(   dsp_cal, Stored    ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "dsp_cal_polar", sname_a ) ) {
    struct dsp_cal_polar *item = item_a ;

    SUBSTRUCTURE_1D( dsp_cal_pw, PW, 4 ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "dsp_cal_pw", sname_a ) ) {
    struct dsp_cal_pw *item = item_a ;

    SCALAR(  fRvp6Slope,       0.1,     10.0,     0.35 ) ;
    SCALAR(  fRvp7Slope,       0.5,      2.0,     1.00 ) ;
    SCALAR(       fZCal,    -100.0,     50.0,    -30.0 ) ;
    SCALAR(    fstd_dev,       0.0,    100.0,      1.0 ) ;
    SCALAR(  fRvp6LogDc,       0.0,    100.0,     10.0 ) ;
    SCALAR( fNoiseLevel,    -100.0,     50.0,    -70.0 ) ;

    SCALAR( fRvp6LinRms,    -100.0,     50.0,    -70.0 ) ;
    SCALAR(         fi0,    -100.0,     50.0,    -70.0 ) ;
    SUBSTRUCTURE( ymds_time, time ) ;
    SCALAR(       iflag,         0,        1,        0 ) ;
    SUBSTRUCTURE( ymds_time, SiggenTime ) ;
    STRING   (           sSiggenId, "" ) ;

    SCALAR( fMaximumLevelIf, -100.0,    50.0,      0.0 ) ;

    SCALAR_1D( fDynamicLimitsSiggen, -200.0, 100.0, 0.0, 2 );
    SCALAR_1D( fDynamicLimitsIf,     -200.0, 100.0, 0.0, 2 );
  }

  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "dsp_gain_cal", sname_a ) ) {
    struct dsp_gain_cal *item = item_a ;

    SCALAR_1D(         fanalog_curve,  -100.0,  100.0, 0.0, IANALOG_GCAL_SIZE ) ;
    SCALAR_1D( fdigital_nominal_gain,  -100.0,  100.0, 0.0, IDIGITAL_GCAL_SIZE ) ;
    SCALAR_1D(  fdigital_actual_gain,  -100.0,  100.0, 0.0, IDIGITAL_GCAL_SIZE ) ;
    SCALAR_1D(        idigital_flags,       0,      1,   1, IDIGITAL_GCAL_SIZE ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "dsp_losses_setup", sname_a ) ) {
    struct dsp_losses_setup *item = item_a ;

    SCALAR   (     iXmtLossSingle,       0,      100,        0 ) ;
    SCALAR   (      iXmtLossHAndV,       0,      100,        0 ) ;
    SCALAR   (           iRcvLoss,       0,      100,        0 ) ;
    SCALAR   (          iTestLoss,   -1000,     1000,        0 ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "dsp_manual_setup", sname_a ) ) {
    struct dsp_manual_setup *item = item_a ;
#define MINPRF MIN( MIN( DSP_RVP6_MINPRF, DSP_RVP7_MINPRF ), DSP_RVP8_MINPRF )
#define MAXPRF MAX( MAX( DSP_RVP6_MAXPRF, DSP_RVP7_MAXPRF ), DSP_RVP8_MAXPRF )

    STRING   (            sVersion, IRIS_VERSION ) ;
    SCALAR   (      ldsp_available,        0,         1,         1 ) ;
    SCALAR   (           itype, DSP_TYPE_MIN,DSP_TYPE_MAX,DSP_TYPE_RVP8 ) ;
    SCALAR   (     lCheckByteOrder,        0,         1,         1 ) ;
    SCALAR   (       interface, DSPIFACE_MIN,DSPIFACE_MAX,DSPIFACE_SCSI ) ;
    STRING   (             sdevice, "" ) ;
    SCALAR   (         iPortNumber,MIN_USER_PORT, 65535,PORT_DSPLIB_SERVER ) ;
    SCALAR   (          isync_fuzz,        0,     5*182,       182 ) ;
    SCALAR   (             iwidcnt,        1,         4,         2 ) ;
    SCALAR_1D(            ipwidths,       10,      5000,       100, 4 ) ;
    SCALAR_1D(             ipwbits,        0,        15,         0, 4 ) ;
    SCALAR   (         iwavelength,        1,     10000,       500 ) ;
    SCALAR   (             idspprf,   MINPRF,    MAXPRF,    MINPRF ) ;
    SCALAR_1D(             iminprf,   MINPRF,    MAXPRF,    MINPRF, 4 ) ;
    SCALAR_1D(             imaxprf,   MINPRF,    MAXPRF,    MAXPRF, 4 ) ;
    SCALAR   (           inoiseprf,   MINPRF,    MAXPRF,    MINPRF ) ;
    SCALAR   (   iPwRadiateOffWait,        0,     10000,         0 ) ;
    SCALAR   (            ipw_wait,        0,     12000,      1500 ) ;
    SCALAR   (         ihorizwidth,        0,      1000,       100 ) ;
    SCALAR   (          ivertwidth,        0,      1000,       100 ) ;
    SCALAR   (            iantgain,      100,      1000,       400 ) ;
    SCALAR   (     fNoiseSourceENR,      0.0,      50.0,      30.0 ) ;
    SUBSTRUCTURE( dsp_losses_setup,  Horiz      ) ;
    SUBSTRUCTURE( dsp_losses_setup,  Vert      ) ;
    /* Old ( pre 7.25.7) structure:
     *    SCALAR   (            itrloss,       0,      100,        0 ) ;
     *    SCALAR   (           irecloss ) ;
     *    SCALAR   (          itestloss,   -1000,     1000,        0 ) ;
     */
    RALACS   (Horiz.iXmtLossSingle,        0,       100,         0, itrloss) ;
    RALACS   ( Horiz.iXmtLossHAndV,        0,       100,         0, itrloss) ;
    RALACS   (      Horiz.iRcvLoss,        0,       100,         0, irecloss) ;
    RALACS   (     Horiz.iTestLoss,    -1000,      1000,         0, itestloss) ;

    SCALAR   (          idspagcode,        0,        10,         0 ) ;
    SCALAR   (       idspdualdelay,        0,        10,         0 ) ;
    SCALAR   (           ildr_bias,    -2000,      2000,         0 ) ;
    SCALAR   (           izdr_bias,     -320,       320,         0 ) ;
    SCALAR   (        iXmtTubeType,        1,      3,XMT_MAGNETRON ) ;
    SCALAR   (    lXmtPhaseControl,        0,         1,         0 ) ;
    SCALAR   (     lPolarAvailable,        0,         1,         0 ) ;
    SCALAR   ( iSinglePolarization,POL_HORIZ_FIX,POL_VERT_FIX,POL_HORIZ_FIX ) ;
    SCALAR   (iPolarRadiateOffWait,        0,     10000,         0 ) ;
    SCALAR   (       iMaxPolarWait,        0,     30000,         0 ) ;
    SCALAR   (       lDualReceiver,        0,         1,         1 ) ;
    RALACS   (       lDualReceiver,        0,         1,         1, lPolSimultaneous) ;
    SCALAR   (     lPhidpAvailable,        0,         1,         0 ) ;
    SCALAR   (     lRhohvAvailable,        0,         1,         0 ) ;
    SCALAR   (     lHClassAvailable,       0,         1,         0 ) ;
    SCALAR   (       lSqiAvailable,        0,         1,         1 ) ;
    SCALAR   (       lLdrAvailable,        0,         1,         0 ) ;
    SCALAR   (       lPhiAvailable,        0,         1,         0 ) ;
    SCALAR   (       lRhoAvailable,        0,         1,         0 ) ;
    SCALAR   (  lXmtHorizontalOnly,        0,         1,         0 ) ;
    SCALAR   (    lXmtVerticalOnly,        0,         1,         0 ) ;
    SCALAR   (     lXmtAlternating,        0,         1,         0 ) ;
    SCALAR   (    lXmtSimultaneous,        0,         1,         1 ) ;
    SCALAR   (      iCalSignalType, CAL_SIGNAL_NARROW, CAL_SIGNAL_BROAD, CAL_SIGNAL_NARROW ) ;
    STRING   (               strid, "" ) ;
    SCALAR_1D(             itpower,        0,   2000000,     50000, 4 ) ;
    SCALAR_1D(   iRangeMaskSpacing,     1500,     62500,     12500, 4 ) ;
    /*  Old (pre 7.27.2)   SCALAR(  imask_res,     0,   200000,    12500 ) ; */
    RALACS   (iRangeMaskSpacing[0],     1500,     62500,     12500, imask_res) ;
    RALACS   (iRangeMaskSpacing[1],     1500,     62500,     12500, imask_res) ;
    RALACS   (iRangeMaskSpacing[2],     1500,     62500,     12500, imask_res) ;
    RALACS   (iRangeMaskSpacing[3],     1500,     62500,     12500, imask_res) ;
    SCALAR   (             iwindow,        0,         2,WIN_HAMMING ) ;
    SCALAR   (  linvert_velocities,        0,         1,         0 ) ;
    SCALAR   (       ldigital_gain,        0,         1,         0 ) ;
    SCALAR   (         iDataWidths,        1,         2,         1 ) ;
    SCALAR   (            iaqclock,  5000000,  40000000,  14390000 ) ;
    SCALAR   (           iGasAtten,        0,    500000,         0 ) ;
    SUBSTRUCTURE_1D(    customTrig, customTrig, CUSTOMTRIGS ) ;

    STRING_1D(    sUserPModeNames,         "", NUMPMODENAMES ) ;
    SCALAR   (fRvp6InterferenceThreshold, 1.0,      3.0,       1.2 ) ;

    SCALAR   (   lSimClutterWidNorm,       0,         1,      TRUE ) ;
    SCALAR   (     fSimClutterWidth,     0.0,      10.0,      0.01 ) ;
  }
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "full_time_spec", sname_a ) ) {
    struct full_time_spec *item = item_a ;

    SUBSTRUCTURE(    ymds_time,  Ymds ) ;
    STRING   (    sLocalTZName,    "" ) ;
    STRING   (   sRecordTZName,    "" ) ;
    SCALAR   (          tv_sec,            0,    0xFFFFFFFF,             0 ) ;
    SCALAR   (         tv_usec,            0,        999999,             0 ) ;
    SCALAR   (         iRelDay,            0,    0x7FFFFFFF,             0 ) ;
    SCALAR   (    iMinutesWest,       -18*60,         18*60,             0 ) ;
    SCALAR   (      iLocalWest,       -18*60,         18*60,             0 ) ;
    SCALAR   (      iJulianDay,            0,           366,             0 ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "input_setup", sname_a ) ) {
    struct input_setup *item = item_a ; SINT4 iCount ;

    STRING(    sVersion, IRIS_VERSION ) ;
    SCALAR( iInputCount, 0, MAX_INPUT_DEVICES, 0 ) ;

    iCount = lActualSizes ? item->iInputCount : MAX_INPUT_DEVICES ;
    iCount = MAX( 0, MIN( MAX_INPUT_DEVICES, iCount ) ) ;
    SUBSTRUCTURE_1D( one_input_setup, Def, iCount ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "iris_setup", sname_a ) ) {
    struct iris_setup *item = item_a ;

    SUBSTRUCTURE(    link_setup, link    ) ;
    SUBSTRUCTURE(    misc_setup, misc    ) ;
    SUBSTRUCTURE( protect_setup, protect ) ;
    SUBSTRUCTURE(  device_setup, device  ) ;
    SUBSTRUCTURE(    site_setup, Site    ) ;
    SUBSTRUCTURE(   input_setup, Input   ) ;
    SUBSTRUCTURE(     web_setup, Web     ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "license_setup", sname_a ) ) {
    struct license_setup *item = item_a ;

    STRING(       sVersion, IRIS_VERSION ) ;
    STRING(      sSitename, "" ) ;
    STRING(      sSiteCode, "XXX" ) ;
    STRING_1D(   sLicenses, "", MAX_LICENSE_COUNT );
    /* Old (pre 8.05.2): GNIRTS( slicense_feats, "" ) ; */
    GNIRTS( sLicenses[0], slicense_feats ) ;
    /* Old (pre 8.05.2): STRING( slicense_prods, "" ) ; */
    GNIRTS( sLicenses[1], slicense_prods ) ;

    xxSTRING(    sPassword, "", SLCLASS_ENCODED ) ;
    SCALAR(     iris_style,     0,          2, STYLE_RADAR ) ;
    STRING(  sHardwareName, "" ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "link_device", sname_a ) ) {
    struct link_device *item = item_a ;

    SCALAR(   iheight, 16,  320, 160 ) ;
    SCALAR(    iwidth, 16,  256, 128 ) ;
    SCALAR( isub_type,  1,    2,   1 ) ;
    STRING( sdevice, "" ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "link_setup", sname_a ) ) {
    struct link_setup *item = item_a ;

    STRING   (    sVersion, IRIS_VERSION ) ;
    SCALAR_1D(   ilink_map,  0, 16, 0, 16 ) ;
    SUBSTRUCTURE( special_link, link ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "misc_setup", sname_a ) ) {
    struct misc_setup *item = item_a ; 

    STRING   (               sVersion, IRIS_VERSION ) ;
    SCALAR   (         ikbytes_ingest,     1000,  100000000,     100000 ) ;
    SCALAR   (   ikept_ingest_percent,        0,         90,         25 ) ;
    SCALAR   (  ikept_product_percent,        0,         90,         25 ) ;
    SCALAR   (       ifkbytes_product,     1000,  100000000,     500000 ) ;
    SCALAR   (                 itrunc,        0,  100000000,    1000000 ) ;
    SCALAR   (       ingest_data_mode,        0,          1,  DMODE_DSP ) ;
    SCALAR   (            iext_header,       -1,          1,          0 ) ;
    SCALAR   (             relspeedup,        0,         50,         10 ) ;
    M_SCALAR (              fzr_const,      1.0,     1000.0,      200.0 ) ;
    M_SCALAR (                fzr_exp,      0.1,       10.0,        1.6 ) ;
    SCALAR   (       iprod_cache_size,        0, 1000000000,          0 ) ;
    SCALAR   (        lStatusEachTask,        0,          1,          0 ) ;
    SCALAR   (             lRecordGmt,        0,          1,          0 ) ;
    SCALAR   (        iant_coast_secs,        0,       3600,         60 ) ;
    SCALAR   (           iMaxWarnDiff,        0,    24*3600,      15*60 ) ;
    SCALAR   (          iMaxTrackDiff,        0,    24*3600,      30*60 ) ;
    SCALAR   (        iMaxDefaultDiff,        0,    24*3600,      15*60 ) ;
    SCALAR   (    iNetworkSendTimeout,        6,       3600,       2*60 ) ;
    SCALAR   (        imax_send_queue,        0,         50,         10 ) ;
    SCALAR   (         irad_warm_time,        0,         60,          5 ) ;
    M_SCALAR (      lsay_text_product,        0,          1,          0 ) ;
    M_SCALAR (       lsay_mode_change,        0,          1,          0 ) ;
    SCALAR   (      lsay_fatal_errors,        0,          1,          0 ) ;
    M_SCALAR (       lsay_bite_faults,        0,          1,          0 ) ;
    SCALAR   (             faz_ok_vel,        0,         20,        0.5 ) ;
    SCALAR   (             fel_ok_vel,        0,         20,        0.5 ) ;
    SCALAR   (       faz_morbid_speed,        0,         20,        0.2 ) ;
    SCALAR   (       fel_morbid_speed,        0,         20,        0.2 ) ;
    SCALAR   (    istatus_product_gen,        0,      86400,      10*60 ) ;
    SCALAR   (istatus_product_timeout,        0,      86400,      11*60 ) ;
    SCALAR   (   ifkbytes_product_raw,     1000,  100000000,     500000 ) ;
    SCALAR   (ikept_product_raw_percent,      0,         90,         25 ) ;
    SCALAR   (     lIngestAnglesEdged,        0,          1,          0 ) ;
    SCALAR   (lIngestContinuousOutput,        0,          1,          0 ) ;
    SCALAR   (     lpw_advance_change,        0,          1,          1 ) ;
    SCALAR   (  lIngestTimeSourceRvp8,        0,          1,          0 ) ;
    M_SCALAR (         lnoise_enabled,        0,          1,          0 ) ;
    M_SCALAR (    lnoise_at_pw_change,        0,          1,          0 ) ;
    M_SCALAR (              inoise_az,       -1,        360,         -1 ) ;
    M_SCALAR (              inoise_el,       -1,         85,         10 ) ;
    M_SCALAR (            inoise_time,        0,     60*500,      60*60 ) ;
    M_SCALAR (           iNoiseRetrys,        0,          5,          1 ) ;
    M_SCALAR (        iNoiseRetryWait,        0,       5000,       1000 ) ;
    SCALAR   (          irad_off_time,        0,       3600,        300 ) ;
    M_SCALAR (   iMinVerticalGradient,        0,     30*100,      7*100 ) ;
    M_SCALAR (   iLowVerticalGradient,        0,     30*100,      1*100 ) ;
    M_SCALAR (      fMeltingThickness,        0,       10.0,        1.0 ) ;
    M_SCALAR (      fMeltingIntensity,        0,       40.0,        7.0 ) ;
    M_SCALAR (             fWindSpeed,      0.0,      125.0,        0.0 ) ;
    M_SCALAR (         fWindDirection,      0.0,      360.0,        0.0 ) ;
    SCALAR   (        icentroid_label,        1,          2, CENTROID_LABEL_AVERAGE );
    SCALAR   (         iaz_sweep_wait,        0,       2000,        100 ) ;
    SCALAR   (         iel_sweep_wait,        0,       2000,        100 ) ;
    SCALAR   (  istatus_product_quota,        0,        500,         25 ) ;
    SCALAR   (             iaz_ok_err,        0,     30*182,         91 ) ;
    SCALAR   (             iel_ok_err,        0,     30*182,         91 ) ;
    M_SCALAR (         lcon_clockwise,        0,          1,          1 ) ;
    SCALAR   (              isyn_mode,        0,      2, ANGSYN_DYNAMIC ) ;
    SCALAR   ( iIngestAngleSource, ANG_SRC_TAG_BIN16, ANG_SRC_RCP, ANG_SRC_TAG_BIN16 );
    M_SCALAR (        lWindSpeedValid,        0,          1,          0 ) ;
    SCALAR   (         lauto_time_set,        0,          1,          0 ) ;
    SCALAR   (       lClutMapReingest,        0,          1,          0 ) ;
    SCALAR   (            ipri_ingest, MIN_PRIORITY, MAX_PRIORITY,   -8 ) ;
    SCALAR   (            ipri_ingfio, MIN_PRIORITY, MAX_PRIORITY,   -8 ) ;
    SCALAR   (           ipri_product, MIN_PRIORITY, MAX_PRIORITY,    8 ) ;
    SCALAR   (          ipri_reingest, MIN_PRIORITY, MAX_PRIORITY,    8 ) ;
    SCALAR   (           ipri_network, MIN_PRIORITY, MAX_PRIORITY,    4 ) ;
    SCALAR   (            ipri_output, MIN_PRIORITY, MAX_PRIORITY,    4 ) ;
    SCALAR   (           ipri_archive, MIN_PRIORITY, MAX_PRIORITY,    4 ) ;
    SCALAR   (            ipri_server, MIN_PRIORITY, MAX_PRIORITY,    0 ) ;
    SCALAR   (          ipri_watchdog, MIN_PRIORITY, MAX_PRIORITY,    0 ) ;

    SCALAR   (      lrcp_mode_control,        0,          1,          0 ) ;
    SCALAR_1D(       iprod_priorities,        0,        100,         50, NUM_DEFINED_PRODUCTS ) ;
    SCALAR   (         lrestart_fatal,        0,          1,          1 ) ;
    SCALAR   (    luse_partial_ingest,        0,          1,          1 ) ;
    SCALAR   (         lr2_processing,        0,          1,          1 ) ;
    M_SCALAR (         ircv_beep_time,        0,      21600,        600 ) ;
    SCALAR   (              fkr_const,    0.001,       10.0,      0.030 ) ;
    SCALAR   (                fkr_exp,      0.1,       10.0,      1.150 ) ;
    SCALAR   (          lprod_alt_pol,        0,          1,          0 ) ;
    SCALAR   (          iIngestActPsv,        0, 2, INGESTACTPSV_ACTIVE ) ;
    SCALAR   (             ipri_input, MIN_PRIORITY,  MAX_PRIORITY,   4 ) ;

    SCALAR   (  imax_archive_products,     1000,     200000,      50000 ) ;
    SCALAR   (     imax_disk_products,     1000,PRODUCT_FILES_MAX,50000 ) ;

    SCALAR   (          fcmap_dbzover,      0.0,       50.0,       10.0 ) ;
    SCALAR   (            icmap_eltol,   0x0000,     0x4000,        182 ) ;
    SCALAR   (           lcmap_usevel,        0,          1,          1 ) ;
    SCALAR   (          lAttnReingest,        0,          1,          0 ) ;
    M_SCALAR (          fAttnConstant,      0.0,       0.01,   0.000112 ) ;
    M_SCALAR (          fAttnExponent,      0.0,        1.0,       0.62 ) ;
    M_SCALAR (              fAttnMaxZ,    -32.0,       96.0,       50.0 ) ;
    M_SCALAR (     fAttnMaxCorrection,      0.0,       96.0,        6.0 ) ;
    SCALAR   ( fIngSimClutterStrength,      0.0,      100.0,        0.0 ) ;

    SCALAR   (             ingsim_lat,   -16384,      16384,          0 ) ;
    SCALAR   (             ingsim_lon,   -32768,      32767,          0 ) ;
    SCALAR   (      ingsim_timeoffset,  -4*3600,     4*3600,          0 ) ;
    SCALAR   (           ingsim_flags,        0,       0xFF,          0 ) ;
    SCALAR   (              ingsim_u0,     -125,        125,         20 ) ;
    SCALAR   (              ingsim_v0,     -125,        125,        -10 ) ;
    SCALAR   (            ingsim_wamp,        0,        100,          5 ) ;
    SCALAR   (            ingsim_whgt,       50,        250,        100 ) ;
    SCALAR   (             ingsim_def,        0,        250,         50 ) ;
    SCALAR   (           iNetworkWait,        0,      60*60,         60 ) ;
    SCALAR   (   lsocket_mode_control,        0,          1,          0 ) ;

    SCALAR   (      fvvpunf_maxsep_km,      0.0,      250.0,       50.0 ) ;
    SCALAR   (     ivvpunf_maxage_sec,        0,     6*3600,      30*60 ) ;
    SCALAR   (       lvvpunf_reingest,        0,          1,          1 ) ;

    M_SCALAR (       lMeltHeightValid,        0,          1,          1 ) ;
    M_SCALAR_1D(    ffallspd_vtz_coef,      0.0,       10.0,      0.800, 2 ) ;
    M_SCALAR_1D(     ffallspd_vtz_exp,      0.0,        0.5,      0.060, 2 ) ;
    M_SCALAR_1D(       ifallspd_melts,      -40,        100,          0, 12 ) ;
    SCALAR   (      lfallspd_reingest,        0,          1,          1 ) ;
    M_SCALAR (         lApplyGradient,        0,          1,          1 ) ;
    SCALAR   (       lIngestResetsDsp,        0,          1,          0 ) ;
    SCALAR   (       lIngestResetsRcp,        0,          1,          0 ) ;
    SCALAR   (          iMaxFcastDiff,        0,    24*3600,      15*60 ) ;
    SCALAR   (       iReferenceHeight,        0,      10000,       1000 ) ;
    SCALAR   (          iRainGageWait,        0,    2*60*60,       5*60 ) ;
    SCALAR   (      iWindowAlertStyle,     0, WINDOW_ALERT_TEXT_ONLY, 0 ) ;
    SCALAR   (    lWindowAlertOnFault,        0,          1,          1 ) ;
    SCALAR   (     iWindowFaultScheme,        0,          1,          0 ) ;
    SCALAR   (    lWindowAlertOnStale,        0,          1,          1 ) ;
    SCALAR   (       iWindowStaleTime,        6,       3600,      10*60 ) ;
    SCALAR   (           iNumKeptLogs,        0,        150,          5 ) ;
    STRING   (       sPassiveSiteCode, "" );
    SCALAR   (           iPassiveType,    0, 3, PASSIVE_TYPE_TSPLAYBACK ) ;
    SCALAR   (       lPassiveTrigRate,        0,          1,          1 ) ;
    SCALAR   (     lTargetDetReingest,        0,          1,          0 );
    SCALAR   (      lStatusModeChange,        0,          1,          1 );
    STRING   (        sStatusSiteCode, "" );
    SCALAR   (      lLabelBottomSline,        0,          1,          1 );
    SCALAR   (       lLabelBottomTdwr,        0,          1,          1 );
    SCALAR   (      lLabelBottomTrack,        0,          1,          1 );
    SCALAR   (       lLabelBottomWarn,        0,          1,          1 );
    SCALAR   (   fAzVelocityTolerance,        0,         50,        1.0 );
    M_SCALAR (       iProductBusyTime,        0,       3600,          0 );
    SCALAR   (    lHydroClassReingest,        0,          1,          0 );
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "network_device", sname_a ) )
    {
      struct network_device *item = item_a, itemref = *item ;

      SCALAR(   ifile_format,   1, NET_FILE_COUNT, NET_FILE_IRIS ) ;
      SCALAR(   iname_format,   1, NET_NAME_COUNT, NET_NAME_NATIVE ) ;
      SCALAR(      iCompress, NET_COMPRESS_NONE, NET_COMPRESS_MAXVALUE, NET_COMPRESS_GZIP ) ;
      SCALAR( inotify_scheme,   2,  6, NET_NOTIFY_NONE ) ;
      SCALAR(   icopy_scheme,   0,  4,   NET_COPY_NONE ) ;
      STRING(     sdirectory, "" ) ;
      STRING(     snode_name, "" ) ;

      CONDITIONAL_DISCRIMINANT { itemref.ifile_format = item->ifile_format ; }
      switch( itemref.ifile_format )
	{
	case NET_FILE_BMP:
	case NET_FILE_GIF:
	case NET_FILE_TIFF:
	case NET_FILE_PS:
	case NET_FILE_JPEG:
	case NET_FILE_PNG:
	  SCALAR( iheight, WINDOW_MIN_HEIGHT, VTV_MAX_HEIGHT,  480 ) ;
	  SCALAR( iwidth,  WINDOW_MIN_WIDTH,  VTV_MAX_WIDTH,   640 ) ;
	  break ;
	case NET_FILE_LINK:
	  SCALAR(  iheight,  16,  320,  160 ) ;
	  SCALAR(   iwidth,  16,  256,  128 ) ;
	case NET_FILE_PIPE:
	  SCALAR(  iheight,  16,  VTV_MAX_HEIGHT,  480 ) ;
	  SCALAR(   iwidth,  16,  VTV_MAX_WIDTH,   640 ) ;
	  SCALAR( iCommandLineSyntax, COMMAND_LINE_PIPE, COMMAND_LINE_PATHS,
		  COMMAND_LINE_PIPE ) ;
	  STRING( sPipeName, "" ) ;
	  break;
	}

      CONDITIONAL_DISCRIMINANT { itemref.inotify_scheme = item->inotify_scheme ; }
      switch( itemref.inotify_scheme )
	{
	case NET_NOTIFY_TCPIP:
	case NET_NOTIFY_UNIX:
	  SCALAR( itcpip_port, MIN_USER_PORT,  65535,  PORT_NETWORK_RECEIVER ) ;
	  break ;
	}

      CONDITIONAL_DISCRIMINANT { itemref.icopy_scheme = item->icopy_scheme ; }
      switch( itemref.icopy_scheme )
	{
	case NET_COPY_RCP:
	case NET_COPY_SCP:
	  STRING( sUserName, "operator" ) ;
	  break ;
	case NET_COPY_SCRIPT:
	  STRING(   sUserName, "" ) ;
	  xxSTRING( sPassword, "", SLCLASS_ENCODED ) ;
	  STRING( sScriptName, "ftp" ) ;
	  break ;
	}
    }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "one_input_setup", sname_a ) ) {
    struct one_input_setup *item = item_a;

    STRING(      sName, "" ) ;
    STRING( sDirectory, "" ) ;
    STRING(  sPipeName, "" ) ;
    SCALAR( iCommandLineSyntax, COMMAND_LINE_PIPE, COMMAND_LINE_PATHS,
	    COMMAND_LINE_PATHS ) ;
    SCALAR( iNotifyScheme, NET_NOTIFY_NONE, NET_NOTIFY_TCPIP, NET_NOTIFY_NONE ) ;

    SCALAR( iSocketPort, MIN_USER_PORT,  65535,  PORT_INPUT_RECEIVER ) ;

    /* This conditional code did not work. jmh 16 Apr 2003
      CONDITIONAL_DISCRIMINANT { itemref.iNotifyScheme = item->iNotifyScheme ; } 
    switch( itemref.iNotifyScheme )
      {
      case NET_NOTIFY_TCPIP:
	SCALAR( iSocketPort, MIN_USER_PORT,  65535,  PORT_INPUT_RECEIVER ) ;
	break ;
      }
    */
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "one_protected_region", sname_a ) ) {
    struct one_protected_region *item = item_a ;

    STRING( sname, "" ) ;
    if( (!lActualSizes) || item->sname[0] != ' ' ) {
      SCALAR   (   ixcenter, -50000000, 50000000,       0 ) ;
      SCALAR   (   iycenter, -50000000, 50000000,       0 ) ;
      SCALAR   (     ixsize,         0, 50000000,  100000 ) ;
      SCALAR   (     iysize,         0, 50000000,  100000 ) ;
      SCALAR   (     iangle,    0x0000,   0xFFFF,       0 ) ;
    }
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "one_web_user", sname_a ) ) {
    struct one_web_user *item = item_a ;

    STRING(     sHost, "*" ) ;
    STRING(     sName, "" ) ;
    STRING( sPassword, "" ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "printer_device", sname_a ) ) {
    struct printer_device *item = item_a ;

    SCALAR(   iheight,  0,  WINDOW_MAX_HEIGHT,             720 ) ;
    SCALAR(    iwidth,  0,   WINDOW_MAX_WIDTH,             880 ) ;
    SCALAR( iPaperSize, 0,     PAPER_SIZE_MAX, PAPER_SIZE_8x11 ) ;
    STRING( squeue, "" ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "protect_setup", sname_a ) ) {
    struct protect_setup *item = item_a ;
    SUBSTRUCTURE_1D( one_protected_region, protected_regions, IMAX_PROT_REGIONS ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "rcp_bit_def", sname_a ) ) {
    struct rcp_bit_def *item = item_a ;

    SCALAR(      lenabled,  0,  1,  0 ) ;
    SCALAR(         lhigh,  0,  1,  1 ) ;
    SCALAR( linitial_high,  0,  1,  0 ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "rcp_status_def", sname_a ) ) {
    struct rcp_status_def *item = item_a ;

    SCALAR(  lenabled,  0,  1,  0 ) ;
    SCALAR(     lhigh,  0,  1,  1 ) ;
    SCALAR( lCritical,  0,  1,  0 ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "rtdisp_channel_setup", sname_a ) ) {
    struct rtdisp_channel_setup *item = item_a ;

    STRING(          sXmtName, "rtd_v1_xmt" ) ;
    STRING( sBroadcastAddress, "192.168.0.255" ) ;
    SCALAR( iPortNum, MIN_USER_PORT, 65535, PORT_RTDISP ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "rtdisp_setup", sname_a ) ) {
    struct rtdisp_setup *item = item_a ;

    STRING(           sVersion, IRIS_VERSION ) ;
    SCALAR(           lEnabled,     0,     2, RTD_ENABLE_APP );
    SCALAR(      irtd_max_bins,     2, RTQ_MAX_BINS, 500 ) ;
    SCALAR(          iPriority, MIN_PRIORITY, MAX_PRIORITY,  -4 ) ;
    SCALAR(     lrtd_send_refl,     0,     1,     1 ) ;
    SCALAR( lrtd_send_velocity,     0,     1,     1 ) ;
    SCALAR(    lrtd_send_width,     0,     1,     0 ) ;
    SUBSTRUCTURE_1D( rtdisp_channel_setup, Channel, RTD_CHANNEL_COUNT ) ;
    /* Old (pre 8.01.8) structure:
     *   STRING( sXmtName, "rtd_v1_xmt" ) ;
     */
    GNIRTS( Channel[0].sXmtName, sXmtName ) ;
    /* Old (pre 8.01.5) structure:
     *   SCALAR( irtd_port, MIN_USER_PORT, 65535, PORT_RTDISP ) ;
     */
    RALACS( Channel[0].iPortNum,  MIN_USER_PORT,   65535, PORT_RTDISP, irtd_port) ;
    RALACS( Channel[1].iPortNum,  MIN_USER_PORT,   65535, PORT_RTDISP, irtd_port) ;
    RALACS( Channel[2].iPortNum,  MIN_USER_PORT,   65535, PORT_RTDISP, irtd_port) ;
    RALACS( Channel[3].iPortNum,  MIN_USER_PORT,   65535, PORT_RTDISP, irtd_port) ;
    RALACS( Channel[4].iPortNum,  MIN_USER_PORT,   65535, PORT_RTDISP, irtd_port) ;
    RALACS( Channel[5].iPortNum,  MIN_USER_PORT,   65535, PORT_RTDISP, irtd_port) ;
    /* Old (pre 7.27.1) structure:
     *   STRING( sBroadcastAddress1 ) ;
     *   STRING( sBroadcastAddress2 ) ;
     *   STRING( sBroadcastAddress3 ) ;
     */
    GNIRTS( Channel[0].sBroadcastAddress, sBroadcastAddress1 ) ;
    GNIRTS( Channel[1].sBroadcastAddress, sBroadcastAddress2 ) ;
    GNIRTS( Channel[2].sBroadcastAddress, sBroadcastAddress3 ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "site_list", sname_a ) ) {
    struct site_list *item = item_a ;

    STRING( site_name16, "" ) ;
    STRING(  site_name3, ""  ) ;
    SCALAR(    lChecked,       0,      1,    0 ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "site_setup", sname_a ) ) {
    struct site_setup *item = item_a ;

    STRING   (       sVersion, IRIS_VERSION ) ;
    SCALAR   (     lmmap_okay,        0,        1,        1 ) ;
    SCALAR   (   isite_number,  -100000,   100000,        0 ) ;
    SCALAR   (   imax_clients,        1,MAX_IRIS_CLIENTS, 3 ) ;
    SUBSTRUCTURE_1D( site_list, sites, MAX_SITES ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "special_link", sname_a ) ) {
    struct special_link *item = item_a ;

    SCALAR( background, 0, 16,  0 );
    SCALAR(   overlay1, 0, 16,  0 );
    SCALAR(  underlay1, 0, 16,  0 );
    SCALAR(  underlay2, 0, 16,  0 );
    SCALAR(     legend, 0, 16,  0 );
    SCALAR(   centroid, 0, 16,  0 );
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "web_setup", sname_a ) ) {
    struct web_setup *item = item_a ; SINT4 iCount ;

    STRING(           sVersion, IRIS_VERSION ) ;
    SCALAR(       iClientCount, 1,           100, 10 ) ;
    SCALAR(         iUserCount, 0, MAX_WEB_USERS,  0 ) ;
    SCALAR( lUserLoginRequired, 0,             1,  0 ) ;

    iCount = lActualSizes ? item->iUserCount : MAX_WEB_USERS ;
    iCount = MAX( 0, MIN( MAX_WEB_USERS, iCount ) ) ;
    SUBSTRUCTURE_1D( one_web_user, User, iCount ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else if( 0 == strcmp( "window_device", sname_a ) ) {
    struct window_device *item = item_a ;

    SCALAR(     iwidth,  WINDOW_MIN_WIDTH,  WINDOW_MAX_WIDTH, 640 ) ;
    SCALAR(    iheight, WINDOW_MIN_HEIGHT, WINDOW_MAX_HEIGHT, 480 ) ;
    SCALAR(      ixpos,            0,           2048,     10 ) ;
    SCALAR(      iypos,            0,           2048,     10 ) ;
    SCALAR(  imoviecnt,            0, MAX_LOOP_COUNT,     10 ) ;
    SCALAR( iToolState,  WINDOW_TOOLS_OFF, WINDOW_TOOLS_ON, WINDOW_TOOLS_ON ) ;
    STRING( sdisplay, "" ) ;
  }
  else if( 0 == strcmp( "ymds_time", sname_a ) ) {
    struct ymds_time *item = item_a ;

    SCALAR(   isec,       0,      86401,        0 ) ;
    SCALAR( imills,       0, YMDS_FLG_DST+999,  0 ) ;
    SCALAR(  iyear,    1900,       2100,     2000 ) ;
    SCALAR(   imon,       1,         12,        1 ) ;
    SCALAR(   iday,       1,         31,        1 ) ;
  }
  /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  else
    istatus = iMessageMod_va( CONFIG_LIM_BADSTRUCT, 1, sname_a ) ;

  return( istatus ) ;
}
