[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::decc_bugs

Title:DEC C Problem Reporting Forum
Notice:Report DEC C++ problems in TURRIS::C_PLUS_PLUS
Moderator:CXXC::REPETETCHEON
Created:Fri Nov 13 1992
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1299
Total number of notes:6249

1277.0. "DEC C V5.5 garbage in PTRMISMATCH message" by CSC32::D_SANFORD () Tue Mar 18 1997 19:21

    DEC C V5.5-002 on OpenVMS Alpha V6.2

    The following command procedure demonstrates a problem whereby the
    C compiler generates a corrupted message.  Sometimes when the
    corrupted message contains a hex 90 character the terminal will
    hang.  Sorry for the (300 block) example, when trying a simple
    example it does not fail.

    A workaround is to re-direct SYS$OUTPUT to a file.  This problem
    did not occur on earlier releases of DEC C.

    Regards, Drew Sanford
    Customer Support Center
    C970304-6304

$ ! test.com
$ !
$ create sys$output

   Compiler:  Alpha VMS DECC V5.5-002
   CSC Reference:  C970304-6304

   If you proceed to execute this .COM file it will

   (1) Create, in your default directory
        CNF_GETBGRP.C,  together with several include files
          which are required

   (2) Create command file RUN_EXAMPLE.COM

   (3) Execute @RUN_EXAMPLE.COM, which will:

     (1) DEFINE/USER SLCTXT to point to the
         default directory

     (2) Compile CNF_GETBGRP.C with its output (SYS$OUTPUT and
         SYS$ERROR) directed to CC.LOG.

     (3) Repeat (1) and (2), with output directed to the
         terminal, rather than CC.LOG.  When we do this,
         it hangs the terminal on a particular message
         after several pages of output.

$
$ inquire yn "Do you wish to continue?"
$
$       if .not.yn  then exit
$
$
$
$ create/log cnf_getbgrp.c
#include <stdio.h>                              
#include <stdlib.h>                             
#include <string.h>                             
#include <descrip.h>                            
#include <ctype.h>                              
#include <ots$routines.h>                       
#include "slctxt:configdef.h"                   
#include "slctxt:slc_macros.h"                  
#include "slctxt:slc_types.h"                   
#include "slctxt:err_proto.h"                   
#include "slctxt:sysutil_proto.h"               
#define RGBM_INCLUDE_EXPRSTRUCTS
#define RGBM_INCLUDE_BGRPSTRUCTS
#include "slctxt:mpg_ratelim_types.hc"          
#include "slctxt:rgbm_types.hc"                 
#include "slctxt:rgbm_vax_types.h"              
#include "slctxt:rgbm_utils_proto.h"            
#include "slctxt:cnf_param.h"                   
#include "slctxt:line_struc.h"                  
#include "slctxt:analog_struc.h"                
#include "slctxt:database_struc.h"              
#include "slctxt:timing_struc.h"                
#include "slctxt:cnf_struc.h"                   
#include "slctxt:cnf_proto.h"                   
 
   typedef struct
   {
      char bgrp_kw_a[4];                        
      char blank1_a[1];                         
      char bgrp_name_a[12];                     
      char eof_a[1];                            
   } rgbm_rbsv_inp_ts;
 
   static const rgbm_rbsv_inp_ts rgbm_rbsv_inp_init_s =
   { {"BGRP"},{" "},{"            "},{EOF} };                
 
vmsstat_t cnf_getbgrp(
             struct cnf_struc * const               conf_st_ps)
{
   struct dsc$descriptor     strng_desc;        
   vmsstat_t status;                            
   struct cnf_struc          conf_st_s;         
   char * cur_rgbm_ptr;                         
   char string_a[3];                            
   cnf_rgbm_buffer_tc buffer_c;                 
   struct dsc$descriptor buffer_desc;           
   rgbm_rbsv_inp_ts rgbm_rbsv_inp_s;            
   status = CONFIG_OKOK;
   strng_desc.dsc$b_dtype = strng_desc.dsc$b_class = 0;
   buffer_desc.dsc$b_dtype = buffer_desc.dsc$b_class = 0;
   buffer_desc.dsc$w_length = 0;
   buffer_desc.dsc$a_pointer = buffer_c;
   buffer_c[0] = 0;
   memcpy(&rgbm_rbsv_inp_s, &rgbm_rbsv_inp_init_s, sizeof(rgbm_rbsv_inp_s));
 
   conf_st_ps->timing_rec.fmt_type = CNF_FMT_B0;
   conf_st_ps->timing_rec.rgbm_ptr = NULL;      
   conf_st_ps->timing_rec.rgbm_bytes = 0;       
   conf_st_ps->timing_rec.value = 0.0;

   memcpy( conf_st_ps->timing_rec.secondary_c,
           "RACT",
           sizeof(conf_st_ps->timing_rec.secondary_c));

   memcpy( rgbm_rbsv_inp_s.bgrp_name_a,
           conf_st_ps->timing_rec.bgrp_name_c,
           sizeof( conf_st_ps->timing_rec.bgrp_name_c ));

   status = RGBM_rbsv( sizeof(rgbm_rbsv_inp_s), 
                       &rgbm_rbsv_inp_s,
                       CNF_RGBM_MAX_RECORD_SIZE,
                       &buffer_desc, 
                       cnf_rgbm_rbsv_pack,
                       NULL, NULL);

   if (SUCCESS(status))
      if (sizeof(buffer_c) <= strlen (buffer_c))
         status = err_send( &CONFIG_RGBM_NONULL );

   if (SUCCESS(status))
   {
      conf_st_ps->timing_rec.rgbm_bytes = 1 + strlen( buffer_c ); 
      status = cnf_vm_get( &conf_st_ps->timing_rec.rgbm_bytes, 
                           &conf_st_ps->timing_rec.rgbm_ptr );
   }
   
   if (SUCCESS(status))
   {
      strcpy( conf_st_ps->timing_rec.rgbm_ptr, buffer_c );
      for (cur_rgbm_ptr = strchr(conf_st_ps->timing_rec.rgbm_ptr, '\0');

           (cur_rgbm_ptr != NULL) &&
      ((unsigned) cur_rgbm_ptr > (unsigned) conf_st_ps->timing_rec.rgbm_ptr) &&
           (*(cur_rgbm_ptr - 1) == '\n');

           *(cur_rgbm_ptr - 1) = '\0',
           cur_rgbm_ptr--)
         ;

      for (conf_st_ps->timing_rec.no_values = 0,
           cur_rgbm_ptr = conf_st_ps->timing_rec.rgbm_ptr;

           cur_rgbm_ptr;

           cur_rgbm_ptr = strchr( cur_rgbm_ptr + 1, '\n' ),
           conf_st_ps->timing_rec.no_values++)
         ;

      strng_desc.dsc$w_length = sizeof(string_a);
      strng_desc.dsc$a_pointer = string_a;
      status = ots$cvt_l_tu(
     &conf_st_ps->timing_rec.no_values,         
     &strng_desc,                               
     1,                                         
     sizeof(conf_st_ps->timing_rec.no_values)); 

      if (!SUCCESS(status))
      {
         strng_desc.dsc$w_length = 13;
         strng_desc.dsc$a_pointer = "OTS$CVT_L_TU:";
         errchk( &strng_desc, &status );
      }
   }

   if (!SUCCESS(status))
   {
      if (conf_st_ps->timing_rec.rgbm_ptr != NULL )
      {
         cnf_vm_free( &conf_st_ps->timing_rec.rgbm_bytes,
                      &conf_st_ps->timing_rec.rgbm_ptr );
         conf_st_ps->timing_rec.rgbm_ptr = NULL;
         conf_st_ps->timing_rec.rgbm_bytes = 0;
      }
      memcpy( conf_st_ps->timing_rec.secondary_c,
              "RBAD",
              sizeof(conf_st_ps->timing_rec.secondary_c));
      conf_st_ps->timing_rec.no_values = 0;
   }


   conf_st_ps->timing_rec.status = status;
   return(status);
}
$ CREATE/LOG CONFIGDEF.H
#ifndef CONFIGDEF_H
#define CONFIGDEF_H
 
#define CONFIG$_FACILITY 2149
#define CONFIG_OKOK 140869641
#define CONFIG_CONFGET 140869715
#define CONFIG_CONFACT 140869723
#define CONFIG_CONFDELETE 140869731
#define CONFIG_LOCKED 140869739
#define CONFIG_CONFSAVE 140869747
#define CONFIG_ENDFILE 140869755
#define CONFIG_MAGBLOW 140869760
#define CONFIG_MAGABOV 140869768
#define CONFIG_MOVED 140869779
#define CONFIG_CONFIGDB 140870434
#define CONFIG_TEMPLATE 140870442
#define CONFIG_NOINDEX 140870450
#define CONFIG_EMPINDEX 140870458
#define CONFIG_NOCONFIG 140870466
#define CONFIG_LDCONV 140870474
#define CONFIG_CONFAPP 140870482
#define CONFIG_BADNAME 140870490
#define CONFIG_BADPOIN 140870498
#define CONFIG_BADFMT 140870506
#define CONFIG_BADNUMVAL 140870514
#define CONFIG_BADCONT 140870522
#define CONFIG_NOMATCH 140870530
#define CONFIG_CHANGED_FMT 140870538
#define CONFIG_BADCLASS 140870546
#define CONFIG_BADOPERATION 140870554
#define CONFIG_BAD_DIR 140870594
#define CONFIG_NEG_NUMBER 140870602
#define CONFIG_INVALID_TYPE 140870610
#define CONFIG_INVALID_TYPE_INDEX 140870618
#define CONFIG_NONEX_REC 140870674
#define CONFIG_ERROR 140870754
#define CONFIG_ITEM_NOT_DB 140870762
#define CONFIG_ITEM_NOTLOAD 140870770
#define CONFIG_ITEM_NOTSAVE 140870778
#define CONFIG_USER_ABORT 140870832
#define CONFIG_NEW_GOLD 140870840
#define CONFIG_CALLMEAGAINBAD 140870848
#define CONFIG_AUTODEL_END_WARN 140870856       
#define CONFIG_NOTIFY 140870864
#define CONFIG_TRACK 140870872
#define CONFIG_MSG 140870880
#define CONFIG_NULL_NAME 140870915
#define CONFIG_CALLMEAGAIN 140870923
#define CONFIG_AUTODEL_START 140870931
#define CONFIG_AUTODEL_END 140870939
#define CONFIG_AUTODEL 140870947
#define CONFIG_CONVERT_START 140870955
#define CONFIG_CONVERT_SUCCESS 140870963
#define CONFIG_CONFTRIM 140870971
#define CONFIG_CONFRAMP 140870979
#define CONFIG_STRING_SHORT 140871234
#define CONFIG_GOLD_HST_BAD 140871242
#define CONFIG_NO_SUMMARY_INIT 140871250
#define CONFIG_GOLD_DELETE 140871258
#define CONFIG_BADTYPE 140871266
#define CONFIG_IS_BPM 140871274
#define CONFIG_NOT_BPM 140871282
#define CONFIG_NO_GOLD 140871290
#define CONFIG_GOLD_INCON 140871298
#define CONFIG_ENDFILE_BAD 140871306
#define CONFIG_CONVERT_FAILURE 140871314
#define CONFIG_WRONG_CLASS 140871322
#define CONFIG_RGBM_NODATA 140871634
#define CONFIG_RGBM_TOOBIG 140871642
#define CONFIG_RGBM_BADLINES 140871650
#define CONFIG_RGBM_NONULL 140871658
#define CONFIG_RGBM_MALLOC 140871666
#define CONFIG_CONFACT_NONE_USER 140871712
#define CONFIG_CONFACT_PROB 140871720
#define CONFIG_CONFACT_NONE 140871728
#define CONFIG_CONFTRIM_NONE_USER 140871736
#define CONFIG_CONFTRIM_PROB 140871744
#define CONFIG_CONFRAMP_NONE_USER 140871752
#define CONFIG_CONFRAMP_PROB 140871760
#define CONFIG_CA_QUAL_TOO_LONG 140871794
#define CONFIG_CA_QUAL_MISSING 140871802
#define CONFIG_CA_NO_DATA_PRESENT 140871810
#define CONFIG_CA_CH_FORMAT_BAD 140871818
#define CONFIG_CA_OVERLAP 140871826
#define CONFIG_CA_INVALID_CH_NAMES 140871834
#define CONFIG_CA_TOOLONG 140871842
#define CONFIG_CA_INVBUFLEN 140871850
#define CONFIG_CA_BADSTRING 140871858
#define CONFIG_CA_BADSTRING_TYPE 140871866
#define CONFIG_CA_ON_CHAN 140871875
#endif
$
$ CREATE/LOG DESCR.H

#ifndef DESCR_H
#define DESCR_H

#define DESCR_DECLARE_INIT        \
                                       {                                      \
                                        { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0} \
                                       ,{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0} \
                                       ,{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0} \
                                       ,{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0} \
                                       ,{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0} \
                                       ,{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0} \
                                       ,{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0} \
                                       ,{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0} \
                                       ,{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0} \
                                       ,{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0} \
                                       }                                       


#define DESCRN(name, index)                                     \
  (descrn[index].dsc$w_length = (unsigned short) strlen(name),  \
   descrn[index].dsc$a_pointer = (char *) (name),               \
   &descrn[index])

#define DESCRA(name,index)                                       \
   (descra[index].dsc$w_length = (unsigned short) sizeof(name),  \
    descra[index].dsc$a_pointer = (char *) (name),               \
    &descra[index])

#define DESCR(ptr,len,index)                                    \
   (descr[index].dsc$w_length = (unsigned short) (len),         \
    descr[index].dsc$a_pointer = (char *) (ptr),                \
    &descr[index])

#define DESCR_DECLARE  \
     struct dsc$descriptor descrn[10] = DESCR_DECLARE_INIT; \
     struct dsc$descriptor descra[10] = DESCR_DECLARE_INIT; \
     struct dsc$descriptor descr[10]  = DESCR_DECLARE_INIT   

#define DESCRN1( name)     DESCRN( name, 0 )
#define DESCRN2( name)     DESCRN( name, 1 )
#define DESCRN3( name)     DESCRN( name, 2 )
#define DESCRN4( name)     DESCRN( name, 3 )
#define DESCRN5( name)     DESCRN( name, 4 )
#define DESCRN6( name)     DESCRN( name, 5 )
#define DESCRN7( name)     DESCRN( name, 6 )
#define DESCRN8( name)     DESCRN( name, 7 )
#define DESCRN9( name)     DESCRN( name, 8 )
#define DESCRN10(name)     DESCRN( name, 9 )

#define DESCRA1( name)     DESCRA( name, 0 )
#define DESCRA2( name)     DESCRA( name, 1 )
#define DESCRA3( name)     DESCRA( name, 2 )
#define DESCRA4( name)     DESCRA( name, 3 )
#define DESCRA5( name)     DESCRA( name, 4 )
#define DESCRA6( name)     DESCRA( name, 5 )
#define DESCRA7( name)     DESCRA( name, 6 )
#define DESCRA8( name)     DESCRA( name, 7 )
#define DESCRA9( name)     DESCRA( name, 8 )
#define DESCRA10(name)     DESCRA( name, 9 )

#define DESCR1(  ptr, len) DESCR(  ptr, len, 0 )
#define DESCR2(  ptr, len) DESCR(  ptr, len, 1 )
#define DESCR3(  ptr, len) DESCR(  ptr, len, 2 )
#define DESCR4(  ptr, len) DESCR(  ptr, len, 3 )
#define DESCR5(  ptr, len) DESCR(  ptr, len, 4 )
#define DESCR6(  ptr, len) DESCR(  ptr, len, 5 )
#define DESCR7(  ptr, len) DESCR(  ptr, len, 6 )
#define DESCR8(  ptr, len) DESCR(  ptr, len, 7 )
#define DESCR9(  ptr, len) DESCR(  ptr, len, 8 )
#define DESCR10( ptr, len) DESCR(  ptr, len, 9 )

#endif
$
$ CREATE/LOG SLC_MACROS.H

#ifndef SLC_MACROS_H
#define SLC_MACROS_H

#define TO_ACTIVE_CONSOLE 1    
                               
#define NOT_FOUND        -1    

#define GS_PAGE_BC       8192  
 
#define BYTES_PER_PAGE    512  

#define BYTES_PER_WORD      2  
#define BYTES_PER_LONGWORD  4  
#define BYTES_PER_QUADWORD  8  

#define BITS_PER_BYTE       8  
#define BITS_PER_WORD      16  
#define BITS_PER_LONGWORD  32  
#define BITS_PER_QUADWORD  64  

#define BITS(i)         ((sizeof(i) * BITS_PER_BYTE)
#define WORDS(i)        ((sizeof(i)+BYTES_PER_WORD-1)/BYTES_PER_WORD)
#define LONGWORDS(i)    ((sizeof(i)+BYTES_PER_LONGWORD-1)/BYTES_PER_LONGWORD)
#define QUADWORDS(i)    ((sizeof(i)+BYTES_PER_QUADWORD-1)/BYTES_PER_QUADWORD)
#define PAGES(i)        ((sizeof(i)+BYTES_PER_PAGE-1)/BYTES_PER_PAGE )

#define     BUILDDESC(name)     \
struct dsc$descriptor name = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_D, 0}
#define     BUILDDESC_F(name)     \
struct dsc$descriptor name = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0}
#define     FILLDESC(name,str)  \
    (name).dsc$w_length = strlen(str); \
    (name).dsc$a_pointer = (str)
#define     FILLDESC_F(name,str)  \
    (name).dsc$w_length = sizeof(str); \
    (name).dsc$a_pointer = (str)
