summaryrefslogtreecommitdiff
path: root/local/mib2c-conf.d/generic-table-oids.m2c
blob: 6f8ab2af2f815e7292170cb0c15a22a2a0d94f79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#############################################################  -*- 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@