details-enums.m2i
上传用户:wxp200602
上传日期:2007-10-30
资源大小:4028k
文件大小:3k
- ############################################################# -*- c -*-
- ## generic include for enums. Do not use directly.
- ##
- ## $Id: details-enums.m2i,v 1.10 2004/10/08 23:40:24 rstory Exp $
- ########################################################################
- @if $m2c_mark_boundary == 1@
- /** START code generated by $RCSfile: details-enums.m2i,v $ $Revision: 1.10 $ */
- @end@
- ########################################################################
- @ifconf $node.syntax.m2i@
- @ include $node.syntax.m2i@
- @else@
- ##
- ## Generating enums
- ##
- ## Examples:
- ##
- ## enums syntax perltype net-snmp type cdecl m2c_decl
- ## ----- -------- -------- ------------- ----- -------
- ## 1 SomeTC BITS ASN_OCTET_STR char u_long
- ## 1 INTEGER INTEGER ASN_INTEGER long u_long
- ## 1 RowStatus INTEGER ASN_INTEGER long u_long
- ##
- /*************************************************************
- * constants for enums for the MIB node
- * $node ($node.syntax / $node.type)
- *
- * since a Textual Convention may be referenced more than once in a
- * MIB, protect againt redefinitions of the enum values.
- */
- ##
- #ifndef ${m2c_de_pfx}_ENUMS
- #define ${m2c_de_pfx}_ENUMS
- @ eval $m2c_mask=""@
- @ foreach $e $v enum@
- @ include m2c_setup_enum.m2i@
- @ if "$node.perltype" eq "BITS"@
- @ if $v > 31@
- @ print ** ACK! I cannot handle BITS longer than 4 bytes!@
- @ exit@
- @ end@
- @ if "x$m2c_mask" eq "x"@
- @ eval $m2c_mask="$m2c_ename"@
- @ else@
- @ eval $m2c_mask="$m2c_mask | $m2c_ename"@
- @ end@
- $m2c_const_dcl $m2c_ename $m2c_const_del (1 << (31-$v)) $m2c_const_sfx
- @ else@
- $m2c_const_dcl $m2c_ename $m2c_const_del $v $m2c_const_sfx
- @ end@
- @ end@ # for each
- @ if "$node.perltype" eq "BITS"@
- $m2c_const_dcl $m2c_enum_mask $m2c_const_del ($m2c_mask)
-
- @ end@
- #endif /* ${m2c_de_pfx}_ENUMS */
- @ if $m2c_node_skip_mapping == 0@
- @ if ($node.enums == 1) && ("$node.perltype" ne "BITS")@
- /*
- * TODO:140:o: Define interal representation of $node enums.
- * (used for value mapping; see notes at top of file)
- */
- @ foreach $e $v enum@
- @ include m2c_setup_enum.m2i@
- $m2c_const_dcl INTERNAL_$m2c_iname $m2c_const_del $v $m2c_const_sfx
- @ end@
- @ end@ // enums, ! BITS
- @ end@ // skip mapping
- @end@ # ! syntax include
- ########################################################################
- @if $m2c_mark_boundary == 1@
- /** END code generated by $RCSfile: details-enums.m2i,v $ $Revision: 1.10 $ */
- @end@