#define     BUILDANDFILLDESC(name, str)     \
struct dsc$descriptor name =  \
    { sizeof(str)-1, DSC$K_DTYPE_T, DSC$K_CLASS_S, (str)}

typedef     struct dsc$descriptor   fstring_ts;

#include    "slctxt:netparm.hc"         

#define MAILALLOC(size)     \
         malloc((size + NETHEADERLEN)*2)

#define DBALLOC(ptr, size)        \
          ptr = (short *) malloc((size + 2)*BYTES_PER_WORD); \
          *ptr= (size + 2);     \
          *(ptr+1) = 0

#define REALLOC(ptr, size)        \
            (ptr) ? realloc( (ptr), (size) ) : malloc( size )

#include    <stdio.h>                   

#ifndef BOOLEAN_DEF
#define BOOLEAN_DEF
typedef enum {FALSE_B = FALSE, TRUE_B = TRUE} BOOLEAN;
#endif

#define VAL(name)    ( * ((int4u *) (name))  )  

#define NULL_TO_PAD(name, size)                                        \
         if (strlen((char *)(name)) < (size) )                         \
         {                                                             \
            memset( (char *)(name) + strlen((char *)(name)), ' ',      \
                    size - strlen((char *)(name)) );                   \
         }

#define PAD_TO_NULL(name, size)                                        \
        {                                                              \
           char *p = (char *)(name) + size - 1;                        \
           for (*p = 0, p--;  (*p==' ')&&(p>=(char *)(name)); *p = 0, p-- ); \
        }            

#define MEMSTR(name_in, size, name_out)                               \
        {                                                             \
           strncpy(name_out, name_in, size);                          \
           name_out[size] = '\0';                                     \
        }

#define TIME1_IS_AFTER_TIME2(time1,time2)                                     \
 (                                                                            \
    ( ((int4u *)(time1))[1] > ((int4u *)(time2))[1]  )                        \
    ||                                                                        \
    (                                                                         \
       ( ((int4u *)(time1))[1] ==((int4u *)(time2))[1]  )                     \
       &&                                                                     \
       ( ((int4u *)(time1))[0] > ((int4u *)(time2))[0]  )                     \
    )                                                                         \
 )

#define TIME_IS_ABSOLUTE(time) ( ((int4 *)(time))[1] >= 0 )

#define TIME_IS_DELTA( time )   (!(TIME_IS_ABSOLUTE(time)))

#include "slctxt:slc_macros.hc"

#endif

$
$ CREATE/LOG SLC_TYPES.H

#ifndef SLC_TYPES_DEF

typedef char comp_state_name_ta [8];   
typedef char alias_name_ta [12];       
typedef char user_name_ta [12];        
typedef char config_dir_name_ta [8];   
typedef char config_name_ta [12];      
typedef char mach_mode_ta [8];         
typedef char vax_node_name_ta [20];    
typedef char vax_account_name_ta [12]; 
typedef char vax_password_ta [32];     
typedef int4u vax_password_hashed_ta [2]; 
typedef int4u vax_timestamp_ta [2];    
typedef char vax_process_name_ta [23]; 
typedef char comp_name_ta [8];         
typedef char beamcode_name_ta [8];     
typedef char summary_name_ta [8];      
typedef char long_summary_name_ta [22];
typedef char color_name_ta [8];        
typedef char hex4u_ascii_ta [8];       
#define BTN_NAME_SIZE 8                
typedef char btn_name_ta[ BTN_NAME_SIZE ];
#define BTN_ROW_SIZE 8                 
#define BTN_NROWS 4                    
#define BTN_TEXT_SIZE (BTN_ROW_SIZE * BTN_NROWS) 
#define MAX_FILESPEC_SIZE 255          
typedef char filespec_tc[MAX_FILESPEC_SIZE+1];  

typedef char filespec_ta[MAX_FILESPEC_SIZE];                             

#define MAX_MSG_SIZE      256          

typedef char vmsstat_msg_tc[MAX_MSG_SIZE+1];          

typedef char vmsstat_msg_ta[MAX_MSG_SIZE];                             

typedef char timestamp_abs_ascii_ta[23];

#define MAX_LOG_OR_EQUIV_NAME_SIZE 255 

typedef char log_name_ta[MAX_LOG_OR_EQUIV_NAME_SIZE];
typedef char log_name_tc[MAX_LOG_OR_EQUIV_NAME_SIZE+1];

typedef char equiv_name_ta[MAX_LOG_OR_EQUIV_NAME_SIZE];
typedef char equiv_name_tc[MAX_LOG_OR_EQUIV_NAME_SIZE+1];

typedef struct
{
   variant_union
   {
      int4u  _i;                       
      char   _a[4];                    
   } dummy_u;
} name_ts;                             

#define NAME_IS_ASCII(name)  ((name) >= '    ') 

typedef name_ts prim_name_ts;          

typedef name_ts micr_name_ts;          

typedef name_ts unit_name_ts;          

typedef name_ts secn_name_ts;          

typedef name_ts chan_name_ts;          

typedef name_ts bit_name_ts;           

typedef struct
{
   variant_union
   {
      int4u  i_a[2];                   
      char   a_a[8];                   
   } dummy_u;
} name2_ts;                            

typedef name2_ts comp_name_ts;

typedef name2_ts state_name_ts;        
struct StateName_s
{
    int2u severity;                 

    variant_union
    {
       comp_state_name_ta name_a;      
       int2u              value_i2;    
    } dummy_u;
};
typedef struct StateName_s StateName_ts;



#define DB_PRIM_NAME_LEN  sizeof(prim_name_ts)  
#define DB_MICR_NAME_LEN  sizeof(micr_name_ts)  
#define DB_UNIT_NAME_LEN  sizeof(unit_name_ts)  
#define DB_CHAN_NAME_LEN  sizeof(name2_ts)      

typedef struct
{
   prim_name_ts prim_s;                
   unit_name_ts unit_s;                
} prim_unit_ts;

typedef struct
{
   micr_name_ts first_s;               
   micr_name_ts last_s;                
} micr_range_ts;

typedef struct
{
  micr_name_ts      micr_s;            
  unit_name_ts      unit_s;            

} micr_unit_ts;

typedef struct
{
    micr_name_ts micr_s;          
    vmsstat_t    stat;            
    int4u       *send_data_p;     
    vmsstat_t   *reply_data_p;    
    int4u        reply_data_len;  
} micr_stat_ptr_ts;

typedef struct        
{
  void            *forward_link_p;   
  vmsstat_t       *exit_handler_p;   
  int4u            arg_count;        
  vmsstat_t       *condition_value_p;

} exit_block_ts;

typedef struct
{
   int2u buffer_length;                         
   int2u item_code;                             
   void  *buffer_address_p;                     
   int2u *return_length_address_p;              
} item_descriptor_ts;            


#define SLC_TYPES_DEF
#endif
$
$ CREATE/LOG ERR_PROTO.H
#ifndef ERR_PROTO_H
#define ERR_PROTO_H
 
unsigned long int err_send_string(
    const unsigned long int  *status,
    const struct dsc$descriptor *string
    ) ;

unsigned long int err_get_remote() ;

unsigned long int err_set(
    const unsigned short int  *facility_code,
    const char  *sev_lev
    ) ;

unsigned long int err_text(
    const unsigned long int  *status,
    const struct dsc$descriptor *string,
    ...
    ) ;

unsigned long int errchk(
    const struct dsc$descriptor *serv,
    const unsigned long int  *msg_code
    ) ;

unsigned long int err_set_remote(
    const char  *dest_name,
    char  *sev_info
    ) ;

unsigned long int err_send(
    const unsigned long int  *symbol,
    ...
    ) ;

unsigned long int err_send_n(
    const unsigned long int  error,  
    const unsigned long int  num_args,
    const unsigned long int  *args_a
    ) ; 

unsigned long int err_translate(
    const unsigned long int  *symbol,
    struct dsc$descriptor *,
    ...
    ) ;
#endif
$
$ CREATE/LOG SYSUTIL_PROTO.H
 
#ifndef SYSUTIL_PROTO_H

unsigned long NumLstElem(
    const char* ply_ps, 
    const char* nextElemPtr_ps
    ) ;

long int center(
    const struct dsc$descriptor *string,
    const long int  *columns
    ) ;

unsigned long int check_filespec(       
    const struct dsc$descriptor *file
    ) ;

unsigned long int check_userid( 
    const struct dsc$descriptor *userid,
    unsigned long int  *uic
    ) ;

unsigned long int check_write(  
    const struct dsc$descriptor *object
    ) ;

long int chtrunb_c(     
    const char  *string
    ) ;

int     chtrunb_a ( 
    const char s[], 
    int len 
    );

long int chtrunb(       
    const struct dsc$descriptor *string
    ) ;

unsigned long int str_concat_nb(        
    const struct dsc$descriptor *start,
    const struct dsc$descriptor *end,
    struct dsc$descriptor *result
    ) ;

unsigned long int cli_get_lw() ;

unsigned long int cli_get_time() ;

void cvt_atime() ;

void cvt_time() ;

void cvt_dtime() ;

void cvtitoc(
    struct dsc$descriptor *function_value,
    const int * *source,
    const long int  *length
    ) ;

unsigned long int cvt_a4_to_i4(
    const char  *a4,
    long int  *i4
    ) ;

unsigned long int cvt_i4_to_a4(
    const long int  *i4,
    char  *a4
    ) ;

void cvt_twos_compliment( unsigned char    size, 
                          unsigned long    num, 
                          unsigned short  *sorc_a,
                          unsigned long   *dest_a );

 void cvt_ieee_to_vms_flt(void *sorc_a, float dest_a[], unsigned short *nlong_p);
 void cvt_ieee_to_vms_dbl(void *sorc_a, double dest_a[], unsigned short *nquad_p);
 void cvt_ieee68_to_vms_flt(void *sorc_a, float dest_a[], unsigned short *nlong_p);
 void cvt_ieee68_to_vms_dbl(void *sorc_a, double dest_a[], unsigned short *nquad_p);
 void cvt_vms_to_ieee_flt(float sorc_a[], void *dest_a, unsigned short *nlong_p);
 void cvt_vms_to_ieee_dbl(double sorc_a[], void *dest_a, unsigned short *nquad_p);
 void cvt_vms_to_ieee68_flt(float sorc_a[], void *dest_a, unsigned short *nlong_p);
 void cvt_vms_to_ieee68_dbl(double sorc_a[], void *dest_a, unsigned short *nquad_p);
 void cvt_vms_g_to_vms_dbl(double *sorc_a, double dest_a[], unsigned short *nquad_p);
 void cvt_vms_dbl_to_vms_g(double *sorc_a, double dest_a[], unsigned short *nquad_p);

unsigned long int cvt_r4_to_c6(
    const float  *value,
    struct dsc$descriptor *string,
    ...
    ) ;

unsigned long int cvt_seconds_to_vtime(
    const double        *seconds,
    int vtime [2]
    ) ;

void cvt_vtime_to_seconds() ;

unsigned long int cvt_prep_time(
    const struct dsc$descriptor *intime,
    struct dsc$descriptor *outtime
    ) ;

unsigned long int cvt_lasts_to_r4(
    const struct dsc$descriptor *string,
    float  *value
    ) ;

unsigned long int file_build_spec() ;

unsigned long int file_purge() ;

unsigned long int parse_filespec() ;

unsigned long int unique_file() ;

unsigned long int getnefm(      
    const unsigned long int  *n,
    unsigned long int  *efns,
    unsigned long int  *efm,
    ...
    ) ;

unsigned long int getuic(       
    unsigned long int  *uic
    ) ;

unsigned long int getuserid(    
    struct dsc$descriptor *userid
    ) ;

unsigned long int get_default(  
    struct dsc$descriptor *def_spec
    ) ;

unsigned long     get_proc_name_or_pid( 
    struct dsc$descriptor * const             procname,   
    unsigned long * const                     procnaml,   
    unsigned long * const                     pid,        
    unsigned long * const                     procindx,   
    unsigned long const * const               srchflag    
    );
 
long int find_index(
    const void *array,
    const unsigned short *elsiz,
    const unsigned short *nelts,
    const void *key,
    ...
    ) ;

unsigned long int proc_active(
    const struct dsc$descriptor *procname,
    int logintim [2]
    ) ;

unsigned long int sts_worse(
    const unsigned long int  *status1,
    const unsigned long int  *status2
    ) ;

unsigned long int sts_best(
    const unsigned long int  *status1,
    const unsigned long int  *status2
    ) ;

unsigned long int trnlnm(
    const struct dsc$descriptor *name,
    struct dsc$descriptor *equiv
    ) ;

unsigned long int trnlnm_tab(
    const struct dsc$descriptor *name,
    const struct dsc$descriptor *table,
    struct dsc$descriptor *equiv
    ) ;

unsigned long int add_lw_to_list() ;

unsigned long int compact_lw_list() ;

unsigned long int match_lw_list() ;

unsigned long int lw_list_nodup(
    const short int *list,
    const long int  *start
    ) ;

unsigned long int probe_rw(
    void const * const          begbyt,
    void const * const          lasbyt
    );

unsigned long int rms_copy() ;

unsigned long int rms_flush() ;

unsigned long int rms_get() ;

unsigned long int rms_put() ;

unsigned long int rms_open_new() ;

unsigned long int rms_open_old() ;

unsigned long int slc_sleep(
    const long int  *interval
    ) ;

unsigned long int utl_spawn_to_sys$output(
    const struct dsc$descriptor *command_string,
    const struct dsc$descriptor *input_file,
    const unsigned long int     *flags_arg,
    const unsigned long int     *completion_status,
    const struct dsc$descriptor *prompt_string,
    const struct dsc$descriptor *cli,
    const struct dsc$descriptor *table
    ) ;

long int difft10(
    const unsigned long time1[2],
    const unsigned long time2[2]
    ) ;
 
#ifdef SECTION
 
unsigned long int OpenSection(struct MapDesc * const MapDesc,
                              const struct dsc$descriptor * const Name,
                              const unsigned Id,
                              const struct dsc$descriptor * const File,
                              const unsigned Options);
 
unsigned long int mapSection(struct MapDesc * const MapDesc,
                             const struct dsc$descriptor * const Name,
                             const unsigned Id);
 
unsigned long int DeleteSection(const struct dsc$descriptor * const Name,
                                const unsigned Id, const unsigned match);
 
unsigned long int updateSection(struct MapDesc * const MapDesc,
                                const unsigned long efn,
                                unsigned long * const iosb,
                                void const astadr(void),
                                unsigned long * const astprm);
 
#endif

unsigned long int get_node_name(
    struct dsc$descriptor *node_name_p
    ) ;

unsigned long int build_full_process_name(
    const struct dsc$descriptor *node_name_p,
    struct dsc$descriptor *process_name_p
    ) ;
 
unsigned long int upcaselj(unsigned long int    length,
                           unsigned char const * const  string_in_p,
                           unsigned char * const        string_out_p);
 
 void qiksortu(const unsigned long *items_n_p, void *array_p, const unsigned short *item_bc_p,
               const unsigned short *key_off_p, const unsigned short *key_bc_p);
 
 void qiksortc(const unsigned long *items_n_p, void *array_p, const unsigned short *item_bc_p,
               const unsigned short *key_off_p, const unsigned short *key_bc_p);
 
 void qiksortf(const unsigned long *items_n_p, void *array_p, const unsigned short *item_bc_p,
               const unsigned short *key_off_p, const unsigned short *key_typ_p);
 
unsigned long Count_1bits(const void *bitstring_p, const unsigned long *nbits_p);
 
unsigned long Find_index_c(const void *arr_a, unsigned long elsiz,
                           unsigned long nelts, const void *key_p,
                           ...
                           );
 
unsigned long Find_index_ascii_nocase(const void *arr_a, unsigned long elsiz,
                                      unsigned long nelts, const void *key_p,
                                      unsigned long keysiz, unsigned long keyoff);
 
 
void CVT_mem_ascii_upcase(char *mem_dest_p, const char *mem_sorc_p,
                          unsigned long mem_siz);
 
int CMP_mem_ascii_nocase(const char *memx_p, const char *memy_p,
                         unsigned long mem_siz);
 
 void BYTE1(const unsigned short sorc_p[], unsigned short dest_p[],
            const long int *nwds_p);
 
 void BYTE2(const unsigned long sorc_p[], unsigned long dest_p[],
            const long int *nlngwds_p);
 
 void BYTE4(const unsigned long sorc_p[], unsigned long dest_p[],
            const long int *nlngwds_p);
 
 void BYTE8(const unsigned long sorc_p[][2], unsigned long dest_p[][2],
            const long int *nquadwds_p);
 
 void CLRMEM(long int arrz_a[], const unsigned long *nlngwds_p);
 
 int chscanx(const struct dsc$descriptor *line_descp, const char *tch1_p, ...
                           /* const char *tch2_p, const char *tch3_p, ... */);
 
 int addc2(const struct dsc$descriptor *stra_descp, const struct dsc$descriptor *strb_descp);
 
unsigned Check_elapsed_hundsecs(unsigned long vms_time_p[2], long int hundsecs);

unsigned long strarr(char* const dest_pa, const char* src_c, size_t len);

char *strdup( const char *sz );

char *strndup( const char *sz, size_t cc );

void free_list( void* head_ps, void** next_ps );
 
void cfree_list( void* head_ps, void** next_ps );

unsigned long int MEM_get_smallest_repeat(
   void const * const                           source_p,
   unsigned long int const                      source_len,
   unsigned long int * const                    smallest_repeat_len_p );

unsigned long int CVT_vaxc_rtl_to_vms_time( const long int ctime,
                 unsigned long int  vaxtime_a [2]);

