# CStruct Examples
require 'cstruct'

# example:
# struct U in C\C++ (32-bit platform): 
# 
#struct U
#{
#    union NumericType
#    {
#        int32   v1;
#        int16   v2;  
#        int16   v3;  
#    };
#    NumericType value;
#};

# Named union is nonsupport in CStruct. Fortunately, anonymous union can take the place of it.
# struct U in Ruby: 
class U < CStruct
    union:value do
        int32:x
        int32:y
    end
end

#  See also: 'anonymous_union.rb'