#############################################################  -*- c -*-
## generic include for XXX. Do not use directly.
##
## $Id: generic-table-oids.m2c,v 1.10 2004/10/08 23:39:17 rstory Exp $
########################################################################
@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: generic-table-oids.m2c,v 1.10 2004/10/08 23:39:17 rstory Exp $
 *
 * $$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: generic-table-oids.m2c,v $ $Revision: 1.10 $ */
@end@
##

/* column number definitions for table $context */
#define $context.uc_OID              $context.commaoid
    @eval $minv = 0xffffffff@
    @eval $maxv = 0@
    @foreach $node column@
#define COLUMN_$node.uc		$node.subid
        @if $node.accessible == 1@
          @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

@   if $m2c_table_settable@
    /*
     * change flags for writable columns
     */
    @eval $gto_flag_idx = 0@
    @eval $gto_flag_req = ""@
    @foreach $node column@
        @if $node.settable == 1@
#define FLAG_$node.uc       (0x1 << $gto_flag_idx)
           @eval $gto_flag_idx = $gto_flag_idx + 1@
           @if ($m2c_table_row_creation == 1) && ("x$node.defval" eq "x")@
              @if "x$gto_flag_req" eq "x"@
                 @eval $gto_flag_req = "FLAG_$node.uc"@
              @else@
                 @eval $gto_flag_req = "$gto_flag_req | FLAG_$node.uc"@
              @end@
           @end@
        @end@
    @end@ # column

#define FLAG_MAX_$context.uc $gto_flag_idx

    @if $m2c_table_row_creation == 1@
      @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@
    @if $gto_flag_idx > 31@
    @   print ERROR: more then 32 settable columns not supported yet.@
    @   exit@
    @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: generic-table-oids.m2c,v $ $Revision: 1.10 $ */
@end@