unsigned long int estab_sig_to_ret( unsigned long int *signal_pa );

unsigned long int AmIInteractive( );

#define SYSUTIL_PROTO_H
#endif
 
$
$ CREATE/LOG RGBM_TYPES.HC
 
#ifndef RGBM_TYPES_HC
 
#define N_TIMESLOTS       6   
 
#define BGRP_BCODS_MAX    6   
#define MGRP_BCODS_MAX    6   
#define BGRPS_ACTIVE_MAX  4   
#define PATT_COWN_DB_MAX 12   
#define PATT_COWN_MEM_MAX    16 
#define PATT_COWN_ORAND_MAX 960 
#define BGRPS_UMAX     50     
#define PNBNS_UMAX    144     
#define TMVAS_UMAX     80     
#define KFTCS_UMAX     20     
 
#define BGRP_MGRPS_MAX   40        
#define BGRP_PATTS_MAX  250        
#define BGRP_TIMERS_MAX  20        
#define BGRP_TIMER_NAME_SIZE 12    
#define MGRP_GOTOS_MAX       16    
#define MGRP_GOTO_TESTS_MAX   4    
#define MGRP_GOTO_TIMERS_MAX  4    
#define MGRP_IFKEYS_N         5    
#define MGRP_IFKEY_SIZE_MAX  16    
 
#define BEAMCODE_NAME_SIZE  8   
#define BCODMODF_NAME_SIZE 12   
#define BGRP_NAME_SIZE     12   
#define MGRP_NAME_SIZE     16   
#define TMVA_NAME_SIZE     12   
#define KFTC_NAME_SIZE      8   
 
#define PNBN_HSTA_DUPCDCOND  0x0010    
#define PNBN_HSTA_DMPREQOK   0x0020    
#define PNBN_HSTA_PLICDMOD   0x0080    
#define PNBN_HSTA_CMPX_MASK  0x1F00    
#define PNBN_HSTA_CMPX_SHFC  8
#define TMVA_HSTA_MICRCNTRL  0x0010     
#define TMVA_HSTA_PSKMODE    0x0020     
#define TMVA_HSTA_VDUCNTRL   0x0040     
#define TMVA_HSTA_DRTCCNTRL  0x0080     
#define BGRP_HSTA_RLAREA     0x00F0     
#define BGRP_HSTA_RLAREA_SHFC     4
#define BGRP_HSTA_TSGROUP    0x0300     
#define BGRP_HSTA_TSGROUP_SHFC    8     
 
#define PSK_MODULUS      29     
#define PSK_VALNOP    -0x800    
 
#define MODF_BITS_PBCOD_MAX      11   
#ifdef N_BEAMS
#define RGBM_SUBSPP_MIN     N_BEAMS   
#define RGBM_SUBSPP_MAX         247   
#endif
 
#define PNET_MODFBIT_LOLIM       32   
#define PNET_MODFBIT_HILIM      128   
#define MAX_MODFR_MASK ((PNET_MODFBIT_HILIM-PNET_MODFBIT_LOLIM+31)/32)
 
#define PPTRANS_CRATE_GROUPS_MAX 4    
#define CND_TOKV_TOS    0xE0            
#define TVS_TOKV_TMATVAL  0xFFFE        
#define TVS_TOKV_DEACTVAL 0xFFFF        
#define TVS_TOKIZED_LEN_MAX  20         
                                        
#define BGRP_FLGM_BGRP_STRTUP   0x8000  
#define BGRP_FLGM_BGRP_DEACT1   0x4000  
#define BGRP_FLGM_BGRP_DEACT2   0x2000  
#define BGRP_FLGM_BCOD_PRIO     0x000F  
#define BGRP_FLGM_BCOD_SUSP     0x0010  
#define BGRP_FLGM_BCOD_NOKLYS   0x0020  
                                        
#define BGRP_FLGM_BCOD_P2SYN    0x0040  
                                        
#define BGRP_FLGM_BCOD_DIMZERO  0x1000  
#define BGRP_FLGM_MODF_SUSP     0x0010  
#define BGRP_FLGM_MODF_DEADT    0x0020  
#define BGRP_FLGM_MODF_ONESH    0x0040  
#define MGRP_FLGM_RSTRT_PATTS   0x0001  
#define TIMEX_MICRO_PORT         60   
#define TIMEX_BUFSIZ_MAX       7168   
#define TIMEX_REQTYPE_DOWNLOAD    1   
#define TIMEX_REQFLAG_TMATRIX  0x01   
#define TIMEX_REQFLAG_TEXPR    0x02   
#define TIMEX_REQFLAG_TMVA     0x04   
#define TIMEX_INTTYPE_CONTINUE    1   
#define TIMEX_INTTYPE_FINISH      2   
#define TIMEX_INTTYPE_REQUEST     3   
 
#define TIMESLOT_NAMELIST(labl) char labl[N_TIMESLOTS][3] \
  = {"TS1", "TS2", "TS3", "TS4", "TS5", "TS6"}
 
#define BGRP_NTSGROUPS (N_TIMESLOTS/2)    
 
#define TSGROUP_NAMELIST(labl) char labl[BGRP_NTSGROUPS][8] \
  = {"TS1&TS4 ", "TS2&TS5 ", "TS3&TS6 "}
 
 typedef enum
 {   bgrp_tsgroup_slc,       
     bgrp_tsgroup_cryo,      
     bgrp_tsgroup_nlcta      
 } bgrp_tsgroups_te;
 
#if defined(RGBM_INCLUDE_EXPRSTRUCTS) && defined(N_PCD)
 
 typedef struct                     
 {   unsigned long  type,
                    flags;
 } timex_micrreqmsg_ts;
 
 typedef struct                     
 {   unsigned long  status;
 } timex_micrfinmsg_ts;
 
 typedef struct                     
 {   unsigned long  type,
                    flags,
                    phys_blksiz_max;
     unsigned short tmat_micr_nrows,
                    tmat_micr_first_tpnt,
                    tmat_micr_pcdx[N_PCD];
#if N_PCD & 1
     unsigned short spareww;
#endif
     unsigned short exprs_n,
                    pptrans_n,
                    tmvas_n;
     unsigned char  crate_grps_n,
                    crate_to_grp[15],
                    subspp_n[PPTRANS_CRATE_GROUPS_MAX],
                    subspp_frst[PPTRANS_CRATE_GROUPS_MAX];
     unsigned short tmattnom_siz,
                    expr_siz,
                    bcod_siz,
                    tmva_siz,
                    dupcdpp_n,
                    vdunmi_maxn,
                    tmva_maxrefs,
                    notvsx_max,
                    sparewa[20];
     unsigned long  tmattnom_cksm,
                    exprbcod_cksm,
                    tmva_cksm,
                    own_cksm;
 } timex_dwnld_hdrmsg_ts;
                                    
 typedef struct                     
 {   unsigned short exprbc,
                    pcdtyp,
                    devx;
     unsigned char  beamcode,
                    crate_grp;
     unsigned short summands_n,
                    subspp_n;
     unsigned long  tnomtrefpdut,
                    sumval_pxu;
     unsigned short sumval_vdu;
     unsigned short summands_a[TVS_TOKIZED_LEN_MAX];
 } tmvsum_micx_beg_ts;
 typedef struct                     
 {   unsigned char  bitp,
                    shfc;
     unsigned short mask_after_shft;
 } modf_bitfield_def_ts;
 
 typedef struct                     
 {   unsigned short totbc;
     unsigned char  beamcode,
                    crate_grp;
     unsigned short modf_fields_n,
                    modf_bits_n,
                    subspp_min,
                    subspp_max;
     modf_bitfield_def_ts mfields[MODF_BITS_PBCOD_MAX];
 } rg_pptrans_head_ts;
                        
#endif
 
 
 
 
 
#if defined(RGBM_INCLUDE_BGRPSTRUCTS) && defined(RLIM_NAREAS)
 
#define RGBM_BGRP_BLOCK_MAXBC  32512  
#define RGBM_MGRP_BLOCK_MAXBC  12288  
 
#define MGRP_IFKEYS_NAMELIST(labl) char labl[MGRP_IFKEYS_N][MGRP_IFKEY_SIZE_MAX] \
                                      = {"SLD_WINDOW      ", "HERQ_EMPTY      ", \
                                         "LERQ_EMPTY      ", "BOTHQ_EMPTY     ", \
                                         "PEP2_ENAB       "}
 
#define MGRP_IFKEYS_NAMELIST_N(labl) char *labl[MGRP_IFKEYS_N]  \
                                = {"SLD_WINDOW", "HERQ_EMPTY",  \
                                   "LERQ_EMPTY", "BOTHQ_EMPTY", \
                                   "PEP2_ENAB"}
 
 typedef enum
 {   bgrp_iftest_sld_window,
     bgrp_iftest_nsld_window,
     bgrp_iftest_herq_empty,
     bgrp_iftest_nherq_empty,
     bgrp_iftest_lerq_empty,
     bgrp_iftest_nlerq_empty,
     bgrp_iftest_bothq_empty,
     bgrp_iftest_nbothq_empty,
     bgrp_iftest_pep2_enab,
     bgrp_iftest_npep2_enab,
     bgrp_iftest_rlimstate = 32,
     bgrp_iftest_nrlimstate,
     bgrp_iftest_pattern,
     bgrp_iftest_npattern,
     bgrp_iftest_timer,
     bgrp_iftest_ntimer,
     bgrp_iftest_nvarcmpeq,
     bgrp_iftest_nnvarcmpeq,
     bgrp_iftest_avarcmpeq,
     bgrp_iftest_navarcmpeq
 } bgrp_iftests_te;                
 
 typedef struct rg_bgrp_head_s
 {
#ifndef RMX_MICRO_COMPILE                     
     struct rg_bgrp_head_s *flink_p;
#else
     unsigned long          flink_p;
#endif
     char                   bgrp_name[BGRP_NAME_SIZE];
     unsigned long          version,
                            bgrp_totbc,
                            bgrp_unit,
                            checksum;
     unsigned char          tsgroup,
                            mgrps_n,
                            timers_n,
                            noklys_bcods_n,
                            rlarea_dflt,
                            rlarea_n,
                            rlarea_refs[RLIM_NAREAS],
                            noklys_bcods[BGRP_BCODS_MAX];
     unsigned short         patts_n,
                            srclines_n,
                            unused,
                            full_filename_bc;
     unsigned long          mgrps_boff,
                            patts_ap_boff,
                            srctxt_boff,
                            full_filename_boff,
                            time_fcrea[2],
                            time_transl[2];
 } rg_bgrp_head_ts;
 
 typedef struct
 {   char           mgrp_name[MGRP_NAME_SIZE];
     unsigned long  mgrp_totbc;
     unsigned char  gotos_n,
                    bcods_n,
                    sclps_n,
                    spareb,
                    rlarea_dflt,
                    flags;
     unsigned short patts_n;
     unsigned long  gotos_boff,
                    patts_ap_boff,
                    bcoda_boff,
                    sclpa_boff;
 } rg_mgrp_head_ts;
 
 typedef struct
 {   char           mgrp_name[MGRP_NAME_SIZE];
     unsigned short goto_totbc;
     unsigned char  tests_n,
                    timers_n;
     unsigned long  mgrp_boff;
 } rg_goto_head_ts;
 
 typedef struct
 {   unsigned char  timer_ix,
                    timer_flag;
     unsigned long  start_value;
 } rg_timer_start_ts;
 
 typedef struct
 {   unsigned char  test_type,
                    test_bc;
     union
     {   struct
         {   unsigned char rl_state,
                           rl_area_n,
                           rl_areas[RLIM_NAREAS-1];
         } rl;
         unsigned short patt_ix;
         unsigned char  timer_ix;
     } u;
 } rg_goto_test_ts;
 
 typedef struct
 {   unsigned char  beamcode,
                    rlarea;
     unsigned short flags,
                    patt_ix,
                    modfs_n;
     unsigned long  modfa_boff;
 } rg_beamcode_ts;
 
 typedef struct
 {   char           pnbn_name[BCODMODF_NAME_SIZE];
     unsigned char  pipe_delay,
                    cmpx;
     unsigned short flags,
                    patt_ix,
                    pnet_bitpos;
 } rg_modifier_ts;
 
#endif
 
#define RG_PATT_RESTARTABLE_FLG 0x8000  
 typedef struct
 {   unsigned short cown,
                    cown_max;
     long int       cowref[PATT_COWN_MEM_MAX];
 } rg_pattern_ts;
 
 typedef struct
 {   unsigned short cown,
                    cown_max;
     long int       cowref[PATT_COWN_ORAND_MAX];
 } rg_pattern_longts;
 
 typedef struct                     
 {   unsigned short hsta,
                    stat;
     unsigned long  stim[2],
                    mtim[2];
 } rg_bgrpinfo_one_ts;
 
 typedef struct                     
 {   unsigned char  gsflg,
                    tsgroup;
     unsigned short rlarea_refmask;
     unsigned long  ftim[2],
                    ttim[2];
 } rg_bgrp_gsinfo_ts;
 
 typedef struct                     
 {   char           name[TMVA_NAME_SIZE];
     unsigned short hsta;
     unsigned char  deactf,
                    valhstf;
     double         tval;
 } rg_tmva_one_ts;
 
 typedef struct                     
 {   unsigned long  tmvas_n,
                    tmvas_maxn;
     rg_tmva_one_ts tmvas_as[TMVAS_UMAX];
 } rg_tmvas_head_ts;
 
#define RGPARSE_FLGS_TMVAS   0x0001   
#define RGPARSE_FLGS_MICROS  0x0002   
#define RGPARSE_FLGS_BGRPS   0x0004   
#define RGPARSE_FLGS_ADDMICR 0x0010   
#define RGPARSE_FLGS_ADDDEVB 0x0020   
#define RGPARSE_FLGS_ADDDEVE 0x0040   
#define RGPARSE_FLGS_DWNLD   0x0080   
#define RGPARSE_FLGS_COMMNT  0x0100   
#define RGPARSE_FLGS_MACROX  0x0200   
 
#define RGBM_TYPES_HC
#endif
 
$
$ CREATE/LOG RGBM_VAX_TYPES.H
 
#ifndef RGBM_VAX_TYPES_H
 
#define DUPCDPP_NITEMS_MAX   1200   /* Max total # of DUPCD/PP pairs displayed. */
#define DUPCDPP_PMICR_MAX     300   /* Max # of DUPCD/PP pairs having           */
                                    /*  cond/tmvsum expressions per micro.      */
#define EXPRPAIRS_PDUPCDPP_MAX 18   /* Max # of cond/tmvsum expression pairs    */
                                    /*  per DUPCD/PP pair.                      */
#define RGBM_EXPRLEN_MAX      120   /* Max length of each expression, cond or   */
                                    /*  tmvsum, belonging to a DUPCD/PP pair.   */
#define RBSV_OUTREC_MAXMAX (RGBM_EXPRLEN_MAX+24)  /* Maximum possible maximum   */
                                                  /*  for RBSV formatted output */
                                                  /*  record bytecount.         */
 
 
                                    /* RGBM/BGRP call flags:                  */
#define RGBMFLG_DOWNLOAD_MICRO    1   /* Download all info to the micro when  */
                                      /*  storing into shared global section. */
#define RGBMFLG_ASSIGN_SUBSPPS    2   /* Reassign substitute PP's with each   */
                                      /*  statement pair entered.             */
#define RGBMFLG_FETCH_EXISTING    4   /* Fetch all existing info from shared  */
                                      /*  global section when opening micro.  */
#define RGBMFLG_KEEP_LOCK         8   /* Keep lock continuously until micro   */
                                      /*  closed.                             */
#define RGBMFLG_CANCEL         0x10   /* Cancel effect of previous open       */
                                      /*  without altering shared global      */
                                      /*  section or downloading micro.       */
#define RGBMFLG_NOOVRNEW       0x20   /* Dont overwrite existing information  */
                                      /*  stored more recently than fetched   */
                                      /*  store time of version on which new  */
                                      /*  version to be stored is based.      */
#define RGBMFLM_MODIFIED      0x100   /* Local info has been modified from    */
                                      /*  version in shared global section.   */
#define RGBMFLM_SUBSPP_DONE   0x200   /* Substitute PP assignment done.       */
#define RGBMFLM_TRASHED       0x400   /* Information worthless because of     */
                                      /*  error or overflow.                  */
#define RGBMFLM_LOCKED        0x800   /* Lock is currently held.              */
 
 
 
                                /* Structure of TIMEX request */
 typedef struct                 /*  message from SCP.         */
 {   char           reply_mbx_name[16];
     unsigned long  type,
                    flags,
                    micro;
 } timex_scpreqmsg_ts;
 
 
                                /* Structure of TIMEX reply */
 typedef struct                 /*  message to SCP.         */
 {   unsigned long  status,
                    unused[2];
 } timex_scprpymsg_ts;
 
 
 
                                /* Structure of a single DUPCD/PP pair */
                                /*  descriptor within a database-style */
                                /*  list filled by RGBM_list_expr,     */
                                /*  RGBM_list_tmva_refs, and           */
 typedef struct                 /*  RGBM_list_pnbn_refs.               */
 {   char           micro[4],
                    prim[4];
     unsigned short unit;
     unsigned char  beam,
                    expr_pairs_n;
 } rgbm_dupcdpp_item_ts;
 
 
 
                                /* Structure of a single item in the array */
 typedef struct                 /*  optionally returned by PNBN_get_all.   */
 {   unsigned short bitpos,
                    bitwdth;
     char           boundmicr[4];
     unsigned short boundunit,
                    blink, aux,
                    hsta;
 } pnbn_getall_item_ts;
 
 
