func LibraryUsesNodeType(l bh.LibraryIf, nt bh.NodeTypeIf) bool { for _, t := range l.NodeTypes() { if t.TypeName() == nt.TypeName() { return true } for _, impl := range t.Implementation() { if impl.ImplementationType() == bh.NodeTypeGraph { if SignalGraphTypeUsesNodeType(impl.Graph(), nt) { return true } } } } return false }
func CreateXmlLibrary(l bh.LibraryIf) *backend.XmlLibrary { fname := l.Filename() ret := backend.XmlLibraryNew() reflist := tool.StringListInit() for _, t := range l.SignalTypes() { ref := t.DefinedAt() _, ok := reflist.Find(ref) if !ok && ref != fname { reflist.Append(ref) } } for _, t := range l.NodeTypes() { ref := t.DefinedAt() _, ok := reflist.Find(ref) if !ok && ref != fname { reflist.Append(ref) } for _, impl := range t.Implementation() { if impl.ImplementationType() == bh.NodeTypeGraph { for _, lib := range impl.Graph().Libraries() { ref := lib.Filename() _, ok := reflist.Find(ref) if !ok && ref != fname { reflist.Append(ref) } } } } } for _, ref := range reflist.Strings() { ret.Libraries = append(ret.Libraries, *CreateXmlLibraryRef(ref)) } for _, t := range l.SignalTypes() { ret.SignalTypes = append(ret.SignalTypes, *CreateXmlSignalType(t)) } for _, t := range l.NodeTypes() { ret.NodeTypes = append(ret.NodeTypes, *CreateXmlNodeType(t)) } return ret }