Method: Rod::Property::Field#to_c_struct
- Defined in:
- lib/rod/property/field.rb
#to_c_struct ⇒ Object
Converts the field to fields in a C struct.
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/rod/property/field.rb', line 124 def to_c_struct unless variable_size? str = " |#ifdef __BYTE_ORDER\n |# if __BYTE_ORDER == __BIG_ENDIAN\n | uint64_t \#{@name};\n |# else\n | \#{c_type(@type)} \#{@name};\n |# endif\n |#else\n | \#{c_type(@type)} \#{@name};\n |#endif\n SUBEND\n str.margin\n else\n \" \#{c_type(:ulong)} \#{@name}_length;\\n\" +\n \" \#{c_type(:ulong)} \#{@name}_offset;\\n\"\n end\nend\n" |