#ifdef MAX_MODFR_MASK
                                /* Structure to hold substitute PP and one of */
 typedef struct                 /*  its back-translated modifier mask pairs.  */
 {   unsigned char  crate_grp,
                    base_pp,
                    subst_pp,
                    unusedb;
     unsigned long  modfr_mask[2][MAX_MODFR_MASK];
 } substpp_backtrans_ts;
#endif
 
 
                                /* Structure to hold substitute PP range     */
 typedef struct                 /*  as retrieved by RGBM_get_substpp_ranges. */
 {   unsigned short substpp_low,
                    substpp_high;
 } substpp_range_ts;
 
 
#ifdef MAX_CRATE                /* Structure to hold array translating crate  */
                                /*  address - 1 into crate group index.  Also */
                                /*  arrays giving counts by crate of          */
 typedef struct                 /*  rg_dupcdpp_head_ts's and of PIOP's.       */
 {   unsigned char  crate_grps_n,
                    crate_to_grp[MAX_CRATE];
     unsigned short crate_dupcdpps_n[MAX_CRATE],
                    crate_piops_n[MAX_CRATE];
 } crate_to_grp_trans_ts;
#endif
 
 
 
                    /* - - - - - - - - - - - - - - - - - - */
                    /* - - - - - - - - - - - - - - - - - - */
 
 
 
#ifdef RGBM_INCLUDE_EXPRSTRUCTS
 
                              /* DUPCD-expression-related define's to         */
                              /* be included only if needed:                  */
 
#define RGBM_MICRO_BLOCK_MAXBC 24576  /* Max size in bytes of block to hold   */
                                      /*  all RGBM info for one micro, not    */
                                      /*  including TMATRIX values.           */
#define CND_TOKIZED_LEN_MAX       50  /* Max length of tokenized string in    */
                                      /*  tokens.                             */
#define CND_TRANS_LEN_MAX         39  /* Max length of conditional expression */
                                      /*  translation in bytes.               */
#define CND_EVAL_TEMPSTK_LEN      20  /* Max stack depth for evaluating       */
                                      /*  conditional expression translation. */
 
 
 
                                    /* Substructure of beginning of        */
 typedef struct                     /* conditional expression translation. */
 {   unsigned char  toks_n,
                    toks_a[CND_TRANS_LEN_MAX];
 } condex_tran_beg_ts;
 
 
                                    /* Substructure of beginning of timing */
 typedef struct                     /* value sum expression translation.   */
 {   unsigned short summands_n,
                    subspp_n,
                    summands_a[TVS_TOKIZED_LEN_MAX];
 } tmvsum_tran_beg_ts;
                        /* Note in above structure:  a byte array (of length  */
                        /* subspp_n) of substitute PP's on which the timing   */
                        /* value sum expression translation is to be used     */
                        /* immediately follows the last element (as indicated */
                        /* by summands_n) of summands_a.  For corresponding   */
                        /* structure in micro, see tmvsum_micx_beg_ts in      */
                        /* RGBM_TYPES.HC.                                     */
 
 
 
                               /* Each of the following structures must be */
                               /* an integral # of longwords in length.    */
 
                                    /* Structure of header of info for one */
 typedef struct                     /* DUPCD/PP pair.                      */
 {   unsigned long  totbc,
                    tpnt;
     unsigned short beamcode,
                    crate;
     unsigned long  expr_pair_n;
     unsigned short cond_trn_boff[EXPRPAIRS_PDUPCDPP_MAX];
     union
     {   unsigned short tmvs_trndu_boff[EXPRPAIRS_PDUPCDPP_MAX],
                        tmvs_trnkf_boff[PPTRANS_CRATE_GROUPS_MAX][EXPRPAIRS_PDUPCDPP_MAX];
     } ub;
 } rg_dupcdpp_head_ts;
                      /* Note in above structure:  each cond_trn_boff points  */
                      /* to a conditional expression translation, a           */
                      /* conditional expression source string (prefixed with  */
                      /* bytecount), and a timing value sum expression source */
                      /* string (prefixed with bytecount), packed in that     */
                      /* order.  Each tmvs_trndu_boff or tmvs_trnkf_boff      */
                      /* points to a timing value sum expression translation. */
                      /* The cond_trn_boff and tmvs_trndu_boff arrays are     */
                      /* exactly parallel, though within any one              */
                      /* rg_dupcdpp_head_ts each distinct timing value sum    */
                      /* expression translation appears only once.  The       */
                      /* tmvs_trnkf_boff array is used only for KFTC's.  Any  */
                      /* KFTC/PP pair will have just one rg_dupcdpp_head_ts   */
                      /* in which the KFTC's fake timing value sum expression */
                      /* is replicated PPTRANS_CRATE_GROUPS_MAX times to      */
                      /* carry the possibly different substitute PP strings.  */
                      /* Each _boff is an offset (always 0 mod 4) in bytes    */
                      /* from the beginning of its rg_dupcdpp_head_ts.        */
                      /* Variable-length strings begin after full (not        */
                      /* truncated) length of tmvs_trndu_boff for non-KFTC's, */
                      /* and after full length of tmvs_trnkf_boff for KFTC's. */
                      /* Totbc (which includes the above-described strings)   */
                      /* must always be fullrounded up to 0 mod 4.            */
 
 
                                    /* Structure of header of entire dupcd    */
                                    /* expression info for one whole micro,   */
                                    /* as stored in Vax shared global section.*/
                                    /* These headers can be chained together  */
                                    /* using flink_p, though flink_p is       */
                                    /* ignored for blocks stored in the Vax   */
 typedef struct rg_micr_head_s      /* shared global section.                 */
 {   struct rg_micr_head_s *flink_p;
     char                   micr_name[4];
     unsigned long          micr_totbc,
                            micr_rgflags;
     unsigned short         micr_dupcdpp_n,
                            micr_pptrans_n;
     unsigned char          crate_grps_n,
                            crate_to_grp[15];
     unsigned short         crgrp_basepp_n[PPTRANS_CRATE_GROUPS_MAX],
                            crgrp_subspp_n[PPTRANS_CRATE_GROUPS_MAX],
                            crgrp_subspp_frst[PPTRANS_CRATE_GROUPS_MAX],
                            crgrp_piops_n[PPTRANS_CRATE_GROUPS_MAX];
     unsigned long          sparel[6],
                            dupcdpp_boff,
                            pptrans_boff,
                            timestamp[2],
                            checksum;
 } rg_micr_head_ts;
 
                     /* Notes in above structure:                             */
                     /*  micr_dupcdpp_n = # of rg_dupcdpp_head_ts's in chain  */
                     /*      rooted at dupcdpp_boff.  If 0, then this entire  */
                     /*      micro's block is empty.                          */
                     /*  micr_pptrans_n = # of rg_pptrans_head_ts's in chain  */
                     /*      rooted at pptrans_boff.  If 0, then substitute   */
                     /*      PP assignment has not been started.              */
                     /*  crate_grps_n = # of crate groups for which substitute*/
                     /*      PP assignment will be done.                      */
                     /*  crate_to_grp translates crate address - 1 to crate   */
                     /*      group index.                                     */
                     /*  crgrp_basepp_n = for each crate group, # of base     */
                     /*      beamcodes for which DUPCD's in this crate group  */
                     /*      have conditional expressions.                    */
                     /*  crgrp_subspp_n = for each crate group, # of          */
                     /*      substitute PP's used in that crate group for all */
                     /*      base beamcodes.                                  */
                     /*  crgrp_subspp_frst = for each crate group, lowest     */
                     /*      substitute PP used in that crate group.          */
                     /*  crgrp_piops_n = for each crate group, # of PIOP's in */
                     /*      that crate group.                                */
                     /*  dupcdpp_boff = offset in bytes from beginning of     */
                     /*      rg_micr_head_ts to first rg_dupcdpp_head_ts;     */
                     /*      all rg_dupcdpp_head_ts's are packed sequentially;*/
                     /*      to step from one rg_dupcdpp_head_ts to the next, */
                     /*      bump the (untyped) pointer to the current one by */
                     /*      its totbc.                                       */
                     /*  pptrans_boff = offset in bytes from beginning of     */
                     /*      rg_micr_head_ts to first rg_pptrans_head_ts;     */
                     /*      all rg_pptrans_head_ts's are packed sequentially */
                     /*      in order by crate group within base PP;  to step */
                     /*      from one rg_pptrans_head_ts to the next, bump    */
                     /*      the (untyped) pointer to the current one by its  */
                     /*      totbc.                                           */
                     /*  micr_totbc = size of entire micro's block in shared  */
                     /*      global section (must be 0 mod 4).                */
                     /* Note that the checksum must be aligned on a longword  */
                     /* boundary.                                             */
 
#endif
 
#define RGBM_VAX_TYPES_H
#endif
 
$
$ CREATE/LOG RGBM_UTILS_PROTO.H
 
#ifndef RGBM_UTILS_PROTO_H
 
 vmsstat_t RGBM_mutex_claim(void);
 
 vmsstat_t RGBM_mutex_relinq(void);
 
 vmsstat_t BGRP_mutex_claim(void);
 
 vmsstat_t BGRP_mutex_relinq(void);
 
#if defined(RGBM_VAX_TYPES_H) && defined(RGBM_INCLUDE_EXPRSTRUCTS)
 vmsstat_t RGBM_translate_tmvsum_expr(unsigned short sourc_strlen,
                                      const char *sourc_strp,
                                      unsigned long tpnt,
                                      tmvsum_tran_beg_ts *tmvsum_tran_p,
                                      unsigned long toks_nmax);
 
 vmsstat_t RGBM_translate_cond_expr(unsigned short sourc_strlen,
                                    const char *sourc_strp,
                                    condex_tran_beg_ts *condex_tran_p,
                                    unsigned long toks_nmax);
 
 unsigned long RGBM_cond_rPolish_eval(unsigned long v,
                                      const condex_tran_beg_ts *cndtran_p,
                                      const unsigned char modf_newbit[]);
 
 vmsstat_t RGBM_open_micro(rg_micr_head_ts **rg_micr_pp, unsigned long micro,
                           unsigned long flags_open);
 
 vmsstat_t RGBM_close_micro(rg_micr_head_ts **rg_micr_pp, unsigned long flags_close);
 
 vmsstat_t RGBM_put_expr(rg_micr_head_ts *rg_micr_p, unsigned long beamcode,
                         unsigned long primary, unsigned long unitnum,
                         unsigned long stmtnum,
                         const struct dsc$descriptor *condexpr_p,
                         const struct dsc$descriptor *timvexpr_p);
 
 vmsstat_t RGBM_delete_expr(rg_micr_head_ts *rg_micr_p, unsigned long beamcode,
                            unsigned long primary, unsigned long unitnum,
                            unsigned long stmtnum);
 
 vmsstat_t RGBM_list_exprs(unsigned short dupcdlist_p[2], unsigned short tmvanlist_p[2],
                           unsigned short modfrlist_p[2], const rg_micr_head_ts *rg_micr_p,
                           unsigned long micro, unsigned long beamcode,
                           unsigned long primary, unsigned long unitnum);
 
 vmsstat_t RGBM_list_tmva_refs(unsigned short dupcdlist_p[2],
                               const rg_micr_head_ts *rg_micr_p,
                               const char tmva_name_p[TMVA_NAME_SIZE]);
 
 vmsstat_t RGBM_list_pnbn_refs(unsigned short dupcdlist_p[2],
                               const rg_micr_head_ts *rg_micr_p,
                               const char pnbn_name_p[BCODMODF_NAME_SIZE]);
 
 vmsstat_t RGBM_get_expr_pair(const rg_micr_head_ts *rg_micr_p, unsigned long micro,
                              unsigned long beamcode, unsigned long primary,
                              unsigned long unitnum, unsigned long stmtnum,
                  struct dsc$descriptor *condexpr_p, unsigned short *condexpr_len_p,
                  struct dsc$descriptor *timvexpr_p, unsigned short *timvexpr_len_p,
                              unsigned char subst_pp_a[], unsigned short *crate_p);
 
#ifdef MAX_CRATE
 vmsstat_t RGBM_micr_get_substpps(const rg_micr_head_ts *rg_micr_p, unsigned long micro,
                                  unsigned long subspp_maxn, unsigned long *subspp_actn_p,
                                  substpp_backtrans_ts substpp_backtrans_p[],
                                  crate_to_grp_trans_ts *crate_to_grp_trans_p);
 
 vmsstat_t RGBM_get_substpp_ranges(const rg_micr_head_ts *rg_micr_p, unsigned long micro,
                                   unsigned long beamcode,
                                   substpp_range_ts pprange_a[PPTRANS_CRATE_GROUPS_MAX],
                                   crate_to_grp_trans_ts *crate_to_grp_trans_p);
#endif
#endif
 
 vmsstat_t RGBM_store_block_in_gsect(const void *rg_block_p, unsigned long rg_block_bc,
                                     unsigned long *rg_tocent_p, unsigned short *updtdf_p,
                                     const char err_labl[12]);
 
 vmsstat_t RGBM_download_micro(unsigned long flags, unsigned long micro);
 
#ifdef RGBM_TYPES_HC
                                   /* Bit definitions in arg tmva_deactf:     */
#define TMVA_PUT_DEACT_NO  0         /* TMVA not explicitly deactivated.      */
#define TMVA_PUT_DEACT_YES 1         /* TMVA explicitly deactivated.          */
                                   /* Bit definitions in arg tmva_microsendf: */
#define TMVA_PUT_MICROSEND_NO  0     /* Dont forward to micros.               */
#define TMVA_PUT_MICROSEND_YES 1     /* Do forward to micros.                 */
 
 vmsstat_t RGBM_tmva_get_nsec(const char tmva_name_p[TMVA_NAME_SIZE],
                              unsigned short *tmva_unit_p,
                              unsigned long *tmva_dbval_p, double *tmva_nsec_p,
                              unsigned short *tmva_deactf_p, unsigned short *tmva_hsta_p);
 
#ifdef MAX_MICR_MASK
 vmsstat_t RGBM_tmva_put_nsec(const char tmva_name_p[TMVA_NAME_SIZE],
                              unsigned short *tmva_unit_p, const unsigned long *tmva_dbval_p,
                              const double *tmva_nsec_p, unsigned tmva_deactf,
                              const unsigned short *tmva_hsta_p, unsigned short tmva_hsta_mask,
                              unsigned tmva_microsendf,
                              unsigned long tmva_micmask_p[MAX_MICR_MASK]);
 
#endif
 
 vmsstat_t RGBM_tmva_get_all(unsigned long tmva_maxn, unsigned long *tmva_actn_p,
                             char tmva_names_p[][TMVA_NAME_SIZE],
                             unsigned short tmva_units_p[], double tmva_nsecs_p[],
                             unsigned short tmva_deactfs_p[], unsigned short tmva_hstas_p[]);
 
 vmsstat_t RGBM_tmva_unit_to_name(unsigned short tmva_unit, char tmva_name_p[TMVA_NAME_SIZE]);
 
 vmsstat_t RGBM_KFTC_get_all(unsigned long max_kftcs, unsigned long *kftc_actn_p,
                             unsigned short kftc_units_p[],
                             char kftc_names_p[][KFTC_NAME_SIZE]);
 
 vmsstat_t RGBM_KFTC_name_to_unit(const char kftc_name_p[KFTC_NAME_SIZE],
                                  unsigned short *kftc_unit_p);
 
 vmsstat_t RGBM_KFTC_unit_to_name(unsigned long kftc_unit,
                                  char kftc_name_p[KFTC_NAME_SIZE]);
 
 vmsstat_t RGBM_KFTC_cr_to_PP_string(const char kftc_name_p[KFTC_NAME_SIZE],
                                     unsigned long micr, unsigned long crate,
                                     unsigned long beamcode,
                                     unsigned long ppstring_maxbc,
                                     unsigned char ppstring_p[]);
 
 vmsstat_t BGRP_pattern_normalize(rg_pattern_ts *patt_p, unsigned beghi);
 
 vmsstat_t BGRP_pattern_rotate(rg_pattern_ts *patt_p, long int rotc);
 
 unsigned int BGRP_test_patterns_disjoint(const rg_pattern_ts *patta_p,
                                          const rg_pattern_ts *pattb_p);
 
 vmsstat_t BGRP_pattern_orand(const rg_pattern_ts *pattx_p, const rg_pattern_ts *patty_p,
                              rg_pattern_ts *pattz_p, unsigned orand);
 
 vmsstat_t BGRP_pattern_to_tmsk_or(const rg_pattern_ts *patt_p, unsigned tsgroup,
                                   unsigned long tmsk_p[2]);
 
 vmsstat_t BGRP_lhlhs_to_pattern(const struct dsc$descriptor *line_descp,
                                 rg_pattern_ts *patt_p);
 
 vmsstat_t BGRP_pattern_to_lhlhs(const rg_pattern_ts *patt_p, unsigned optsf,
                                 struct dsc$descriptor *line_descp,
                                 unsigned short *actlen_p);
 
 void BGRP_pattern_to_stars(const rg_pattern_ts *pattx_p, const rg_pattern_ts *patty_p,
                            long int shfc, struct dsc$descriptor *line_descp);
 
#ifdef RGBM_VAX_TYPES_H
                                   /* Bit definitions in arg modfs_only:        */
