#############################################################  -*- c -*-
## generic include for XXX. Do not use directly.
##
## $Id$
########################################################################
@if $m2c_create_fewer_files != 1@
@eval $hack = "Id"@
@eval $m2c_save = "$name"@
@eval $name = "${m2c_save}_oids"@
@open ${name}.h@
/*
 * Note: this file originally auto-generated by mib2c using
 *  $Id$
 *
 * $$hack:$
 */
@include generic-header-top.m2i@
@eval $name = "$m2c_save"@
@end@ // m2c_create_fewer_files
########################################################################
@if $m2c_mark_boundary == 1@
/** START header generated by $RCSfile$ $Revision$ */
@end@
##

/* column number definitions for table $context */
#define $context.uc_OID              $context.commaoid

    @eval $minv = 0xffffffff@
    @eval $maxv = 0@
    @eval $gto_flag_req = ""@
    @eval $gto_flag_set = ""@
	@eval $m2c_tmp_gto = 0@

    @foreach $node column@
#define COLUMN_$node.uc         $node.subid
        @if $node.accessible == 1@
           @if ($node.settable == 1) || ($m2c_table_sparse == 1)@
@             if "x$gto_flag_set" eq "x"@
@               eval $gto_flag_set = "COLUMN_$node.uc_FLAG"@
@             else@
@               eval $gto_flag_set = "$gto_flag_set | COLUMN_$node.uc_FLAG"@
@             end@
			  @if $m2c_tmp_gto > 31@
#define COLUMN_$node.uc_FLAG    (((uint64_t)0x1) << $m2c_tmp_gto)
			  @else@
#define COLUMN_$node.uc_FLAG    (0x1 << $m2c_tmp_gto)
			  @end@
			  @eval $m2c_tmp_gto = $m2c_tmp_gto + 1@
           @end@
           @if ($m2c_table_row_creation == 1) && ($node.settable == 1) && ("x$node.defval" eq "x")@
              @if "x$gto_flag_req" eq "x"@
                 @eval $gto_flag_req = "COLUMN_$node.uc_FLAG"@
              @else@
                 @eval $gto_flag_req = "$gto_flag_req | COLUMN_$node.uc_FLAG"@
              @end@
           @end@
          @if $node.subid < $minv@
             @eval $minv = $node.subid@
             @eval $minn = "COLUMN_$node.uc"@
          @end@
          @if $node.subid > $maxv@
             @eval $maxv = $node.subid@
             @eval $maxn = "COLUMN_$node.uc"@
          @end@
        @end@
    
    @end@ # column

#define $context.uc_MIN_COL   $minn
#define $context.uc_MAX_COL   $maxn
##
## column_set_flags and column_exist_flags are unsigned ints, to 32 is
## the limit. Could try something with a 'long long' to see if that
## can get us to 64, or do something like FD_SET, which would let us
## be pretty unlimited.
##
    @if $maxn > 31@
    @   print ERROR: more than 32 columns not supported yet.@
    @   exit@
    @end@
    

@   if $m2c_table_settable@
  @if "x$gto_flag_set" ne "x"@
    /*
     * TODO:405:r: Review $context.uc_SETTABLE_COLS macro.
     * OR together all the writable cols.
     */
#define $context.uc_SETTABLE_COLS ($gto_flag_set)
  @end@
  @if $m2c_table_row_creation@
    @if "x$gto_flag_req" ne "x"@
    /*
     * TODO:405:r: Review $context.uc_REQUIRED_COLS macro.
     * OR together all the required rows for row creation.
     * default is writable cols w/out defaults.
     */
#define $context.uc_REQUIRED_COLS ($gto_flag_req)
    
      @end@
    @end@
@   end@ # settable
@if $m2c_create_fewer_files != 1@
@eval $m2c_save = "$name"@
@eval $name = "${m2c_save}_oids"@
@include generic-header-bottom.m2i@
@eval $name = "$m2c_save"@
@end@
########################################################################
@if $m2c_mark_boundary == 1@
/** END header generated by $RCSfile$ $Revision$ */
@end@
