gi: extract struct define code