#define MODF_NAME_GET_MODFONLY  1    /* Exclude non-modifier fields.            */
#define MODF_NAME_GET_DUPCDCOND 2    /* Exclude non-DUPCD-usable modifiers.     */
#define MODF_NAME_GET_BGRPSCHD  4    /* Exclude non-BGRP-schedulable modifiers. */
#define MODF_NAME_GET_PLICDMOD  8    /* Exclude non-PLIC-relevant modifiers.    */
#define MODF_NAME_GET_NOLOG  0x8000  /* Suppress err_send.                      */
 
 vmsstat_t RGBM_modf_name_to_bitpos(const char pnbn_name_p[BCODMODF_NAME_SIZE],
                                    unsigned long modfs_only, unsigned short *bitpos_p,
                                    pnbn_getall_item_ts *pnbn_items_p);
 
 vmsstat_t RGBM_modf_bitpos_to_name(unsigned short bitpos, unsigned long modfs_only,
                                    char pnbn_name_p[BCODMODF_NAME_SIZE],
                                    pnbn_getall_item_ts *pnbn_items_p);
 
 vmsstat_t RGBM_pnbn_get_all(unsigned long pnbn_maxn, unsigned long modfs_only,
                             unsigned long *pnbn_actn_p, char pnbn_names_p[][BCODMODF_NAME_SIZE],
                             pnbn_getall_item_ts pnbn_items_p[],
                             unsigned short ts_bitpos_p[N_TIMESLOTS]);
#endif
 
 vmsstat_t RGBM_translate_modf_names(unsigned long modf_name_n,
                                     const char modf_name_p[][BCODMODF_NAME_SIZE],
                                     unsigned long modf_mask_p[MAX_MODFR_MASK]);
 
#ifdef MPG_REQREPLY_STRUC_HC
#ifdef RLIM_NAREAS
 vmsstat_t BGRP_get_MPG_actlists(rg_listact_rlarea_ts rlareas_act_p[RLIM_NAREAS],
                         unsigned long *bgrps_actn_p,
                         rg_listact_bgrp_ts bgrps_act_p[BGRPS_ACTIVE_MAX],
                         unsigned long *beams_actn_p,
                         rg_listact_beam_ts beams_act_p[BGRPS_ACTIVE_MAX*BGRP_BCODS_MAX*2],
                         void *unused_p);
#endif
 
#ifdef MSGHEAD_HC
 vmsstat_t BGRP_get_MPG_ratehist_new(unsigned long cirbuf_maxbc,
                                     mpg_rltr_circ_replyh_ts *cirbuf_p);
#endif
#endif
#endif
 
#ifdef MAX_MODFR_MASK
 vmsstat_t BPM_adjust_excm(unsigned long exclusion_mask_p[MAX_MODFR_MASK]);
 
 vmsstat_t BPM_get_DGRP_excm_incm(unsigned long last_micro, unsigned long last_unit,
                                  const char dgrp_mnem_p[8],
                                  unsigned long exclusion_mask_p[MAX_MODFR_MASK],
                                  unsigned long inclusion_mask_p[MAX_MODFR_MASK],
                                  unsigned excm_noedit_flg);
#endif
 
#ifdef RGBM_TYPES_HC
 vmsstat_t RBSV_fmt_one_tmva(const char tmva_name_p[TMVA_NAME_SIZE], double tmva_nsec,
                             unsigned long tmva_deactf, unsigned long tmva_hsta,
                             unsigned long outrec_maxbc, void *wr_parm_p,
                             vmsstat_t outrec_write(struct dsc$descriptor *record_descp,
                                                    void *parm_p));
 
#if defined(RGBM_VAX_TYPES_H) && defined(RGBM_INCLUDE_EXPRSTRUCTS)
 vmsstat_t RBSV_fmt_one_dupcdpp(rgbm_dupcdpp_item_ts *item_p,
                                unsigned long outrec_maxbc, void *wr_parm_p,
                                vmsstat_t outrec_write(struct dsc$descriptor *record_descp,
                                                       void *parm_p),
                                rg_micr_head_ts *micr_local_p);
 
#if defined(RLIM_NTYPES) && defined(RGBM_INCLUDE_BGRPSTRUCTS)
 vmsstat_t RBSV_fmt_one_bgrp(const rg_bgrp_head_ts *bgrp_p, unsigned long outrec_maxbc,
                             void *wr_parm_p,
                             vmsstat_t outrec_write(struct dsc$descriptor *record_descp,
                                                    void *parm_p));
 
 vmsstat_t RGBM_rbsv(unsigned long inp_spec_bc, const char inp_spec_p[],
                     unsigned long outrec_maxbc, void *wr_parm_p,
                     vmsstat_t outrec_write(struct dsc$descriptor *record_descp,
                                            void *parm_p),
                     rg_micr_head_ts *micr_local_p, rg_bgrp_head_ts *bgrp_local_p);
 
 vmsstat_t RGBM_parse_source(const char filename_c[256], const char *memory_p, unsigned flags,
                             rg_tmvas_head_ts **rg_tmva_pp, rg_micr_head_ts **rg_micr_pp,
                             rg_bgrp_head_ts **rg_bgrp_pp);
#endif
#endif
 
 vmsstat_t BGRP_get_known_names(unsigned bgrps_maxn, unsigned long *bgrps_actn_p,
                                char bgrp_names_p[][BGRP_NAME_SIZE], unsigned short bgrp_units_p[],
                                rg_bgrp_gsinfo_ts bgrp_gsinfo_p[], unsigned short bgrp_hstas_p[],
                                unsigned short bgrp_stats_p[], unsigned long bgrp_stims_p[][2],
                                unsigned long bgrp_mtims_p[][2]);
 
 vmsstat_t BGRP_name_to_unit(const char bgrp_name_p[BGRP_NAME_SIZE], unsigned long *bgrp_unit_p,
                             rg_bgrpinfo_one_ts *bgrp_info_p);
 
 vmsstat_t BGRP_unit_to_name(unsigned long bgrp_unit, char bgrp_name_p[BGRP_NAME_SIZE],
                             unsigned short *bgrp_hsta_p);
 
 vmsstat_t BGRP_delete_public(const char bgrp_name_p[BGRP_NAME_SIZE]);
 
#if defined(RLIM_NTYPES) && defined(RGBM_INCLUDE_BGRPSTRUCTS)
 
 vmsstat_t BGRP_fetch_public(const char bgrp_name_p[BGRP_NAME_SIZE],
                             rg_bgrp_head_ts **rg_bgrp_pp);
 
 vmsstat_t BGRP_store_public(rg_bgrp_head_ts *rg_bgrp_p, unsigned flags_store);
 
 vmsstat_t BGRP_activate(const char bgrp_name_p[BGRP_NAME_SIZE], rg_bgrp_head_ts **rg_bgrp_pp);
 
 vmsstat_t BGRP_deactivate(const char bgrp_name_p[BGRP_NAME_SIZE]);
 
 vmsstat_t BGRP_fetch_from_MPG(const char bgrp_name_p[BGRP_NAME_SIZE],
                               rg_bgrp_head_ts **rg_bgrp_pp);
 
 vmsstat_t BGRPF_find_MGRP(const rg_bgrp_head_ts *rg_bgrp_p,
                           const char mgrp_name_p[MGRP_NAME_SIZE],
                           rg_mgrp_head_ts **rg_mgrp_pp);
 
 vmsstat_t BGRPF_find_beam(const rg_bgrp_head_ts *rg_bgrp_p,
                           const char mgrp_name_p[MGRP_NAME_SIZE], unsigned long beam,
                           rg_mgrp_head_ts **rg_mgrp_pp, rg_beamcode_ts **rg_beamcode_pp);
 
 vmsstat_t BGRPF_find_bcodmodf(const rg_bgrp_head_ts *rg_bgrp_p,
                               const char mgrp_name_p[MGRP_NAME_SIZE], unsigned long beam,
                               const char modf_name_p[BCODMODF_NAME_SIZE],
                               rg_mgrp_head_ts **rg_mgrp_pp, rg_beamcode_ts **rg_beamcode_pp,
                               rg_modifier_ts **rg_modifier_pp);
#endif
#endif
 
 vmsstat_t BGRP_reactivate_all(void);
 
 vmsstat_t RGBM_restore_slct(const char filename_c[256], const char *memory_p,
                             unsigned flags, unsigned short *tmva_namelist_p,
                             unsigned short *micro_namelist_p,
                             unsigned short *bgrp_namelist_p);
 
 vmsstat_t RGRSTR_cliget(unsigned long infilnam_maxbc, char infilnam_c[],
                         unsigned long *flags_p);
 
#ifdef BGRP_NAME_SIZE
 vmsstat_t BGRP_stars_given_bgrp_mgrp_bcod(const char bgrp_name_p[BGRP_NAME_SIZE],
                                           const char mgrp_name_p[MGRP_NAME_SIZE],
                                           unsigned short beamcode,
                                           struct dsc$descriptor *stars_descp);
 
 vmsstat_t BGRP_stars_given_bgrp_mgrp_pnbn(const char bgrp_name_p[BGRP_NAME_SIZE],
                                           const char mgrp_name_p[MGRP_NAME_SIZE],
                                           const char modf_name_p[BCODMODF_NAME_SIZE],
                                           unsigned short beamcode,
                                           struct dsc$descriptor *stars_descp);
#ifdef MPS_TYPES_DEF
 vmsstat_t BGRP_rlareas_given_bcod(const char bgrp_name_p[BGRP_NAME_SIZE], unsigned short beamcode,
                                   mps_beampath_name_ta rlarea_names_pa[],
                                   unsigned long *rlareas_actn_p);
#endif
#endif
 
#ifdef CHK_PDUPTTP_MAXENTS
 vmsstat_t PDU_diag_short_read(unsigned long micr, unsigned long crate, unsigned long chan,
                               unsigned only_flag, chk_pduppchans_replyh_ts **pprplyh_pp);
#endif
 
 vmsstat_t MPG_bcst_nonbpm_YY(const unsigned char *yy_p, const unsigned char *pp_p,
                              void *unused_p);
 
#define RGBM_UTILS_PROTO_H
#endif
 
$
$ CREATE/LOG CNF_PARAM.H

#ifndef CNF_PARAM_H
#define CNF_PARAM_H

#define CONFIG_FIRST          0x00000001        /* No data present yet;      */
                                                /* operation starting.       */
#define CONFIG_DATA           0x00000002        /* data is present in rest   */
                                                /* of structure.             */
#define CONFIG_ERR            0x00000004        /* Config operation failing. */
                                                /* No data present.          */
#define CONFIG_LAST           0x00000008        /* No data present anymore;  */
                                                /* operation ending.         */
#define CONFIG_STAGE_MASK     0x000000FF        /* mask of all possible stage*/
                                                /* bits.                     */

#define CONFIG_SAVE           0x00000100        /* config is saving          */
#define CONFIG_LOAD           0x00000200        /* config is loading         */
#define CONFIG_ACTIVATE       0x00000400        /* config is activating      */
#define CONFIG_OPERATION_MASK 0x0000FF00        /* mask of all possible ops  */



/*
** Type of structures that may be used with User-Routines
**
** These values are used with the 'structure' field in the structure
** cnf_struc. 
**
*/

#define UNKNOWN_STRUC  0
#define DATABASE_STRUC 1
#define LINE_STRUC     2
#define BPMS_STRUC     3
#define TORO_STRUC     4
#define TIMING_STRUC   6
#define CNF_COMMENT    7
#define ANALOG_STRUC   8


/*
**=============================================================================
**
** Lengths of some common strings.
*/

#define CNF_BUFFER_SIZE  80                     /* for line_struc            */

#define CNF_NAME_SIZE    12                     /* name of a region          */

#define CNF_DIRECT_SIZE   8                     /* name of a directory       */
                                                /* ("SCRATCH " or "NORMAL  " */

#define CNF_TYPE_SIZE     4                     /* type of save or load      */
                                                /* ("CON ", "DES " or "ACT ")*/

#define CNF_CLASS_SIZE    4                     /* type of config region     */
                                                /* ("    ", "BPM " or "CA  ")*/

#define CNF_FMT_SIZE      5                     /* string of form nnnFF,     */
                                                /* where nnn is a number and */
                                                /* FF a format like R4       */

#define CNF_TITLE_SIZE   60                     /* title for a save          */

#define CNF_INDEX_TITLE_SIZE   60               /* title for a save          */
                                                /* as it appears in a        */
                                                /* regional index.           */

#define CNF_IDENT_SIZE   12                     /* misc field in save file   */

#define CNF_CHANNEL_SIZE  8                     /* analog channel            */

#define CNF_BEAM_CODE_SIZE 4                    /* ascii beam code size      */

#define CNF_TMVA_NAME_SIZE 12                   /* name of a tmva            */
                                                /* (timing variable)         */

#define CNF_BGRP_NAME_SIZE 12                   /* name of a bgrp            */
                                                /* (beamcode scheduling grp) */

#define CNF_DGRP_SIZE 8                         /* name of a dgrp            */

#define CNF_SUBSYSTEM_SIZE 8                    /* name of an asts           */
                                                /* subsystem                 */


#define CNF_RGBM_BUFFER_SIZE 65535                 
                                                /* size of output buffer     */
                                                /* for calls to ref_utilshr: */
                                                /* RGBM_Rbsv()               */
                                                /* WARNING: This constant    */
                                                /* determines the length of  */
                                                /* fortran character         */
                                                /* and cannot be increased   */
                                                /* any more without          */
                                                /* significant software      */
                                                /* changes (because 65535 is */
                                                /* the maximum desc length). */ 

#define CNF_RGBM_MAX_RECORD_SIZE 65             /* maximum separation        */
                                                /* between newline ('\n')    */
                                                /* characters returned       */
                                                /* from RGBM_rbsv.           */
                                                /*                           */
                                                /* This needs to be          */
                                                /* small enough to fit       */
                                                /* on the narrowest display  */
                                                /* device, AND to fit into   */
                                                /* cnf_file_cont_struc.text  */
                                                /* (see cnf_file_struc.h)    */

/*
**=============================================================================
**
** Values some common strings can have:          
*/


/*
** These are the two directories that hold configs.  CNF_DIRECT_INSTANT
** is used when the config is not saved in a file.
*/
#define CNF_DIRECT_SCRATCH  "SCRATCH "
#define CNF_DIRECT_NORMAL   "NORMAL  "
#define CNF_DIRECT_OBSOLETE "OBSOLETE"
#define CNF_DIRECT_INSTANT  "INSTANT "

/*
** These strings specify the target for LOADs and the
** source of data for SAVEs.  They are of type cau_type_ta or cau_type_tc
*/
#define CNF_TYPE_CON        "CON "
#define CNF_TYPE_DES        "DES "
#define CNF_TYPE_ACT        "ACT "

/* 
** These integers can also represent con,des,and act.  They are of
** type cnf_type_t (see end of this file).
*/
#define CNF_I_TYPE_CON 0                        /* index of CNF_TYPE_CON     */
#define CNF_I_TYPE_DES 1                        /* index of CNF_TYPE_DES     */
#define CNF_I_TYPE_ACT 2                        /* index of CNF_TYPE_ACT     */
#define CNF_C_TYPE     3                        /* number of cnf types.      */

/*
** These strings are used as args to CNF_MASTER_OPEN and CNF_INDEX_OPEN;
** they specify how the file should be opened.
*/
#define CNF_FILE_READ       "READ"
#define CNF_FILE_WRIT       "WRIT"

/*
**=============================================================================
**
*/

/*
**  Special values for config save file numbers when calling some
**  config functions:
*/
#define CNF_SAVE_NEXT_AVAIL (-1L)               /* save config w/ next avail */
                                                /* number.                   */
#define CNF_LOAD_LAST_SAVED (-1L)               /* load last config saved.   */


/*
**=============================================================================
**
** Maximum number of config regions allowed.
*/

#define CNF_MAX_UNIT     1000

/* 
** Parameters for classes
*/

#define CNF_NUM_CLASSES 3
#define CNF_CLASS_NONE  '    '
#define CNF_CLASS_BPM   'BPM '
#define CNF_CLASS_CA    'CA  '

/*
** Common things that appear in config save and template files.
*/

#define CNF_CONT_HEADER     " >"
#define CNF_SOFTWARE_HEADER " %"
#define CNF_COMMENT_HEADER  " !"
#define CNF_NORMAL_HEADER   "  "

#define CNF_NO_LOAD_OR_ACTIVATE "*"

#define CNF_CONTINUED_CHAR     "-"
#define CNF_NOT_CONTINUED_CHAR " "

#define CNF_FILENAME_TEMPLATE_SUFFIX  "TEMP"
#define CNF_FILENAME_EXTENSION        ".CNF"
#define CNF_FILENAME_EXTENSION_OLD    ".OLDCNF"

/*
** Things for saving configs
*/
#define CNF_HEADER_BEAM_TEXT       "  BEAM NO.="
#define CNF_HEADER_BEAM_TEXT_INVALID  " BEAM NO. IS NOT VALID"

#define CNF_HEADER_BEAM_CODE_START 22
#define CNF_HEADER_BEAM_CODE_END   25

#define CNF_HEADER_DIRECT_TEXT     "DIRECTORY="         
#define CNF_HEADER_TITLE_TEXT      "TITLE="          
#define CNF_HEADER_END_TEXT        "     END OF SAVE DATA"

/* 
** Format types for saving configs. 
*/

#define CNF_FMT_R4    1
#define CNF_FMT_I2    2
#define CNF_FMT_I4    3
#define CNF_FMT_Z2    4
#define CNF_FMT_Z4    5
#define CNF_FMT_A4    6
#define CNF_FMT_B0    7

#define CNF_FMT_MAX   7

/*
** Field widths for continuation lines:
*/

#define CNF_WIDTH_R4  16
#define CNF_WIDTH_I2  6
#define CNF_WIDTH_I4  10
#define CNF_WIDTH_Z2  4
#define CNF_WIDTH_Z4  8
#define CNF_WIDTH_A4  8
#define CNF_WIDTH_B0  70

