34 func (t Type) Resolve(options *Options) Type {
37 switch options.PtrSize {
47 panic(fmt.Sprintf("unsupported ptr bits: %d", options.PtrSize))
50 switch options.PtrSize {
60 panic(fmt.Sprintf("unsupported ptr bits: %d", options.PtrSize))
66 func (t Type) String() string {
70 func (t Type) Size() int {
72 case SizeType, OffType:
73 panic("Size_t/Off_t types must be converted to another type using options.PtrSize")
74 case Pad, String, Int8, Uint8, Bool:
78 case Int32, Uint32, Float32:
80 case Int64, Uint64, Float64:
83 panic("Cannot resolve size of type:" + t.String())
87 var typeLookup = map[string]Type{
106 var typeNames = map[Type]string{
107 CustomType: "Custom",
111 for name, enum := range typeLookup {
112 typeNames[enum] = name
119 var reflectTypeMap = map[reflect.Kind]Type{
122 reflect.Int16: Int16,
124 reflect.Int32: Int32,
125 reflect.Int64: Int64,
126 reflect.Uint8: Uint8,
127 reflect.Uint16: Uint16,
128 reflect.Uint: Uint32,
129 reflect.Uint32: Uint32,
130 reflect.Uint64: Uint64,
131 reflect.Float32: Float32,
132 reflect.Float64: Float64,
133 reflect.String: String,
134 reflect.Struct: Struct,