def write_provided_intf(self, file): for c in self.m_components: for p in c.ports(): if p.provided() == True: file.write('/* Provided port %s: %s v%u.%u */\n' % (p.name(), p.interface(), p.versionMajor(), p.versionMinor())) intf = match.interface(self.m_interfaces, p.interface(), p.versionMajor(), p.versionMinor()) latest = match.latest_interface(self.m_interfaces, p.interface()) if intf == latest: name = self.base_name_interface(intf) else: name = self.name_interface(intf) file.write('const %s_t %s = {\n' % (name, self.name_port(p))) file.write(' XC_INTERFACE_INIT (\n') file.write(' "%s", /* name */\n' % (intf.name())) file.write(' %u, /* major version */\n' % (intf.versionMajor())) file.write(' %u /* minor version */\n' % (intf.versionMinor())) file.write(' )') for m in intf.methods(): file.write(',\n') file.write(' __queue_%s' % (self.name_provided_method(p, m))) file.write('\n};\n\n')
def write_provided_intf (self, file): for c in self.m_components: for p in c.ports(): if p.provided() == True: file.write ('/* Provided port %s: %s v%u.%u */\n'%( p.name(), p.interface(), p.versionMajor(), p.versionMinor())); intf = match.interface (self.m_interfaces, p.interface(), p.versionMajor(), p.versionMinor()); latest = match.latest_interface (self.m_interfaces, p.interface()); if intf == latest: name = self.base_name_interface(intf); else: name = self.name_interface(intf); file.write ('const %s_t %s = {\n'%(name, self.name_port (p))); file.write (' XC_INTERFACE_INIT (\n'); file.write (' "%s", /* name */\n'%(intf.name())); file.write (' %u, /* major version */\n'%(intf.versionMajor())); file.write (' %u /* minor version */\n'%(intf.versionMinor())); file.write (' )'); for m in intf.methods(): file.write (',\n'); file.write (' __queue_%s'%(self.name_provided_method(p,m))); file.write ('\n};\n\n');
def write_switch_aliases (self, file): inames = {}; for i in self.m_interfaces: if not i.name() in inames: latest = match.latest_interface (self.m_interfaces, i.name()); if latest is not None: file.write ('\n/* %s: default version typedef to %u.%u */\n'%( i.name(), latest.versionMajor(), latest.versionMinor())); file.write ('#define %s_NAME "%s"\n'%(string.upper(self.base_name_interface(latest)), latest.name())); file.write ('#define %s_VERSION_MAJOR %u\n'%(string.upper(self.base_name_interface(latest)), latest.versionMajor())); file.write ('#define %s_VERSION_MINOR %u\n'%(string.upper(self.base_name_interface(latest)), latest.versionMinor())); file.write ('typedef %s_t %s_t;\n'%( self.name_interface(latest), self.base_name_interface(latest))); inames[i.name()] = latest;
def write_switch_aliases(self, file): inames = {} for i in self.m_interfaces: if not i.name() in inames: latest = match.latest_interface(self.m_interfaces, i.name()) if latest is not None: file.write( '\n/* %s: default version typedef to %u.%u */\n' % (i.name(), latest.versionMajor(), latest.versionMinor())) file.write('#define %s_NAME "%s"\n' % (string.upper( self.base_name_interface(latest)), latest.name())) file.write('#define %s_VERSION_MAJOR %u\n' % (string.upper(self.base_name_interface(latest)), latest.versionMajor())) file.write('#define %s_VERSION_MINOR %u\n' % (string.upper(self.base_name_interface(latest)), latest.versionMinor())) file.write('typedef %s_t %s_t;\n' % (self.name_interface(latest), self.base_name_interface(latest))) inames[i.name()] = latest