func (pac *Package) newTypedef(t *gcc.Typedef) *Typedef { var literal SpecWriter if t.IsEnum() { literal = pac.getEqualType(t.Base(), true) } else { literal = pac.getEqualType(t.Base(), false) } conv := ValConv if t.IsFundamental() { conv = NumConv } else if t.IsPointer() { conv = PtrConv } td := &Typedef{ baseCNamer: newExported(t), baseEqualType: baseEqualType{ cgoName: cgoName(t.CName()), size: t.Size(), conv: conv, }, literal: literal, rootId: t.Root().Id(), } return td }
func (pac *Package) newTypedef(t *gcc.Typedef) Typedef { baseGoName := pac.getNamer(t.Base()).GoName() goName := baseGoName if t.IsComposite() { goName = pac.globalName(t.Root().(gcc.Named)) } else if n := pac.globalName(t); n != "" { goName = n } convFunc := convValue if t.IsFundamental() { convFunc = conv } else if t.IsPointer() { convFunc = convPtr } if t.IsComposite() || t.IsFuncType() { return Typedef{ // no need to define it, just name it and provide conversion. Namer: namer{ goName: goName, cgoName: "C." + t.CName(), }, convFunc: convFunc, } } return Typedef{ exported: exported{ cName: t.CName(), file: t.File(), }, Namer: namer{ goName: goName, cgoName: "C." + t.CName(), }, baseGoName: baseGoName, convFunc: convFunc, } }