/*
** Array of field widths for each format.
** Note that this is just like the FORTRAN array,
** so to get the width for a format you must subtract 1 from the
** format first before indexing into the array.
*/

#define CNF_WIDTHS cnf_widths[CNF_FMT_MAX] = \
                   {                         \
                        CNF_WIDTH_R4         \
                      , CNF_WIDTH_I2         \
                      , CNF_WIDTH_I4         \
                      , CNF_WIDTH_Z2         \
                      , CNF_WIDTH_Z4         \
                      , CNF_WIDTH_A4         \
                      , CNF_WIDTH_B0         \
                   }
                       
/* 
** Items per continuation line for each format.
*/

#define CNF_NUM_R4 3
#define CNF_NUM_I2 7
#define CNF_NUM_I4 5
#define CNF_NUM_Z2 11
#define CNF_NUM_Z4 6
#define CNF_NUM_A4 6
#define CNF_NUM_B0 1 

/*
** Array of number of continuation lines for each format.
** Note that this is just like the FORTRAN array,
** so to get the number for a format you must subtract 1 from the
** format first before indexing into the array.
*/

#define CNF_NUM_PER_L cnf_num_per_l[CNF_FMT_MAX] = \
                   {                       \
                        CNF_NUM_R4         \
                      , CNF_NUM_I2         \
                      , CNF_NUM_I4         \
                      , CNF_NUM_Z2         \
                      , CNF_NUM_Z4         \
                      , CNF_NUM_A4         \
                      , CNF_NUM_B0         \
                   }

/*
** Start of data position in the save file:
** (Note that this is also determined by a structure elsewhere.)
*/

#define CNF_DATA_START 25

/*
** Unit number to use for configs when there really isn't any:
*/

#define CNF_PSEUDO_UNIT 1

/*
** Special values that PAGE can take on 
*/

#define CNF_REG_IND_POIN_PG  -1                 /* display the page the      */
                                                /* pointer is on.            */
#define CNF_REG_IND_LAST_PG  -2                 /* display the last page.    */ 

/*
** Fractional tolerance to produce a red output for timing displays:
*/

#define CNF_TIME_TOL 0.0000001

/*
** These are tags that identify different types of headers use
** by the config software for DISPLINE_HEADER.  The display software
** can check the header type value to determine if the last header output
** is still correct.  See type cnf_hdr_type_ta below.
*/
        
#define CNF_HDR_TIME "TIME"                     /* TIMING_STRUC items,       */
                                                /* except conditional-       */
                                                /* expression-pair lists,    */
                                                /* beamcode scheduling       */
                                                /* groups, and TMVAs.        */
#define CNF_HDR_EXPR "EXPR"                     /* TIMING_STRUC items that   */
                                                /* are cond-expr-pair lists  */
#define CNF_HDR_BGRP "BGRP"                     /* TIMING_STRUC items that   */
                                                /* beamcode-sched-groups     */
#define CNF_HDR_TMVA "TMVA"                     /* TIMING_STRUC items that   */
                                                /* are TMVAs                 */

#define CNF_HDR_ASTS "ASTS"                     /* ANALOG_STRUC items        */
#define CNF_HDR_DB   "DB  "                     /* DATABASE_STRUC items      */

/*
** These are the colors for displine, then some colors used for common
** situations. 
*/ 

#define CNF_CLR_RED       "RED     "
#define CNF_CLR_GREEN     "GREEN   "
#define CNF_CLR_BLUE      "BLUE    "
#define CNF_CLR_YELLOW    "YELLOW  "
#define CNF_CLR_MAGENTA   "MAGENTA "
#define CNF_CLR_CYAN      "CYAN    "
#define CNF_CLR_WHITE     "WHITE   "

#define CNF_CLR_MATCH     CNF_CLR_GREEN         /* when items match          */
#define CNF_CLR_MISMATCH  CNF_CLR_RED           /* when items do not match   */
#define CNF_CLR_ALMOST    CNF_CLR_YELLOW        /* when items almost match   */
#define CNF_CLR_DSP       CNF_CLR_WHITE         /* general text color.       */
#define CNF_CLR_NO_LOAD_OR_ACTIVATE                                            \
                          CNF_CLR_CYAN          /* general text color when   */
                                                /* item is no-load/activate  */

/*
**============================================================================
**
** Based on the information in this file, some common typedefs
** can be created.  Note that this section does not exist in the
** FORTRAN version of this file, since FORTRAN does not have typedefs.
*/

typedef int4u cnf_lun_t;                        /* a FORTRAN logical unit    */
                                                /* number.                   */
typedef int4  cnf_index_num_t;                  /* The number in a regional  */
                                                /* index of a saved file.    */

typedef char cnf_name4_ta  [4];                 /* for prim, micr, unit,     */
                                                /* etc. in cnf structs       */
typedef char cnf_name6_ta  [6];                 /* for unit, sometimes.      */
typedef char cnf_buffer_ta [CNF_BUFFER_SIZE];   /* for line struc            */
typedef char cnf_buffer_tc [CNF_BUFFER_SIZE+1]; /* for line struc            */

typedef char cnf_name_ta   [CNF_NAME_SIZE];     /* name of a region          */
typedef char cnf_direct_ta [CNF_DIRECT_SIZE];   /* scratch or normal         */

typedef char cnf_type_ta   [CNF_TYPE_SIZE];     /* type for save or load     */
typedef char cnf_type_tc   [CNF_TYPE_SIZE+1];   /* type for save or load     */
typedef int4 cnf_type_t ;                       /* an integer form of the    */
                                                /* type for a save or a load;*/
                                                /* one of CNF_I_TYPE_*.      */

typedef char cnf_fmt_ta    [CNF_FMT_SIZE];      /* string or form nnnFF      */
typedef char cnf_title_ta  [CNF_TITLE_SIZE];    /* title for a save          */
typedef char cnf_index_title_ta  [CNF_INDEX_TITLE_SIZE];    
                                                /* title for a save          */
                                                /* as it appears in an index */
typedef char cnf_ident_ta  [CNF_IDENT_SIZE];    /* misc field in save file   */
typedef char cnf_channel_ta[CNF_CHANNEL_SIZE];  /* analog channel            */
typedef char cnf_beam_code_ta   [CNF_BEAM_CODE_SIZE];
                                                /* ascii beam code           */
typedef char cnf_tmva_name_ta   [CNF_TMVA_NAME_SIZE];
                                                /* tmva name                 */
                                                /* (timing variable)         */
typedef char cnf_bgrp_name_ta   [CNF_BGRP_NAME_SIZE];
                                                /* bgrp name                 */
                                                /* (beamcode scheduling grp) */
typedef char cnf_dgrp_ta        [CNF_DGRP_SIZE];
                                                /* dgrp name                 */
typedef char cnf_subsystem_ta   [CNF_SUBSYSTEM_SIZE];
                                                /* asts subsystem            */
typedef char cnf_hdr_type_ta    [4];            /* Type of header last output*/

typedef char cnf_rgbm_buffer_tc [CNF_RGBM_BUFFER_SIZE];
                                                /* buffer for calls to       */
                                                /* RGBM_Rbsv().              */

/*
**==============================================================================
**
** Macros:
*/

/* Declare an array of cnf_type_tc's, indexed by a cnf_type_t. */
#define CNF_TYPE_ARRAY_DECLARE( name )                                         \
   cnf_type_tc const                            name[CNF_C_TYPE] =             \
      { { CNF_TYPE_CON } , { CNF_TYPE_DES } , { CNF_TYPE_ACT } }  

#endif 
/* End file cnf_param.h ----------------------------------------------------*/
                                
$
$ CREATE/LOG LINE_STRUC.H

#ifndef LINE_STRUC_H
#define LINE_STRUC_H

struct line_struc 
{
    char line [80];

    vmsstat_t status; /* completion status of operation that filled
                         this structure. */

    long int spares[31];   /* spares for future use. */
} ;
#endif

/* End file line_struc.h------------------------------------------------*/
$
$ CREATE/LOG ANALOG_STRUC.H

#ifndef ANALOG_STRUC_H
#define ANALOG_STRUC_H

struct analog_struc 
{  
   variant_union 
   {
      variant_struct 
      {
         long int primary;
         long int micro;
         long int unit;
         long int secondary;
      } analog_struc0000;

      variant_struct 
      {
         char primary_c [4];
         char micro_c [4];
         char unit_c [4];
         char secondary_c [4];
      } analog_struc0001;
   } analog_struc0002;

   short int fmt_type;
   short int no_values;
   float value;

/* Note we pad here to make this structure consistent with                    */
/* database_struc and timing_struc                                            */

    char fill_1 [127 * 4];

    variant_union 
    {
       variant_struct 
       {
          double channel;
       } analog_struc0003;

       variant_struct 
       {
          char channel_c [8];
       } analog_struc0004;

       variant_struct 
       {
          double subsys;
       } analog_struc0005;

       variant_struct 
       {
          char subsys_c [8];
       } analog_struc0006;

    } analog_struc0007;

    variant_union 
    {
       variant_struct 
       {
          double dgrp;
       } analog_struc0008;

       variant_struct 
       {
          char dgrp_c [8];
       } analog_struc0009;
    } analog_struc0010;

    char fill_2[12];  /* used by tmva_name_c, bgrp_name_c in timing_struc.h */

    vmsstat_t status; /* completion status of operation that filled
                         this structure. */

    char no_load_or_activate_c[1] ;  /* If equal to CNF_NO_LOAD_OR_ACTIVATE,
                                        do not load or activate this item; it 
                                        should only be saved and displayed. */
    char fill_3[3] ; /* spares. */

    long int spares[30];   /* spares for future use. */

} ;
#endif

/* End file analog_struc.h------------------------------------------------*/
$
$ CREATE/LOG DATABASE_STRUC.H

#ifndef DATABASE_STRUC_H
#define DATABASE_STRUC_H
 
#define MAX_WORDS_PER_SECN 255   /* Database limit on words per secondary. */

struct database_struc 
{
   variant_union 
   {
      variant_struct 
      {
         long int primary;
         long int micro;
         long int unit;
         long int secondary;
      } database_struc0000;

      variant_struct 
      {
         char primary_c [4];
         char micro_c [4];
         char unit_c [4];
         char secondary_c [4];
      } database_struc0001;
   } database_struc0002;

   short int fmt_type;                          /* Format type of data       */
   short int no_values;                         /* Number of values          */
                                                /* in the value array.       */
   variant_union 
   {
      variant_struct 
      {
         float value [MAX_WORDS_PER_SECN/2];
      } database_struc0003;

      variant_struct 
      {
         long int i4_value [MAX_WORDS_PER_SECN/2];
      } database_struc0004;

      variant_struct 
      {
         short int i2_value [MAX_WORDS_PER_SECN];
      } database_struc0005;

      variant_struct 
      {
         long int z4_value [MAX_WORDS_PER_SECN/2];
      } database_struc0006;

      variant_struct 
      {
         short int z2_value [MAX_WORDS_PER_SECN];
      } database_struc0007;

      variant_struct 
      {
         long int a4_value [MAX_WORDS_PER_SECN/2];
      } database_struc0008;

      variant_struct 
      {
         char a4_value_char [MAX_WORDS_PER_SECN/2] [4];
      } database_struc0009;

      variant_struct 
      {
         char string_value [MAX_WORDS_PER_SECN*2];
      } database_struc0010;

   } database_struc0011;

/* Pad to make equal to structure in timing_struc.h (one additional word,
   for a total of 256 words or 128 longwords of data. */

   char fill_1 [2];

   variant_union 
   {
      variant_struct 
      {
         double ident;
      } database_struc0012;

      variant_struct 
      {
         char ident_c [8];
      } database_struc0013;

      variant_struct 
      {
         long int i_first_elem ;                /* the first value in the    */
                                                /* VALUE array has this      */
                                                /* index in the database     */
                                                /* for this prim-micr-unit-  */
                                                /* secn. (1-based).          */

         long int max_elem;                     /* Maximum number of values  */
                                                /* permitted by template     */
                                                /* for no_values; if zero,   */
                                                /* no maximum.               */
      } database_struc0015;

   } database_struc0016;

   variant_union 
   {
      variant_struct 
      {
         double dgrp;
      } database_struc0017;

      variant_struct 
      {
         char dgrp_c [8];
      } database_struc0018;
   } database_struc0019;

   char fill_2[12];  /* used by tmva_name_c, bgrp_name_c in timing_struc.h */
    
   vmsstat_t status; /* completion status of operation that filled
                        this structure. */

   char no_load_or_activate_c[1] ;  /* If equal to CNF_NO_LOAD_OR_ACTIVATE,
                                       do not load or activate this item; it 
                                       should only be saved and displayed. */
   char fill_3[3] ; /* spares. */

   long int spares[30];   /* spares for future use. */

};
#endif

/* End file database_struc.h------------------------------------------------*/
$
$ CREATE/LOG TIMING_STRUC.H

#ifndef TIMING_STRUC_H
#define TIMING_STRUC_H

struct timing_struc 
{
   variant_union 
   {
      variant_struct 
      {
         long int primary;
         long int micro;
         long int unit;
         long int secondary;
      } timing_struc0000;

      variant_struct 
      {
         char primary_c [4];
         char micro_c [4];
         char unit_c [4];
         char secondary_c [4];
      } timing_struc0001;
   } timing_struc0002;

   short int fmt_type;   
   short int no_values;

   float value;          /* delay in nsec */
   char  dummy [4];      /* reserved for future use. */

   void * rgbm_ptr;      /* pointer to allocated memory,         
                            containing additional data for
                            for rgbm_restore(). Can be NULL. */

   long int rgbm_bytes;  /* bytes allocated in allocated memory. */ 

   char fill0[4*124];    /* pad to be equal to structures in
                            database_struc.h, etc. */

   variant_union 
   {
      variant_struct 
      {
         /* space out to take up as much room as 'channel' field in 
            database_struc.h */
         char fill1 [4];

         long int beam_code;
      } timing_struc0003;

   } timing_struc0004;

   variant_union 
   {
      variant_struct 
      {
         double dgrp;
      } timing_struc0005;

      variant_struct 
      {
         char dgrp_c [8];
      } timing_struc0006;
   } timing_struc0007;

   variant_union
   {
      char tmva_name_c[12];
      char bgrp_name_c[12];
   } timing_struc0008;

   vmsstat_t status; /* completion status of operation that filled
                        this structure. */

   char no_load_or_activate_c[1] ;  /* If equal to CNF_NO_LOAD_OR_ACTIVATE,
                                       do not load or activate this item; it 
                                       should only be saved and displayed. */
   char fill_3[3] ; /* spares. */

   long int spares[30];   /* spares for future use. */

};

#endif

/* End file timing_struc.h------------------------------------------------*/
$
$ CREATE/LOG CNF_STRUC.H

#ifndef CNF_STRUC_H
#define CNF_STRUC_H

struct cnf_struc 
{
   long int operation;     /* Type of operation (Load, Save, etc.) */
   long int structure;     /* Type of structure to use for access. */

   variant_union 
   {
      variant_struct 
      {
          struct line_struc line_rec;
      } cnf_struc0000;
        
      variant_struct 
      {
          struct database_struc database_rec;
      } cnf_struc0001;
        
      variant_struct 
      {
          struct analog_struc analog_rec;
      } cnf_struc0002;
        
      variant_struct 
      {
          struct timing_struc timing_rec;
      } cnf_struc0003;

   } cnf_struc0004;

};

#endif 

/* End file cnf_struc.h ----------------------------------------------------*/
$
$ CREATE/LOG CNF_PROTO.H
vmsstat_t cnf_bld_index( 
             fstring_ts const * const                   direct_ps,
                                                /* Input arg. SCRATCH or     */
                                                /* NORMAL.                   */
             fstring_ts const * const                   name_ps,
                                                /* Input arg. Region name.   */
             fstring_ts * const                         filespec_ps );
                                                /* Output arg. Filespec for  */
                                                /* index.                    */

/*
** Get RMS information about a config regional index file.
*/
#ifdef CNF_INFO_INDEX_TYPES_H
vmsstat_t  cnf_info_index( 
             cnf_direct_ta const                        direct_a,
                                                /* Input arg. SCRATCH or     */
                                                /* NORMAL.                   */
             cnf_name_ta const                          name_a,
                                                /* Input arg. Region name.   */
             cnf_info_index_ts * const                  index_info_ps );
                                                /* Output arg. RMS info about*/
                                                /* index file.               */
#endif /* CNF_INFO_INDEX_TYPES_H defined. */

/*
** Perform a VMS CONVERT on a config regional index file
** (if required to reduce the number of index levels.
*/
vmsstat_t  cnf_convert_index( 
             cnf_direct_ta const                        direct_a,
                                                /* Input arg. SCRATCH or     */
                                                /* NORMAL.                   */
             cnf_name_ta const                          name_a);
                                                /* Input arg. Region name.   */


/*
** Open a regional index file.
*/
vmsstat_t cnf_open_index(
             cnf_lun_t const * const                    lun_p,
                                                /* Input arg. Logical unit   */
                                                /* number obtained with      */
                                                /* lib$get_lun.              */
             fstring_ts const * const                   direct_ps,
                                                /* Input arg. SCRATCH or     */
                                                /* NORMAL.                   */
             fstring_ts const * const                   name_ps,
                                                /* Input arg. Region name.   */
             fstring_ts const * const                   file_op_ps);
                                                /* Input arg. Descriptor     */
                                                /* pointing to CNF_FILE_READ */
                                                /* or CNF_FILE_WRIT.         */
                                                /* Type of access required.  */

/*
** Read a regional index file.
*/
#ifdef CONFIG_FILE_STRUC_H   
vmsstat_t cnf_read_index(
             cnf_lun_t const * const                    lun_p,
                                                /* Input arg. Logical unit   */
                                                /* number obtained with      */
                                                /* lib$get_lun.              */
             cnf_index_num_t const * const              num_p,
                                                /* Input arg. Number of      */
                                                /* config to attempt to get. */
             struct indx_data_s * const                 indx_data_ps,
                                                /* Output arg. Index         */
                                                /* record obtained.          */
             int4 const * const                         key_p);
                                                /* Optional Input arg.       */
                                                /* If NULL, match *num_p     */
                                                /* exactly, unless *num_p    */
                                                /* is negative, then         */
                                                /* find the first num >=     */
                                                /* abs(num_p).               */
                                                /* Otherwise:                */
                                                /*  if *key_p==-1,           */
                                                /*    find first num <=*num_p*/
                                                /*  if *key_p==0,            */
                                                /*    find       num ==*num_p*/
                                                /*  if *key_p==+1,           */
                                                /*    find first num >=*num_p*/
#endif /* CONFIG_FILE_STRUC_H defined. */

/*
** Close a regional index file.
*/ 
vmsstat_t cnf_close_index(
             cnf_lun_t const * const                    lun_p);
                                                /* Input arg. Logical unit   */
                                                /* number obtained with      */
                                                /* lib$get_lun.              */


/*
** Open the master index file.  
*/
vmsstat_t cnf_open_master(  
             cnf_lun_t const * const                    lun_p,
                                                /* Input arg. Logical unit   */
                                                /* number obtained with      */
                                                /* lib$get_lun.              */
             fstring_ts const * const                   file_op_ps);
                                                /* Input arg. Descriptor     */
                                                /* pointing to CNF_FILE_READ */
                                                /* or CNF_FILE_WRIT.         */
                                                /* Type of access required.  */



/*
** Read the master index file.  
*/
#ifdef CONFIG_FILE_STRUC_H   
vmsstat_t cnf_read_master(
             cnf_lun_t const * const                    lun_p,
                                                /* Input arg. Logical unit   */
                                                /* number obtained with      */
                                                /* lib$get_lun.              */
             fstring_ts const * const                   name_key_ps,
                                                /* Input arg.                */
                                                /* Name of record to get.    */
                                                /* Only used if              */
                                                /* *key_to_use_p == 1        */
             int4 const * const                         int_key_p,      
                                                /* Input arg.                */
                                                /* Index of record to get.   */
                                                /* Only used if              */
                                                /* *key_to_use_p == 0        */
             struct conf_data * const                   conf_data_ps,
                                                /* Output arg.               */
                                                /* Record from master index. */
             int4u const * const                        key_to_use_p);
                                                /* Input arg. Key to use.    */
                                                /* If 0, *int_key_p is used. */
                                                /* If 1, *name_key_p is used.*/
 
#endif /* CONFIG_FILE_STRUC_H defined. */


/*
** Close master index file.    
*/ 
vmsstat_t cnf_close_master(
             cnf_lun_t const * const                    lun_p);
                                                /* Input arg. Logical unit   */
                                                /* number obtained with      */
                                                /* lib$get_lun.              */
/*
**==============================================================================
*/ 

/*
** Get and put the selected config type (CON,DES,ACT). 
**
*/
vmsstat_t CNF_type_put(           
             cnf_type_ta   const                        type_in_a ) ;


vmsstat_t CNF_type_get(           
             cnf_type_ta                                type_out_a ) ;

/*
**==============================================================================
*/ 

/*
** These functions get and free VM for CNFUTIL and CNFSHR.  With the 
** debugger, VM usage can be tracked by checking a static stat structure.
*/

vmsstat_t cnf_vm_free(
                                                /* Input. Bytes to free.     */
             int4u const * const                        bytes_p, 
                                                /* Input. Address for free.  */
             void  ** const                             address_pp );  

vmsstat_t cnf_vm_get(       
                                                /* Input. Bytes to get.      */
             int4u const * const                        bytes_p, 
                                                /* Output. Address gotten.   */
             void  ** const                             address_pp );  


/*
**==============================================================================
*/ 

vmsstat_t cnf_get_gold(
            fstring_ts const * const             name,
            int4 * const                         number );

vmsstat_t cnf_bld_filename(
            fstring_ts const * const             type,
            fstring_ts const * const             name,
            int4 const * const                   number,
            fstring_ts * const                   filename );

vmsstat_t save_config(
            fstring_ts const * const             region_ps,
            fstring_ts const * const             directory_ps,
            int4 * const                         number_p,
            fstring_ts const * const             type_ps,
            ...   
/*          vmsstat_t                            (*coroutine_pf)(),
**          void * const                         context_p     
*/
                    );
            
vmsstat_t load_config(
            fstring_ts const * const             region_ps,
            fstring_ts const * const             directory_ps,
            int4 * const                         number_p,
            ...   
/*          vmsstat_t                            (*coroutine_pf)(),
**          struct cnf_db_partial * const        prim_ps ,     
**          struct cnf_db_partial * const        micr_ps ,     
**          int4 * const                         count_out_p , 
**          void * const                         context_p     
*/
                    );


#ifdef CNF_PARTIAL_H
vmsstat_t make_config_active(
            fstring_ts const * const             region_ps,
            struct cnf_db_partial * const        prim_ps ,     
            struct cnf_db_partial * const        micr_ps ,     
            log4 const * const                   do_activate_pe , 
            log4 const * const                   do_trim_pe ,     
            ...
/*          vmsstat_t                            (*coroutine_pf)(),
**          int4 * const                         count_out_p , 
**          void * const                         context_p     
*/
                    );
#endif      

vmsstat_t get_selected_config(
            fstring_ts const * const             region_ps,
            fstring_ts const * const             directory_ps,
            ...
/*          int4 * const                         current_class_p ,
**          int4 const * const                   class_p  
*/
                            );

vmsstat_t confgpt(               
            int4 * const                         last_loaded_p     
                            );




vmsstat_t cnf_last_region_for_class (
            fstring_ts const * const             operation_ps , 
            fstring_ts       * const             region_ps,
            fstring_ts       * const             directory_ps,
            ...   
/*          cnf_class_t * const                  current_class_p , 
**          cnf_class_t const * const            class_p 
*/
                    );

vmsstat_t cnf_get_last_saved (
            cnf_name_ta   const                  region_a ,
            cnf_direct_ta const                  directory_a ,
            int4 * const                         num_p           );

/*
**==============================================================================
*/ 

/*
** Display functions.
*/

vmsstat_t CNF_display_config (
            int4 * const                        page_p ,
            fstring_ts const * const            region_ps,
            fstring_ts const * const            directory_ps,
            int4 const * const                  poin_p ,
            log4 const * const                  all_p , 
            log4 const * const                  gold_p ,
            log4 const * const                  acquire_p );

vmsstat_t CNF_display_config_beg (
            int4 * const                        page_p ,
            fstring_ts const * const            region_ps,
            fstring_ts const * const            directory_ps,
            int4 const * const                  poin_p ,
            log4 const * const                  gold_p ,
            fstring_ts       * const            filname_ps , 
            cnf_lun_t * const                   io_unit_p ,
            vmsstat_t * const                   io_unit_status_p , 
            vmsstat_t * const                   open_status_p );   

vmsstat_t CNF_display_config_fin (
            cnf_lun_t const * const             io_unit_p ,
            vmsstat_t const * const             io_unit_status_p , 
            vmsstat_t const * const             open_status_p );   

/*
**==============================================================================
*/ 

/*
** This function gets the FORTRAN logical unit number for the
** current save.
*/

vmsstat_t cnf_save_param_get_lun( cnf_lun_t * const    lun_p);
                                                /* Output arg. LUN.          */


/*
**==============================================================================
*/ 

/* 
** This function is only called by config C functions to    
**  do FORTRAN reads from files.                 
*/

vmsstat_t cnf_read_fortran(      cnf_lun_t const * const            lun_p,
                                                /* Input. FORTRAN file unit. */
                                 fstring_ts * const                 line_ps );
                                                /* Output. Record from file. */


/* 
** This function is only called by config C functions to    
**  do FORTRAN writes to files.                   
*/

vmsstat_t cnf_write_fortran(     cnf_lun_t const * const            lun_p,
                                                /* Input. FORTRAN file unit. */
                                 fstring_ts const * const           line_ps );
                                                /* Input. Line for file write.*/


/*
**==============================================================================
*/ 

#ifdef CNF_STRUC_H
#ifdef CNF_TEMPLATE_STRUC_H

/* 
** Function to write to data to save file.
*/

vmsstat_t config_write_item( struct cnf_struc const * const   conf_st_ps,
                                                /* Input arg. Data to write. */
                             cnf_fmt_ta const                 fmt_string_a,
                                                /* Input arg. Fmt to use.    */
                             struct cnf_template_struc const * const 
                                                              template_rec_ps);
                                                /* Input arg. Template line. */
                                                /* Used for con,des,act      */
                                                /* secondaries; error sends  */

#endif
#endif

#ifdef CNF_STRUC_H
#ifdef CNF_FILE_REC_STRUC_H

/* 
** Function to read data from save file.
*/

vmsstat_t config_read_item(  struct cnf_struc       * const   conf_st_ps,
                                                /* Output arg. Data read.    */
                             cnf_lun_t const * const          lun_p,       
                                                /* Input arg. Fmt to use.    */
                             struct cnf_file_rec_struc * const rec_ps);
                                                /* Output arg. First line    */
                                                /* read from file when       */
                                                /* forming *conf_st_ps.      */


#endif
#endif

/*
**==============================================================================
*/ 

#ifdef CNF_STRUC_H

/*
** This function will compare the conditional-expression pair or
** beamcode scheduling group information pointed to by
** ->rgbm_ptr in the first two args to see if there is a match.
** Whitespace is ignored.
**
*/

vmsstat_t cnf_cmp_rgbm(         
             struct cnf_struc const * const               conf_st1_ps,
                                                /* Input arg.                */
                                                /* First item to compare.    */
             struct cnf_struc const * const               conf_st2_ps,
                                                /* Input arg.                */
                                                /* Second item to compare.   */
             BOOL * const                                 match_pe);
                                                /* Output arg.               */
                                                /* Did items match?          */

#endif

/*
**==============================================================================
*/ 

#ifdef CNF_STRUC_H

/*
** This function will fill *conf_st_ps with conditional expression pair
** information for the DUPCD specified in conf_st_ps->timing_rec.primary,
**                                        conf_st_ps->timing_rec.micro,
**                                        conf_st_ps->timing_rec.unit,
**                                        conf_st_ps->timing_rec.beam_code.
*/

vmsstat_t cnf_getexpr(
             struct cnf_struc * const               conf_st_ps);

/*
** This function will fill *conf_st_ps with beamcode scheduling group 
** information for the group specified in conf_st_ps->timing_rec.bgrp_name_c.
*/

vmsstat_t cnf_getbgrp(
             struct cnf_struc * const               conf_st_ps);



/*
** This function will fill *conf_st_ps with TMVA                             
** information for the TMVA specified in conf_st_ps->timing_rec.tmva_name_c.
*/

vmsstat_t cnf_gettmva(
             struct cnf_struc * const               conf_st_ps);



#endif

/*
** The cnf_get*() functions all call RGBM_rbsv().  RGBM_rbsv() requires
** as an argument a function to call when it has a record to add
** to its output.
**
** This is the function that the cnf_get*() functions pass to RGBM_rbsv()
** for writing to the output buffer.
*/

vmsstat_t cnf_rgbm_rbsv_pack( fstring_ts const * const    record_ps,
                                                /* A pointer to a            */
                                                /* descriptor that RGBM_rbsv */
                                                /* wants to add to the       */
                                                /* buffer *buffer_ps.        */
                              fstring_ts * const          buffer_ps );
                                                /* A pointer to a            */
                                                /* descriptor that contains  */
                                                /* the output from RGBM_rbsv.*/

/*
**==============================================================================
*/ 

#if defined(RGBM_VAX_TYPES_H) && defined(RGBM_INCLUDE_EXPRSTRUCTS)

   /*  The functions in this file are the config interface for 
       calling some of the RGBM_restore*() functions.  The
       RGBM_restore* functions can perform actions which require a "closing"  
       of SLC micros that have been affected.  When RGBM_restore_micr_fin()
       is called, all micros that have been affected since the last 
       call to the function RGBM_restore_micr_start() are closed.

       cnf_rgbm_restore_clear() just calls RGBM_restore_micr_start to zero a
          context pointer which is then used as the base of a chain of blocks
          in which DUPCD conditional expression information may be accumulated.

       cnf_rgbm_restore_finish() calls RGBM_restore_micr_fin() to load the
          accumulated information if any to the shared global section and to
          the affected micros.
   */
 
vmsstat_t cnf_rgbm_restore_clear(rg_micr_head_ts ** rgbm_micr_pp);

vmsstat_t cnf_rgbm_restore_finish(rg_micr_head_ts ** rgbm_micr_pp);

#endif
/*
**==============================================================================
*/ 


/*
** This function allows all the information for a configuration save file
** to be loaded into virtual memory, along with current information for
** all the data saved in the file.
** This information can be read back quickly to form a display and allow
** NEXT PAGE/PREV PAGE on a timely basis.
** If the information stored in virtual memory is not used within a certain 
** period, it is automatically deleted to conserved virtual memory on the SCP.
*/

vmsstat_t cnf_storage_setup(
             filespec_ta const                          filnam_a,
                                                /* Input Arg. Name of config */
                                                /* file to set up.           */
             int4u const * const                        filnam_len_p,  
                                                /* Input arg. Length of first*/
                                                /* argument.                 */
             vmsstat_t const * const                    acquire_p,      
                                                /* Input arg. If SUCCESS(    */
                                                /* *acquire_p), new data     */
                                                /* should be acquired,       */
                                                /* even if filnam_a and the  */
                                                /* selected SCP beam code are*/
                                                /* the same as on the last   */
                                                /* call.                     */
             int4u const * const                        lun_p,
                                                /* Input arg. FORTRAN        */
                                                /* logical unit number of    */
                                                /* open file filnam_a.       */
             int4u const * const                        entire_file_beam_code_p, 
                                                /* Input arg. Beam code under*/
                                                /* which filnam_a was saved. */
             timestamp_ta                               acquire_time_out_a);     
                                                /* Output arg.  Time that    */
                                                /* this function last filled */
                                                /* its list of current data. */

#ifdef CNF_STRUC_H
#ifdef CNF_FILE_REC_STRUC_H


/*
** This function allows items (stored by cnf_storage_setup) to be retrieved
** one per call.  File data is returned, along with current data.
** Call cnf_storage_setup() to rewind.
*/

vmsstat_t cnf_storage_read_item(
             struct cnf_struc * const                   conf_st_file_ps,
                                                /* Output arg. Data from file*/
             struct cnf_struc * const                   conf_st_cur1_ps,
                                                /* Output arg. Copy of       */
                                                /* *conf_st_file_ps, but     */
                                                /* contains current data.    */
                                                /* (Exact meaning depends    */
                                                /* on the value of           */
                                                /* conf_st_file_ps->         */
                                                /* structure).               */
             struct cnf_struc * const                   conf_st_cur2_ps,
                                                /* Output arg. Copy of       */
                                                /* *conf_st_file_ps, but     */
                                                /* contains current data.    */
                                                /* (Exact meaning depends    */
                                                /* on the value of           */
                                                /* conf_st_file_ps->         */
                                                /* structure).               */
             struct cnf_file_rec_struc * const          rec_ps);           
                                                /* Output arg. First line    */
                                                /* for item, as read from    */
                                                /* config file.              */

#endif
#endif

/*
**==============================================================================
*/ 

/* End file cnf_proto.h ======================================================*/
$
$ CREATE/LOG NETPARM.HC
 
#ifndef NETPARM_H
#define NETPARM_H
 
/*                                                                            */
#define NETBUFLEN 4096
/*      Standard network buffer length (in words) for database transfers      */
/*                                                                            */
#define NETMSGLEN 512
/*       Old maximum size in words of message service message, now            */
/*       superseded by NETVAXMSGLEN and NETMICMSGLEN.                         */
/*                                                                            */
#define NETHEADERLEN 10
/*       Number of words of header for Message Service.                       */
/*                                                                            */
#define NETVAXMSGLEN 1024
/*       Max size in words of message service msg, Vax-->micro                */
/*                                               or Vax-->Vax or micro-->micro*/
/*                                                                            */
#define NETVAXDATALEN (NETVAXMSGLEN-NETHEADERLEN)
/*       Max size in words of data area , Vax-->micro                         */
/*                                     or Vax-->Vax or micro-->micro          */
/*                                                                            */
#define NETMICMSGLEN 4096
/*       Max size in words of message service msg, micro-->Vax                */
/*                                                                            */
#define NETMICDATALEN (NETMICMSGLEN-NETHEADERLEN)
/*       Max size in words of data area , micro-->Vax                         */
/*                                                                            */
#define NETMICLONGMSGLEN 65535
/*       Max size in words of long message service msg, micro-->Vax           */
/*       32Kw                                                                 */
/*                                                                            */
#define NETVAXRPLYBIGLEN 1610612736
/*       Max size in words of REPLY message service msg, Vax-->Vax            */
/*       One Gword                                                            */
/*                                                                            */
#define NETVAXRPLYSMALEN 32767
/*       Max size in words of REPLY message service msg, Vax-->Vax            */
/*       32Kw                                                                 */
/*                                                                            */
#define NETVAXRPLYDATALEN (NETVAXRPLYSMALEN-NETHEADERLEN)
/*       Preserve old definition of reply len which is now the                */
/*       small length = header length                                         */
/*                                                                            */
#define NODE_OFFSET 100
/*       Constant added to BITID to get node number (not reliable).           */
/*                                                                            */
#define TCPFWDHDRBYTELEN 12
/*       Length of fwd_hdr_ts in slctxt:msghead.hc for TCP msg service        */
/*                                                                            */
#define MSG_NET -1
#define MSG_NO_NET 4
#define MSG_NET_NOREAD 2
/*                                                                            */
#define DONE_MASK 128
 
#endif
$
$ CREATE/LOG SLC_MACROS.HC
#ifndef SLC_MACROS_HC
#include "slctxt:slc_macr.hc"
#define SLC_MACROS_HC
#endif
$
$ CREATE/LOG SLC_MACR.HC

#ifndef SLC_MACR_HC
#define SLC_MACR_HC

/* **  Check status return from standard error codes ** */

#define     SUCCESS( status)    ((status)&1)
 
/* ** MIN and MAX ** */

#ifdef MAX
#undef MAX
#endif
#define MAX(A, B) ((A) > (B) ? (A) : (B)) /* MAXIMUM of two expressions */

#ifdef MIN
#undef MIN
#endif
#define MIN(A, B) ((A) < (B) ? (A) : (B)) /* MINIMUM of two expressions */
 
/* 
**  Macro to be used with the find_index_c or find_index functions 
**  available on the VAX and micro.  These these functions 
**  search an array for a match to a supplied key.  If the key
**  is not found in the search string the following is returned:
**     in the "C" version a -1 is returned,
**     in the assembly version a 0 is returned,
**  Therefore, modify the usage of this macro depending upon 
**  which version of the function was called.
*/
#define MATCH_FOUND( index )     ((index)==-1) ? FALSE_F : TRUE_T
#define MATCH_NOT_FOUND( index ) ((index)==-1) ? TRUE_T  : FALSE_F

/*
** The macro GETBITS returns the right adjusted n-bit
** field of x that begins at position p. Assuming that
** both n and p are positive.
*/
#define GETBITS(x,p,n) ( ((x)>>( ((p)+1(n))) & ~(~0 << (n)) )

/*
** The macro CLRBITS returns a value x which has
** set to zero all bits in x that were set in the
** mask, and leaving all other bits in x unchanged.
*/
#define CLRBITS(x,mask)  ( (x) & (~mask) )

/* 
   Typedef's for various flavors of integers. Done in anticipation of the
   switch to RMX3 when the definition of int will change. We try to
   make a typedef category for each class of parameter, guessing at
   this time which will stay as 2 byte integers and which can float to
   4 bytes at RMX III time. These are also used by VAX code for message
   definition etc.

*/

typedef short             int2;           /* An I*2 */
typedef unsigned short    int2u;          /* An unsigned I*2 */
typedef long int          int4;           /* An I*4 */
typedef unsigned long int int4u;          /* An unsigned I*4 */
typedef unsigned char     int1u;          /* For unsigned byte arithmetic */
typedef unsigned char     charu;          /* For unsigned byte arithmetic */

/* Give VMS style status its own type */

typedef int4u           vmsstat_t;      /* VMS type status stays 32 bits */

/* 
** Give FORTRAN-style LOGICALs their own types:
**
** The LOGICAL*4 type used in FORTRAN must sometimes be used in C code
** when calling FORTRAN routines (and vice-versa).
**
** LOGICAL*4 is not quite the same thing as vmsstat_t; it is like
** vmsstat_t in that the low-order bit determines TRUE/FALSEness, but
** unlike vmsstat_t in that you can't call err_send with it.
**
** LOGICAL*4 is not quite the same thing as BOOL; it is like BOOL in that
** it represents TRUE/FALSE, but unlike BOOL in that the values used to
** represent specific values of TRUE and FALSE differ.               
**
** The picky or careful can use log4 to represent a FORTRAN LOGICAL*4
** to avoid confusion.  (One might argue that log4u should be used
** but since FORTRAN uses -1 for TRUE signed is probably safer). 
*/
typedef char            log1;                   /* same as FORTRAN LOGICAL*1  */
    /* NOTE:  log2 conflicts with usage in  decc$rtldef.tlb  module math.h */
/* typedef int2            log2;  */                 /* same as FORTRAN LOGICAL*2 */
typedef int4            log4;                   /* same as FORTRAN LOGICAL*4 */

#define TRUE_FORTRAN   (-1)                     /* same as FORTRAN .TRUE.    */
#define FALSE_FORTRAN  (0)                      /* same as FORTRAN .FALSE.   */
                                                /* (note that we are         */
                                                /* deliberately not defining */
                                                /* the size of the TRUE_     */
                                                /* FORTRAN constant.  This   */
                                                /* is because FORTRAN sets   */
                                                /* all the bits in a TRUE    */
                                                /* logical.  So TRUE_FORTRAN */
                                                /* will work with log1, log2,*/
                                                /* and log4 correctly.       */

#define IS_TRUE_FORTRAN(logical)  ((logical)&1) /* Test a FORTRAN LOGICAL    */
                                                /* (same as SUCCESS).        */

/* ** The boolean type ** */
/*
 * The boolean type on the vax must take into account that TRUE and
 * FALSE are defined as constants and cannot be enum elements.
 * Thus the *_B thing.
 *
 * The boolean type on the 68K micro must take into account that the
 * SCI-provided file psos.hv already defines BOOLEAN as a char.
 *
 * The boolean type on the 386 micro must take into account that the
 * intel-provided include file RMXC.H pre-defines BOOLEAN as a unsigned
 * char but can't redefine TRUE_B and FALSE_B. Sigh.
 *
 * New code intended to run on the VAX and micro should use type BOOL
 * with members TRUE_T and FALSE_F
 */
#ifndef BOOLEAN_DEF
#ifdef TRUE
#ifdef FALSE
#ifndef BOOLEAN
#define BOOLEAN_DEF
typedef enum {FALSE_B = FALSE, TRUE_B = TRUE} BOOLEAN;
#endif /* BOOLEAN */
#endif /* TRUE */
#endif /* FALSE */
#endif /* BOOLEAN_DEF */

#ifndef BOOL_DEF

typedef enum {FALSE_F = 0, TRUE_T = 1} BOOL;

/* Macro to turn a FORTRAN logical into a BOOL. */
#define LOGICAL_TO_BOOL( logical )    \
   ( IS_TRUE_FORTRAN((logical)) ? TRUE_T : FALSE_F )
   
/* Macro to turn a BOOL into a FORTRAN logical. */
#define BOOL_TO_LOGICAL( theBOOL )      \
   ( ( TRUE_T == (theBOOL) ) ? TRUE_FORTRAN : FALSE_FORTRAN )

#define BOOL_DEF
#endif /* BOOL_DEF */

/*
** Define a general VMS timestamp type.
*/
#define NUM_TIMESTAMP_ITEMS  2
typedef int4u timestamp_ta [NUM_TIMESTAMP_ITEMS];

/* 
** The following macros will convert a float or double to the nearest
** 2 or 4 byte signed integer.
*/

#define NEAREST_INT4(A) (int4)(((A) > 0.0) ? ((A) + 0.5) : ((A) - 0.5))
#define NEAREST_INT2(A) (int2)(((A) > 0.0) ? ((A) + 0.5) : ((A) - 0.5))
 
/* The function slc_node() returns one of these two: */

#define VAX_PROD_NAME   "PRODUCTION"           /* VAX production  node name*/
#define VAX_DEV_NAME    "DEVELOPMENT"          /* VAX development node name*/

/*
** Compatibility between VMS and DOS platforms
*/

#ifdef SLC_DOS
#define DOS_PTR  far           /* holds FAR (for pointers) on DOS */
#else
#define DOS_PTR                /* if not DOS, far pointer is set to blank */
#endif

#endif /* SLC_MACR_HC */
$
$ CREATE/LOG MPG_RATELIM_TYPES.HC
 
#ifndef MPG_RATELIM_TYPES_HC
 
#define RLIM_NAREAS    8      /* # of areas for which MPG differently         */
                              /*  interprets ratelimiting requests.           */
#define RLIM_NTYPES    8      /* Max # of possible ratelimiting states (same  */
                              /*  for each ratelimiting area).                */
#define RLIM_NDEVS     6      /* Max # of pseudodevices in MPG accomplishing  */
                              /*  ratelimiting in an area (same for each      */
                              /*  ratelimiting area).                         */
 
#define RLIMAREA_NAME_SIZE  8   /* Length in bytes of ratelimiting area name. */
 
 typedef char RLIMAREA_NAME_TA[RLIMAREA_NAME_SIZE];
 
#define RLIMTYPE_NAME_SIZE  8   /* Length in bytes of BPAT:RLIM.              */
 
 
 
  /* The following two macros define the list of ratelimiting area names   */
  /* and for each a byte array indicating applicability of ratelimiting    */
  /* pseudodevices within each area.  Areas are:                           */
  /*                                                                       */
  /*   "NULL    "   Zero beamcode, or no beam.                             */
  /*   "SLC     "   Beam production (E- and E+) to SLC collision and dump. */
  /*   "HER_INJ "   Beam source (E-) to injection into HER.                */
  /*   "LER_INJ "   Beam production (E+) to injection into LER.            */
  /*   "FFTB    "   Beam source to FFTB and dump.                          */
  /*   "A_LINE  "   Beam source to A_LINE and ESA (no DR).                 */
  /*   "NLCTA   "   NLCTA beam only.                                       */
  /*   "CRYO    "   Gun test lab only.                                     */
  /*                                                                       */
  /* Note:  Strings generated by RLIMAREA_NAMELIST are not null-terminated;*/
  /*        strings generated by RLIMAREA_NAMELIST_N are.                  */
 
#define RLIMAREA_NAMELIST(labl) char labl[RLIM_NAREAS][RLIMAREA_NAME_SIZE] \
  = {"NULL    ", "SLC     ", "HER_INJ ", "LER_INJ ", "FFTB    ", \
     "A_LINE  ", "NLCTA   ", "CRYO    "}
 
#define RLIMAREA_NAMELIST_N(labl) char *labl[RLIM_NAREAS] \
  = {"NULL",     "SLC",      "HER_INJ",  "LER_INJ",  "FFTB", \
     "A_LINE",   "NLCTA",    "CRYO"}
 
#define RLIMAREA_PSDEVMASKS(labl) unsigned char labl[RLIM_NAREAS][RLIM_NDEVS] \
  = {0,0,0,0,0,0, 1,1,1,1,1,1, 0,0,1,1,1,1, 0,0,1,1,1,1, 0,0,1,1,1,1, \
     0,0,1,1,1,1, 0,0,0,0,1,1, 0,0,1,1,1,1}
 
   /* Following macro defines a label for displays and dialog */
   /* prompts for the ratelimiting area parameter:            */
 
#define RLAREA_TAGNAME_C(label) char label[] = "RLAREA"
 
 
 
 
  /* The following two macros define the list of ratelimiting state names     */
  /* and their abbreviations.  These are:                                     */
  /*                                                                          */
  /*   "FULLRATE"   Full rate everywhere.                                     */
  /*   "LIMHI_FS"   E+ beam in arc or bypass limited to 10 Hz using s.b.d.    */
  /*   "LIMHI_FN"   E- beam in arc or bypass limited to 10 Hz using s.b.d.    */
  /*   "LIMHI_FF"   Both beams in arcs/bypass limited to 10 Hz using s.b.d.'s.*/
  /*   "LIMH_2_9"   Beam downstream of dumper 2-9 limited to 10 Hz.           */
  /*   "LIMIT_HI"   Beam everywhere limited to 10 Hz.                         */
  /*   "LIMIT_LO"   Beam everywhere limited to 1 Hz.                          */
  /*   "ZERORATE"   No beam at all.                                           */
 
#define RLIMTYPE_NAMELIST(labl) char labl[RLIM_NTYPES][RLIMTYPE_NAME_SIZE] \
  = {"FULLRATE", "LIMHI_FS", "LIMHI_FN", "LIMHI_FF", "LIMH_2_9", \
     "LIMIT_HI", "LIMIT_LO", "ZERORATE"}
 
#define RLIMTYPE_ABBRLIST(labl) char labl[RLIM_NTYPES][6] \
  = {"  FULL",   " LIMFS",   " LIMFN",   " LIMFF",   " LIM29", \
     "LIM_HI",   "LIM_LO",   "  ZERO"}
 
 
  /*  The following three enum's define ratelimiting area  */
  /*  indices, state indices, and pseudodevice indices.    */
  /*  Beware that values rlim_state_sbd_south and          */
  /*  rlim_state_sbd_north cant be compared with each      */
  /*  other and are sometimes or'ed together to make       */
  /*  rlim_state_sbd_both.  Note that MPS needs the NULL   */
  /*  ratelimiting area to have index 0.                   */
 
 typedef enum
 {   rlim_area_null,             /* 0 = Zero beamcode, or no beam.            */
     rlim_area_slc,              /* 1 = SLC beam production & collision.      */
     rlim_area_herinj,           /* 2 = HER beam production & injection.      */
     rlim_area_lerinj,           /* 3 = LER beam production & injection.      */
     rlim_area_fftb,             /* 4 = FFTB beam production, test, & dump.   */
     rlim_area_aline,            /* 5 = A-line beam production to ESA (no DR).*/
     rlim_area_nlcta,            /* 6 = NLCTA only.                           */
     rlim_area_cryo              /* 7 = CRYO (gun test lab) only.             */
 } rlim_areas_te;                /* Note that rlim_areas_te has exactly       */
                                 /* RLIM_NAREAS elements.                     */
 
 typedef enum
 {   rlim_state_full,            /* 0 = fullrate.                   */
     rlim_state_sbd_south,       /* 1 = south arc/bypass s.b.d.     */
     rlim_state_sbd_north,       /* 2 = north arc/bypass s.b.d.     */
     rlim_state_sbd_both,        /* 3 = north & south s.b.d's.      */
     rlim_state_sbd_2_9,         /* 4 = 2-9 s.b.d.                  */
     rlim_state_hi,              /* 5 = 10 Hz.                      */
     rlim_state_lo,              /* 6 = 1 Hz.                       */
     rlim_state_zero             /* 7 = zerorate if from MPS;       */
                                 /*     total shutoff if from IDIM. */
 } rlim_state_te;                /* Note that rlim_state_te has     */
                                 /* exactly RLIM_NTYPES elements.   */
 
 typedef enum
 {   rlim_psdev_sbd_south,       /* 0 = south arc/bypass s.b.d.  */
     rlim_psdev_sbd_north,       /* 1 = north arc/bypass s.b.d.  */
     rlim_psdev_sbd_2_9,         /* 2 = 2-9 s.b.d.               */
     rlim_psdev_hi,              /* 3 = 10 Hz.                   */
     rlim_psdev_lo,              /* 4 = 1 Hz.                    */
     rlim_psdev_zero             /* 5 = 0 Hz.                    */
 } rlim_psdevx_te;               /* Note that rlim_psdevx_te has */
                                 /* exactly RLIM_NDEVS elements. */
 
#define MPG_RATELIM_TYPES_HC
#endif
 
$
$
$ CREATE/LOG RUN_EXAMPLE.COM
$DECK
$! RUN_EXAMPLE.COM
$! ---------------
$
$ SET NOON
$
$ create sys$output

    CSC Reference:  C970304-6304

Compiling cnf_getbgrp.c with SYS$OUTPUT, SYS$ERROR to CC.LOG...
  (expect this to complete successfully)

$
$ DEFINE/USER SLCTXT []
$ DEFINE/USER SYS$OUTPUT CC.LOG
$ DEFINE/USER SYS$ERROR CC.LOG
$
$ CC /CHECK=(NOUNINIT,POIN=ALL)/NOOBJ/NOLIST CNF_GETBGRP.C
$
$ create sys$output

Compiling cnf_getbgrp.c with SYS$OUTPUT, SYS$ERROR to terminal..."
 -- we expect this to hang the terminal, outputting, after several pages,
    the following message:

   status = RGBM_rbsv( sizeof(rgbm_rbsv_inp_s),
............^
%CC-W-PTRMISMATCH, In this statement, the referenced type of the pointer value "cnf_rgbm_rbsv_pack" is "function
(const pointer to const struct dsc$descriptor, const pointer to struct dsc$descriptor) returning unsigned long

   In fact, when we run it on our system with DECC 5.5-002 it hangs the terminal.
   When we run it on a different system with DECC 5.3-006, the same message has
   several 'garbage' characters at the end, but does NOT hang the terminal.

$
$ DEFINE/USER SLCTXT []
$
$ CC /CHECK=(NOUNINIT,POIN=ALL)/NOOBJ/NOLIST CNF_GETBGRP.C
$
$ exit
$EOD
$
$ @RUN_EXAMPLE.COM
$ EXIT
$
T.RTitleUserPersonal
Name
DateLines
1277.1DECC::ZAHAREELinda D. ZahareeWed Mar 19 1997 09:386
    I was able to reproduce your problem.  It appears that the compiler is
    outputting additional garbage in that particular diagnostic.  I will
    add this problem to our internal bug list.
    
    Thanks,
    Linda.  
1277.2DECC::ZAHAREELinda D. ZahareeWed Mar 19 1997 13:254
    It appears that this problem has already been fixed in our development
    compiler.
    
    Linda.
1277.3CSC32::D_SANFORDTue Mar 25 1997 11:021
    Great, thank you for the update.  -drew
1277.4Yes, the fix is in T5.6 announced in DECC 3.lastCXXC::REPETERich Peterson 381-1802 ZKO2-3/N30Wed Mar 26 1997 16:000