Changeset 8046

Show
Ignore:
Timestamp:
07/17/08 11:26:35 (5 years ago)
Author:
stedwar2
Message:

Merge of changes from branch:
jsnyder/ComponentProject/WaveDev/wavedev
Including all changes from revisions:7412-8044
Undoing broken merge in 8045.

Location:
ossiedev/trunk/tools/WaveDev/wavedev
Files:
12 modified
11 copied

Legend:

Unmodified
Added
Removed
  • ossiedev/trunk/tools/WaveDev/wavedev/ComponentClass.py

    r5886 r8046  
    1717## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1818 
    19 import commands 
    20 # UUID Generator 
    21 def uuidgen(): 
    22    return commands.getoutput('uuidgen -t') 
     19from uuidgen import uuidgen 
    2320 
    2421# Component Class 
     
    4239    self.properties = [] 
    4340    self.description = description 
    44    
     41 
    4542  def __getitem__(self,i): 
    4643      return self.connections[i] 
    47    
     44 
    4845  def setUUID(self): 
    4946      self.uuid = uuidgen() 
    50        
     47 
    5148  def changeName(self,newname): 
    5249      self.name = newname 
     
    6865    if in_dev != None: 
    6966      self.Devices.append(in_comp) 
    70      
     67 
    7168 
    7269class Port: 
     
    8683    def __init__(self, LP, RP, RC): 
    8784        self.localPort = LP 
    88         self.remotePort = RP  
     85        self.remotePort = RP 
    8986        self.remoteComp = RC 
    90          
     87 
    9188class Interface: 
    9289    def __init__(self,name,nameSpace="standardInterfaces",operations=[],filename="",fullpath=""): 
     
    9693        self.filename = filename    #does not include the '.idl' suffix 
    9794        self.fullpath = fullpath 
    98          
     95 
    9996    def __eq__(self,other): 
    100         if isinstance(other, Interface):         
     97        if isinstance(other, Interface): 
    10198            return (other.nameSpace == self.nameSpace ) and (other.name == self.name) 
    10299        else: 
    103100            return False 
    104          
     101 
    105102    def __ne__(self,other): 
    106103        if isinstance(other, Interface): 
     
    109106            return True 
    110107 
    111          
     108 
    112109class Operation: 
    113110    def __init__(self,name,returnType,params=[]): 
     
    116113        self.cxxReturnType = '' 
    117114        self.params = [] 
    118          
     115 
    119116class Param: 
    120117    def __init__(self,name,dataType='',direction=''): 
    121         """  
     118        """ 
    122119        Exampleinterface complexShort { 
    123120            void pushPacket(in PortTypes::ShortSequence I, in PortTypes::ShortSequence Q); 
     
    129126        self.cxxType = "" 
    130127        self.direction = direction  # Flow of data: 'in' 
    131          
     128 
    132129class Property: 
    133130    def __init__(self,elementType,name,mode,description=''): 
     
    136133        self.mode = mode 
    137134        self.id = 'DCE:' + uuidgen() 
    138          
     135 
    139136class SimpleProperty(Property): 
    140137    def __init__(self,name,mode,type,description='',value=None,defaultValue=None,units=None, 
     
    142139        Property.__init__(self,"Simple",name,mode,description) 
    143140        self.type = type 
    144         self.description = description    
     141        self.description = description 
    145142        self.value = value 
    146143        self.defaultValue = defaultValue 
     
    162159        self.kind = kind 
    163160        self.action = action 
    164      
    165      
     161 
     162 
  • ossiedev/trunk/tools/WaveDev/wavedev/ComponentFrame.py

    r7517 r8046  
    3737    return CompFrame(parent) 
    3838 
    39 [wxID_COMPFRAME, wxID_COMPFRAMEACECHECKBOX, wxID_COMPFRAMETIMINGCHECKBOX, wxID_COMPFRAMEADDPORTBTN,  
    40  wxID_COMPFRAMEADDPROP, wxID_COMPFRAMEASSEMBLYCCHECKBOX,  
    41  wxID_COMPFRAMECLOSEBTN, wxID_COMPFRAMECOMPNAMEBOX, wxID_COMPFRAMECOMPDESCRBOX,  
    42  wxID_COMPFRAMEDEVICECHOICE, wxID_COMPFRAMENODECHOICE, wxID_COMPFRAMEPORTBOX,  
    43  wxID_COMPFRAMEPROPLIST, wxID_COMPFRAMEREMOVEBTN, wxID_COMPFRAMEREMOVEPROP,  
    44  wxID_COMPFRAMESTATICTEXT1, wxID_COMPFRAMESTATICTEXT2,  
    45  wxID_COMPFRAMESTATICTEXT3, wxID_COMPFRAMESTATICTEXT4,  
     39[wxID_COMPFRAME, wxID_COMPFRAMEACECHECKBOX, wxID_COMPFRAMETIMINGCHECKBOX, wxID_COMPFRAMEADDPORTBTN, 
     40 wxID_COMPFRAMEADDPROP, wxID_COMPFRAMEASSEMBLYCCHECKBOX, 
     41 wxID_COMPFRAMECLOSEBTN, wxID_COMPFRAMECOMPNAMEBOX, wxID_COMPFRAMECOMPDESCRBOX, 
     42 wxID_COMPFRAMEDEVICECHOICE, wxID_COMPFRAMENODECHOICE, wxID_COMPFRAMEPORTBOX, 
     43 wxID_COMPFRAMEPROPLIST, wxID_COMPFRAMEREMOVEBTN, wxID_COMPFRAMEREMOVEPROP, 
     44 wxID_COMPFRAMESTATICTEXT1, wxID_COMPFRAMESTATICTEXT2, 
     45 wxID_COMPFRAMESTATICTEXT3, wxID_COMPFRAMESTATICTEXT4, 
    4646 wxID_COMPFRAMESTATICTEXT5, wxID_COMPFRAMESTATICTEXT6, 
    47  wxID_COMPFRAMESTATICTEXT7, wxID_COMPFRAMESTATICTEXT8, wxID_COMPFRAMESTATUSBARCOMPONENT,  
     47 wxID_COMPFRAMESTATICTEXT7, wxID_COMPFRAMESTATICTEXT8, wxID_COMPFRAMESTATUSBARCOMPONENT, 
    4848 wxID_COMPFRAMESTATICLINE1, wxID_COMPFRAMETEMPLATECHOICE, 
    4949] = [wx.NewId() for _init_ctrls in range(26)] 
    5050 
    51 [wxID_COMPFRAMEMENUFILENEW, wxID_COMPFRAMEMENUFILEOPEN,  
    52  wxID_COMPFRAMEMENUFILESAVE, wxID_COMPFRAMEMENUFILESAVEAS,  
     51[wxID_COMPFRAMEMENUFILENEW, wxID_COMPFRAMEMENUFILEOPEN, 
     52 wxID_COMPFRAMEMENUFILESAVE, wxID_COMPFRAMEMENUFILESAVEAS, 
    5353] = [wx.NewId() for _init_coll_menuFile_Items in range(4)] 
    5454 
    55 [wxID_COMPFRAMEPORTBOXPOPUPADD, wxID_COMPFRAMEPORTBOXPOPUPEXPAND,  
    56  wxID_COMPFRAMEPORTBOXPOPUPREMOVE,  
     55[wxID_COMPFRAMEPORTBOXPOPUPADD, wxID_COMPFRAMEPORTBOXPOPUPEXPAND, 
     56 wxID_COMPFRAMEPORTBOXPOPUPREMOVE, 
    5757] = [wx.NewId() for _init_coll_portBoxPopup_Items in range(3)] 
    5858 
    59 [wxID_COMPFRAMEPROPLISTPOPUPADD, wxID_COMPFRAMEPROPLISTPOPUPEDIT,  
    60  wxID_COMPFRAMEPROPLISTPOPUPREMOVE,  
     59[wxID_COMPFRAMEPROPLISTPOPUPADD, wxID_COMPFRAMEPROPLISTPOPUPEDIT, 
     60 wxID_COMPFRAMEPROPLISTPOPUPREMOVE, 
    6161] = [wx.NewId() for _init_coll_propListPopup_Items in range(3)] 
    6262 
     
    155155 
    156156        self.portBoxPopup = wx.Menu(title='') 
    157          
     157 
    158158        self.propListPopup = wx.Menu(title='') 
    159159 
     
    277277 
    278278        self.staticText3.SetFont(wx.Font(8,wx.SWISS,wx.NORMAL,wx.BOLD,True,u'Sans')) 
    279          
     279 
    280280        self.nodeChoice = wx.Choice(choices=[], id=wxID_COMPFRAMENODECHOICE, 
    281281              name=u'nodeChoice', parent=self, pos=wx.Point(453, 60), 
     
    291291              label=u'Device', name='staticText5', parent=self, 
    292292              pos=wx.Point(384, 98), size=wx.Size(51, 17), style=0) 
    293          
     293 
    294294        self.staticText6 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT6, 
    295295              label=u'Component Generation Options', name='staticText6', parent=self, 
    296296              pos=wx.Point(634, 24), size=wx.Size(100, 35), style=wx.TE_BESTWRAP | wx.TE_MULTILINE) 
    297297        self.staticText6.SetFont(wx.Font(8,wx.SWISS,wx.NORMAL,wx.BOLD,True,u'Sans')) 
    298          
     298 
    299299        self.staticText7 = wx.StaticText(id=wxID_COMPFRAMESTATICTEXT7, 
    300300              label=u'Template', name='staticText7', parent=self, 
    301301              pos=wx.Point(634, 65), size=wx.Size(222, 17), style=0) 
    302          
     302 
    303303        self.propList = wx.ListView(id=wxID_COMPFRAMEPROPLIST, name=u'propList', 
    304304              parent=self, pos=wx.Point(40, 320), size=wx.Size(312, 160), 
     
    313313              name='staticLine1', parent=self, pos=wx.Point(610, 17), 
    314314              size=wx.Size(1, 200), style=wx.LI_VERTICAL) 
    315          
    316         self.templateChoice = wx.Choice(choices=_availableTemplates,  
     315 
     316        self.templateChoice = wx.Choice(choices=_availableTemplates, 
    317317              id=wxID_COMPFRAMETEMPLATECHOICE, 
    318318              name=u'templateChoice', parent=self, pos=wx.Point(703, 60), 
     
    321321        self.templateChoice.Bind(wx.EVT_CHOICE, self.OnTemplateChoiceChoice, 
    322322              id=wxID_COMPFRAMETEMPLATECHOICE) 
    323                
     323 
    324324    def __init__(self, parent): 
    325325        # Constructor for ComponentFrame 
    326         availableTemplates = commands.getoutput("cd generate/templates; ls -I __init__.py -I __init__.pyc") 
     326        availableTemplates = commands.getoutput("cd " + self.wavedevPath + "generate/templates; ls -I __init__.py -I __init__.pyc") 
    327327        availableTemplates = availableTemplates.split() 
    328328        self._init_ctrls(parent,availableTemplates) 
    329          
     329 
    330330        self.templateChoice.SetSelection(0) 
    331331        self.template = self.templateChoice.GetStringSelection() 
    332           
     332 
    333333        self.parent = parent 
    334                 
     334 
    335335        self.saveComponentPath = None 
    336336        self.calledByParent = False 
    337          
     337 
     338        self.wavedevPath = ''  # Should really be computed from the install path 
     339 
    338340        if parent == None:  #OSSIE Component Editor being run in stand-alone mode 
    339341            self.menuComponent.Enable(wxID_COMPFRAMEMENUCOMPONENTGENERATE,True) 
     
    343345            self.menuComponent.Enable(wxID_COMPFRAMEMENUCOMPONENTGENERATE,False) 
    344346            self.compDescrBox.Enable(False) 
     347            self.wavedevPath = parent.wavedevPath 
    345348 
    346349        self.Available_Ints = [] 
    347350        self.importStandardIdl() 
    348         
    349          
     351 
     352 
    350353    def OnCompFrameActivate(self, event): 
    351354        if self.calledByParent == True: 
     
    353356            self.displayPorts() 
    354357            self.displayProps() 
    355              
     358 
    356359            if self.active_comp.ace == True: 
    357360                self.ACEcheckBox.SetValue(True) 
    358361            else: 
    359362                self.ACEcheckBox.SetValue(False) 
    360              
     363 
    361364            if self.active_comp.timing == True: 
    362365                self.TimingcheckBox.SetValue(True) 
    363366            else: 
    364367                self.TimingcheckBox.SetValue(False) 
    365              
     368 
    366369            if self.active_comp.AssemblyController == True: 
    367370                self.AssemblyCcheckBox.SetValue(True) 
    368371            else: 
    369372                self.AssemblyCcheckBox.SetValue(False) 
    370              
     373 
    371374            if self.active_comp.generate == False: 
    372375                self.AddPortBtn.Enable(False) 
     
    383386                self.ACEcheckBox.Enable(True) 
    384387                self.TimingcheckBox.Enable(True) 
    385              
     388 
    386389            self.compNameBox.Clear() 
    387390            self.compNameBox.WriteText(self.active_comp.name) 
     
    389392            self.compDescrBox.Clear() 
    390393            self.compDescrBox.WriteText(self.active_comp.description) 
    391              
     394 
    392395            if self.active_comp.type != 'resource': 
    393396                self.deviceChoice.Clear() 
     
    398401                self.nodeChoice.Enable(True) 
    399402                self.displayPlatformInfo() 
    400              
     403 
    401404            self.menuFile.Enable(wxID_COMPFRAMEMENUFILENEW,False) 
    402405            self.menuFile.Enable(wxID_COMPFRAMEMENUFILEOPEN,False) 
    403              
     406 
    404407            self.calledByParent = False 
    405              
    406              
     408 
     409 
    407410################################################################################ 
    408411## File Menu / Frame Functionality 
     
    437440            if tmpdir == "~": 
    438441                tmpdir = "/home" 
    439                  
     442 
    440443        tmpwildcard = "Component Files (*.cmp)|*.cmp" 
    441444        dlg = wx.FileDialog(self, "Choose a file", tmpdir, "", tmpwildcard, wx.OPEN) 
     
    449452        finally: 
    450453            dlg.Destroy() 
    451              
     454 
    452455        f = open(tmpPath,'r') 
    453456        tmpObject = cPickle.load(f) 
     
    462465            if tempLn == '': 
    463466                errorMsg(self,'Please enter a component name first') 
    464                 return             
     467                return 
    465468            self.active_comp.name = tempLn 
    466469 
     
    470473                return 
    471474            self.active_comp.description = tempDescr 
    472              
     475 
    473476            if len(self.homeDir) > 0: 
    474477                tmpdir = self.homeDir 
     
    477480                if tmpdir == "~": 
    478481                    tmpdir = "/home" 
    479                     
     482 
    480483            dlg = wx.FileDialog(self, "Choose a file", tmpdir, tempLn + '.cmp', "Component File (*.cmp)|*.cmp", wx.SAVE) 
    481484            try: 
     
    488491            finally: 
    489492                dlg.Destroy() 
    490              
     493 
    491494        f = open(self.saveComponentPath,'w') 
    492         cPickle.dump(('component',self.active_comp),f)  
     495        cPickle.dump(('component',self.active_comp),f) 
    493496 
    494497    def ComponentOpen(self,newPath,newComp): 
     
    506509                finally: 
    507510                    dlg.Destroy() 
    508              
     511 
    509512            self.saveComponentPath = newPath 
    510              
     513 
    511514        self.active_comp = newComp 
    512515        self.displayPorts() 
    513516        self.displayProps() 
    514          
     517 
    515518        if self.active_comp.ace == True: 
    516519            self.ACEcheckBox.SetValue(True) 
     
    524527        else: 
    525528            self.TimingcheckBox.SetValue(False) 
    526          
     529 
    527530        if self.active_comp.AssemblyController == True: 
    528531            self.AssemblyCcheckBox.SetValue(True) 
    529532        else: 
    530533            self.AssemblyCcheckBox.SetValue(False) 
    531          
     534 
    532535        if self.active_comp.generate == False: 
    533536            self.AddPortBtn.Enable(False) 
     
    536539            self.AddPortBtn.Enable(True) 
    537540            self.RemoveBtn.Enable(True) 
    538          
     541 
    539542        self.compNameBox.Clear() 
    540543        self.compNameBox.WriteText(self.active_comp.name) 
    541         
     544 
    542545        self.compDescrBox.Clear() 
    543         self.compDescrBox.WriteText(self.active_comp.implementation.description)  
    544      
     546        self.compDescrBox.WriteText(self.active_comp.implementation.description) 
     547 
    545548    def OnCloseBtnButton(self, event): 
    546549        if self.parent == None: 
     
    551554        if tempLn == '': 
    552555            errorMsg(self,'Please enter a component name first') 
    553             return    
     556            return 
    554557 
    555558        for c in self.parent.active_wave.components: 
     
    557560                errorMsg(self,'Invalid name - a component by that name already exists') 
    558561                return 
    559          
     562 
    560563        #Component names with spaces do not work 
    561564        if tempLn.find(' ') != -1: 
    562565            errorMsg(self,'Resource names can not have spaces in them.\nReplacing spaces with "_".') 
    563566            tempLn = tempLn.replace(' ','_') 
    564              
    565              
     567 
     568 
    566569        self.active_comp.changeName(tempLn) 
    567                  
     570 
    568571        self.MakeModal(False) 
    569572        self.parent.displayComps() 
     
    575578        self.MakeModal(False) 
    576579        if self.parent != None: 
    577             self.parent.displayComps()   
     580            self.parent.displayComps() 
    578581        self.Show(False) 
    579582        event.Skip() 
    580      
    581      
     583 
     584 
    582585################################################################################ 
    583586## Miscellaneous Functionality 
    584587################################################################################ 
    585588 
    586     def importStandardIdl(self):    
     589    def importStandardIdl(self): 
    587590        '''Imports IDL from cf, standardinterfaces, and custominterfaces''' 
    588591        #temporarily change self.parent to self so this works 
    589592        #normally this function looks at the MainFrame - but not in standalone 
    590         changedParent = False   
     593        changedParent = False 
    591594        if self.parent == None: 
    592595            self.parent = self 
    593             changedParent = True      
    594              
     596            changedParent = True 
     597 
    595598        if os.path.isfile(self.parent.ossieIncludePath + "cf.idl"): 
    596599            cfIdl_file = self.parent.ossieIncludePath + "cf.idl" 
     
    605608        standard_idl_list = os.listdir(self.parent.stdIdlPath) 
    606609 
    607         try:    
     610        try: 
    608611            custom_idl_list = os.listdir(self.parent.customIdlPath) 
    609         except OSError: # this will occur if customIdlPath was never set  
     612        except OSError: # this will occur if customIdlPath was never set 
    610613                        # as a result of customInterfaces not being found 
    611614            custom_idl_list = [] 
     
    615618            errorMsg(self.parent,tmpstr) 
    616619            return 
    617          
     620 
    618621        # Add the CF interfaces first - in case another file includes them, we 
    619622        # don't want them asscociated with anything other than cf.idl 
    620623        self.Available_Ints.extend(importIDL.getInterfaces(cfIdl_file)) 
    621          
     624 
    622625        # import standard interfaces 
    623626        for standard_idl_file in standard_idl_list: 
     
    629632                # ignore non idl files 
    630633                continue 
    631              
     634 
    632635            tempInts = importIDL.getInterfaces(self.parent.stdIdlPath+standard_idl_file) 
    633636            for t in tempInts: 
    634637                if t not in self.Available_Ints: 
    635638                    self.Available_Ints.append(t) 
    636                      
     639 
    637640        # import custom interfaces 
    638641        for custom_idl_file in custom_idl_list: 
     
    644647                # ignore non idl files 
    645648                continue 
    646              
     649 
    647650            tempInts = importIDL.getInterfaces(self.parent.customIdlPath+custom_idl_file) 
    648651            for t in tempInts: 
     
    654657                        self.timing_port = CC.Port('send_timing_report', self.timing_interface, "Uses", "data") 
    655658#                    print "CF.py: " + t.name + "  " + str(len(t.operations)) 
    656                      
     659 
    657660        if changedParent == True: 
    658661            self.parent = None 
     
    693696        usesRoot = self.PortBox.AppendItem(troot,'Uses',image=0) 
    694697        provRoot = self.PortBox.AppendItem(troot,'Provides',image=1) 
    695          
     698 
    696699        for p in self.active_comp.ports: 
    697700            if p.type == 'Uses': 
     
    699702                t1 = self.PortBox.AppendItem(usesRoot,tnm) 
    700703                self.PortBox.SetPyData(t1,p) 
    701                  
     704 
    702705            if p.type == 'Provides': 
    703706                tnm = p.name + "::" + p.interface.name 
     
    715718        finally: 
    716719            dlg.Destroy() 
    717              
     720 
    718721        self.displayPorts() 
    719          
     722 
    720723    def RemovePort(self): 
    721724        if self.active_comp.generate == False: 
     
    728731        finally: 
    729732            dlg.Destroy() 
    730      
     733 
    731734        sn = self.PortBox.GetSelection() 
    732735        if sn == self.PortBox.GetRootItem(): 
     
    740743            ti = self.active_comp.ports.index(tc) 
    741744            del self.active_comp.ports[ti] 
    742          
     745 
    743746        self.displayPorts() 
    744747 
    745748 
    746749    def OnAddPortBtnButton(self, event): 
    747         self.AddPort()     
    748         event.Skip() 
    749          
     750        self.AddPort() 
     751        event.Skip() 
     752 
    750753    def OnRemoveBtnButton(self, event): 
    751754        self.RemovePort() 
     
    762765    def OnPortBoxRightUp(self, event): 
    763766        sn = self.PortBox.GetSelection() 
    764          
     767 
    765768        if sn == self.PortBox.GetRootItem(): 
    766769            self.portBoxPopup.Enable(wxID_COMPFRAMEPORTBOXPOPUPREMOVE,False) 
     
    772775            for x in self.portBoxPopup.GetMenuItems(): 
    773776                x.Enable(True) 
    774                  
     777 
    775778        if self.active_comp.generate == False: 
    776779            self.portBoxPopup.Enable(wxID_COMPFRAMEPORTBOXPOPUPADD,False) 
     
    778781        else: 
    779782            self.portBoxPopup.Enable(wxID_COMPFRAMEPORTBOXPOPUPADD,True) 
    780                      
    781         self.PortBox.PopupMenu(self.portBoxPopup)             
     783 
     784        self.PortBox.PopupMenu(self.portBoxPopup) 
    782785        event.Skip() 
    783786 
     
    790793        event.Skip() 
    791794 
    792      
    793          
     795 
     796 
    794797################################################################################ 
    795798## Deployment Functionality 
     
    799802        if self.parent == None: 
    800803            return 
    801          
     804 
    802805        pos = self.nodeChoice.GetSelection() 
    803806        if pos == wx.NOT_FOUND: 
    804             return  
    805          
     807            return 
     808 
    806809        tmpNode = self.nodeChoice.GetClientData(pos) 
    807          
    808          
     810 
     811 
    809812        self.deviceChoice.Clear() 
    810813        for x in tmpNode.Devices: 
    811814            if x.type == 'executabledevice' or x.type == 'loadabledevice': 
    812815                self.deviceChoice.Append(unicode(x.name),x) 
    813              
     816 
    814817    def displayPlatformInfo(self): 
    815818        if self.parent == None: 
    816819            return 
    817          
     820 
    818821        self.deviceChoice.Clear() 
    819822        self.nodeChoice.Clear() 
    820          
     823 
    821824        for x in self.parent.active_plat.nodes: 
    822825            self.nodeChoice.Append(x.name,x) 
    823          
     826 
    824827        tmpNode = None 
    825         if self.active_comp.device != None:         
     828        if self.active_comp.device != None: 
    826829            for x in self.parent.active_plat.nodes: 
    827830                for d in x.Devices: 
     
    835838                pos = self.deviceChoice.FindString(self.active_comp.device.name) 
    836839                self.deviceChoice.SetSelection(pos) 
    837              
     840 
    838841            else: 
    839842                tmpstr = 'ERROR! Cannot find the ' + self.active_comp.device.name 
    840                 tmpstr += ' device in current Platform configuration.'                 
     843                tmpstr += ' device in current Platform configuration.' 
    841844                tmpstr += '\nSetting device assignment to None.' 
    842845                errorMsg(self,tmpstr) 
     
    846849        pos = self.nodeChoice.GetSelection() 
    847850        if pos == wx.NOT_FOUND: 
    848             return  
     851            return 
    849852        self.displayDevices() 
    850853 
     
    852855        pos = self.deviceChoice.GetSelection() 
    853856        if pos == wx.NOT_FOUND: 
    854             return  
    855          
     857            return 
     858 
    856859        tmpDev = self.deviceChoice.GetClientData(pos) 
    857860        self.active_comp.device = tmpDev 
     
    860863        pos = self.templateChoice.GetSelection() 
    861864        if pos == wx.NOT_FOUND: 
    862             return  
    863          
     865            return 
     866 
    864867        tmpTmpl = self.templateChoice.GetStringSelection() 
    865868        self.template = tmpTmpl 
    866          
    867          
     869 
     870 
    868871    ############################################################################ 
    869872    ## Properties Functionality 
    870     ############################################################################     
     873    ############################################################################ 
    871874    def OnaddPropButton(self, event): 
    872         self.AddProperty()  
    873         event.Skip() 
    874      
     875        self.AddProperty() 
     876        event.Skip() 
     877 
    875878    def OnRemovePropButton(self, event): 
    876879        #sel = self.propList.GetFirstSelected() 
     
    893896                self.propList.SetStringItem(pCount,1,ts) 
    894897            self.propList.SetItemData(pCount,self.active_comp.properties.index(p)) 
    895                  
     898 
    896899    def OnPropListListItemRightClick(self, event): 
    897         self.propList.PopupMenu(self.propListPopup)             
    898         event.Skip() 
    899          
     900        self.propList.PopupMenu(self.propListPopup) 
     901        event.Skip() 
     902 
    900903    def EditProperty(self): 
    901904        sel = self.propList.GetFocusedItem() 
     
    912915        finally: 
    913916            dlg.Destroy() 
    914              
     917 
    915918        self.displayProps() 
    916          
     919 
    917920    def AddProperty(self): 
    918921        dlg = PropertiesDialog.create(self) 
     
    924927        finally: 
    925928            dlg.Destroy() 
    926              
     929 
    927930        self.displayProps() 
    928      
     931 
    929932    def RemoveProperty(self): 
    930933        sel = self.propList.GetFocusedItem() 
     
    943946        self.EditProperty() 
    944947        event.Skip() 
    945          
     948 
    946949    def OnPropsListPopupRemoveMenu(self, event): 
    947950        self.RemoveProperty() 
    948951        event.Skip() 
    949          
     952 
    950953    def OnPropsListPopupAddMenu(self, event): 
    951954        self.AddProperty() 
     
    960963    ############################################################################ 
    961964    def OnMenuComponentGenerateMenu(self, event): 
    962          
     965 
    963966        #select which template to use 
    964967        if self.template == "basic_ports": 
     
    971974            errorMsg(self.parent, self.template + " is not supported in OnMenuComponentGenerateMenu witin the componentFrame") 
    972975            return 
    973   
     976 
    974977        tempLn = self.compNameBox.GetLineText(0) 
    975978        if tempLn == '': 
    976979            errorMsg(self,'Please enter a component name first') 
    977980            return 
    978              
     981 
    979982        self.active_comp.name = tempLn 
    980      
     983 
    981984        tempDescr = self.compDescrBox.GetLineText(0) 
    982985        if tempDescr == '': 
     
    996999        finally: 
    9971000            dlg.Destroy() 
    998          
     1001 
    9991002        if savepath[len(savepath)-1] != '/': 
    10001003            savepath = savepath + '/' 
    1001          
     1004 
    10021005        self.path = savepath 
    10031006        self.path = self.path + self.active_comp.name 
    1004          
     1007 
    10051008        if os.path.exists(self.path) == False: 
    10061009                os.mkdir(self.path) 
    1007                  
    1008                 #if os.path.exists(self.path + '/aclocal.d') == False:    
     1010 
     1011                #if os.path.exists(self.path + '/aclocal.d') == False: 
    10091012                #    os.mkdir(self.path + '/aclocal.d') 
    10101013                #for f in os.listdir('generate/aclocal.d/'): 
     
    10121015                #        shutil.copy('generate/aclocal.d/' + f,self.path + '/aclocal.d') 
    10131016                if self.template != "py_comp": 
    1014                     shutil.copy('generate/reconf',self.path) 
    1015                 shutil.copy('generate/LICENSE',self.path) 
    1016          
     1017                    shutil.copy(self.wavedevPath + 'generate/reconf',self.path) 
     1018                shutil.copy(self.wavedevPath + 'generate/LICENSE',self.path) 
     1019 
    10171020        if self.active_comp.timing: 
    10181021                found_timing = False 
     
    10221025                if not found_timing: 
    10231026                        self.active_comp.ports.append(self.timing_port) 
    1024          
    1025         gen = genStruct.genAll(savepath,None) 
     1027 
     1028        gen = genStruct.genAll(savepath, self.wavedevPath, None) 
    10261029        gen.writeCompMakefile(self.active_comp,self.path) 
    10271030        gen.writeConfAC(self.path, self.active_comp.name, self.active_comp.ace, False, self.installPath) 
    10281031        gen.genCompFiles(self.active_comp) 
    1029          
     1032 
    10301033        component_gen.gen_scd(self.active_comp, savepath) 
    10311034        component_gen.gen_spd(self.active_comp, savepath) 
     
    10471050    wx.InitAllImageHandlers() 
    10481051    application = App() 
    1049      
     1052 
    10501053    application.main.active_comp = CC.Component("component1") 
    10511054    application.main.calledByParent = False 
     
    10571060    else: 
    10581061        application.main.ACEcheckBox.SetValue(False) 
    1059          
     1062 
    10601063    if application.main.active_comp.timing == True: 
    10611064        application.main.TimingcheckBox.SetValue(True) 
    10621065    else: 
    10631066        application.main.TimingcheckBox.SetValue(False) 
    1064        
     1067 
    10651068    application.main.deviceChoice.Enable(False) 
    10661069    application.main.nodeChoice.Enable(False) 
    10671070    application.MainLoop() 
    1068   
    1069  
    1070          
     1071 
     1072 
     1073 
    10711074################################################################################ 
    10721075## If Component Developer is run as a seperate application 
  • ossiedev/trunk/tools/WaveDev/wavedev/MainFrame.py

    r7517 r8046  
    3939    return Frame1(parent) 
    4040 
    41 [wxID_FRAME1, wxID_FRAME1COMPBOX, wxID_FRAME1NODEBOX, wxID_FRAME1RESOURCEBOX,  
    42  wxID_FRAME1SASHWINDOW1, wxID_FRAME1SASHWINDOW2, wxID_FRAME1SASHWINDOW3,  
    43  wxID_FRAME1SASHWINDOW4, wxID_FRAME1SPLITTERWINDOW1,  
    44  wxID_FRAME1SPLITTERWINDOW2, wxID_FRAME1STATICTEXT1, wxID_FRAME1STATICTEXT2,  
     41[wxID_FRAME1, wxID_FRAME1COMPBOX, wxID_FRAME1NODEBOX, wxID_FRAME1RESOURCEBOX, 
     42 wxID_FRAME1SASHWINDOW1, wxID_FRAME1SASHWINDOW2, wxID_FRAME1SASHWINDOW3, 
     43 wxID_FRAME1SASHWINDOW4, wxID_FRAME1SPLITTERWINDOW1, 
     44 wxID_FRAME1SPLITTERWINDOW2, wxID_FRAME1STATICTEXT1, wxID_FRAME1STATICTEXT2, 
    4545 wxID_FRAME1STATICTEXT3, wxID_FRAME1STATUSBAR1, wxID_FRAME1WAVENAMEBOX, 
    46  wxID_REFRESHRESOURCEBTN, wxID_FRAME1COMPDESCRBOX, wxID_FRAME1STATICTEXT4  
     46 wxID_REFRESHRESOURCEBTN, wxID_FRAME1COMPDESCRBOX, wxID_FRAME1STATICTEXT4 
    4747] = [wx.NewId() for _init_ctrls in range(18)] 
    4848 
    49 [wxID_FRAME1MENUFILEEXIT, wxID_FRAME1MENUFILENEW, wxID_FRAME1MENUFILEOPEN,  
    50  wxID_FRAME1MENUFILESAVE, wxID_FRAME1MENUFILESAVEPLATFORM,  
    51  wxID_FRAME1MENUFILESAVEPLATFORMAS, wxID_FRAME1MENUFILESAVEWAVEFORM,  
    52  wxID_FRAME1MENUFILESAVEWAVEFORMAS, wxID_FRAME1MENUFILESAVE_AS,  
     49[wxID_FRAME1MENUFILEEXIT, wxID_FRAME1MENUFILENEW, wxID_FRAME1MENUFILEOPEN, 
     50 wxID_FRAME1MENUFILESAVE, wxID_FRAME1MENUFILESAVEPLATFORM, 
     51 wxID_FRAME1MENUFILESAVEPLATFORMAS, wxID_FRAME1MENUFILESAVEWAVEFORM, 
     52 wxID_FRAME1MENUFILESAVEWAVEFORMAS, wxID_FRAME1MENUFILESAVE_AS, 
    5353] = [wx.NewId() for _init_coll_menuFile_Items in range(9)] 
    5454 
    55 [wxID_FRAME1COMPBOXPOPUPCONNECT, wxID_FRAME1COMPBOXPOPUPEDIT,  
    56  wxID_FRAME1COMPBOXPOPUPEXPAND, wxID_FRAME1COMPBOXPOPUPREFRESH,  
    57  wxID_FRAME1COMPBOXPOPUPREMOVE, wxID_FRAME1COMPBOXPOPUPRENAME,  
    58  wxID_FRAME1COMPBOXPOPUPSET_AC,  
     55[wxID_FRAME1COMPBOXPOPUPCONNECT, wxID_FRAME1COMPBOXPOPUPEDIT, 
     56 wxID_FRAME1COMPBOXPOPUPEXPAND, wxID_FRAME1COMPBOXPOPUPREFRESH, 
     57 wxID_FRAME1COMPBOXPOPUPREMOVE, wxID_FRAME1COMPBOXPOPUPRENAME, 
     58 wxID_FRAME1COMPBOXPOPUPSET_AC, 
    5959] = [wx.NewId() for _init_coll_compBoxPopup_Items in range(7)] 
    6060 
    61 [wxID_FRAME1MENUWAVEFORMACESUPPORT, wxID_FRAME1MENUWAVEFORMADDCOMP,  
    62  wxID_FRAME1MENUWAVEFORMCONNECTCOMP, wxID_FRAME1MENUWAVEFORMEDITCOMP,  
    63  wxID_FRAME1MENUWAVEFORMGENWAV, wxID_FRAME1MENUWAVEFORMREMOVECOMP,  
     61[wxID_FRAME1MENUWAVEFORMACESUPPORT, wxID_FRAME1MENUWAVEFORMADDCOMP, 
     62 wxID_FRAME1MENUWAVEFORMCONNECTCOMP, wxID_FRAME1MENUWAVEFORMEDITCOMP, 
     63 wxID_FRAME1MENUWAVEFORMGENWAV, wxID_FRAME1MENUWAVEFORMREMOVECOMP, 
    6464] = [wx.NewId() for _init_coll_menuWaveform_Items in range(6)] 
    6565 
    66 [wxID_FRAME1MENUHELPABOUT, wxID_FRAME1MENUHELPSAMPLEWAVEFORM,  
     66[wxID_FRAME1MENUHELPABOUT, wxID_FRAME1MENUHELPSAMPLEWAVEFORM, 
    6767] = [wx.NewId() for _init_coll_menuHelp_Items in range(2)] 
    6868 
     
    7373] = [wx.NewId() for _init_coll_resourceBoxPopup_Items in range(5)] 
    7474 
    75 [wxID_FRAME1NODEBOXPOPUPADDNODE, wxID_FRAME1NODEBOXPOPUPLOADNODE, wxID_FRAME1NODEBOXPOPUPEXPAND,  
    76  wxID_FRAME1NODEBOXPOPUPREFRESH, wxID_FRAME1NODEBOXPOPUPREMOVE, wxID_FRAME1NODEBOXPOPUPGENERATE,  
    77  wxID_FRAME1NODEBOXPOPUPCONNECT, wxID_FRAME1NODEBOXPOPUPRENAME,  
     75[wxID_FRAME1NODEBOXPOPUPADDNODE, wxID_FRAME1NODEBOXPOPUPLOADNODE, wxID_FRAME1NODEBOXPOPUPEXPAND, 
     76 wxID_FRAME1NODEBOXPOPUPREFRESH, wxID_FRAME1NODEBOXPOPUPREMOVE, wxID_FRAME1NODEBOXPOPUPGENERATE, 
     77 wxID_FRAME1NODEBOXPOPUPCONNECT, wxID_FRAME1NODEBOXPOPUPRENAME, 
    7878] = [wx.NewId() for _init_coll_nodeBoxPopup_Items in range(8)] 
    7979 
    80 [wxID_FRAME1NEWMENUNEWPLATFORM, wxID_FRAME1NEWMENUNEWPROJECT,  
    81  wxID_FRAME1NEWMENUNEWWAVEFORM,  
     80[wxID_FRAME1NEWMENUNEWPLATFORM, wxID_FRAME1NEWMENUNEWPROJECT, 
     81 wxID_FRAME1NEWMENUNEWWAVEFORM, 
    8282] = [wx.NewId() for _init_coll_newMenu_Items in range(3)] 
    8383 
     
    432432        self.nodeBox.Bind(wx.EVT_TREE_END_LABEL_EDIT, 
    433433              self.OnNodeBoxTreeEndLabelEdit, id=wxID_FRAME1NODEBOX) 
    434          
     434 
    435435        self.RefreshResourceBtn = wx.Button(id=wxID_REFRESHRESOURCEBTN, label='Refresh', 
    436436              name='RefreshResourceBtn', parent=self, pos=wx.Point(170, 40), 
     
    460460        # Constructor for MainFrame 
    461461        self._init_ctrls(parent) 
    462          
     462 
    463463        #read in the configuration information 
    464464        LoadConfiguration(self) 
    465          
     465 
    466466        #setup the environment 
    467467        self.active_comp = None 
    468         self.CompFrame = ComponentFrame.create(self)     
     468        self.CompFrame = ComponentFrame.create(self) 
    469469        self.active_wave = WaveformClass.Waveform() 
    470470        self.active_plat = PlatformClass.Platform() 
     
    475475        self.saveProjectPath = None 
    476476        self.description = None 
    477          
     477        self.wavedevPath = ''  # Should really be computed from the install path 
     478 
    478479################################################################################ 
    479480## File/Help Menu Functionality 
     
    502503            finally: 
    503504                dlg.Destroy() 
    504              
     505 
    505506            if sflag == True: 
    506507                tempLn = self.waveNameBox.GetLineText(0) 
     
    526527                    finally: 
    527528                        dlg.Destroy() 
    528                          
     529 
    529530                else: 
    530531                    if self.saveProjectPath != None: 
     
    534535                        if self.ProjectSave(True) == False: 
    535536                            return 
    536                      
     537 
    537538        self.active_wave = WaveformClass.Waveform() 
    538         self.active_plat = PlatformClass.Platform()       
     539        self.active_plat = PlatformClass.Platform() 
    539540        self.saveProjectPath = None 
    540541        self.waveNameBox.Clear() 
    541542        self.displayComps() 
    542543        self.displayNodes() 
    543                      
    544                  
     544 
     545 
    545546        event.Skip() 
    546547 
     
    562563            finally: 
    563564                dlg.Destroy() 
    564              
     565 
    565566            if sflag == True: 
    566567                tempLn = self.waveNameBox.GetLineText(0) 
     
    586587                    finally: 
    587588                        dlg.Destroy() 
    588                          
     589 
    589590                else: 
    590591                    if self.saveWaveformPath != None: 
     
    594595                        if self.WaveformSave(True) == False: 
    595596                            return 
    596                      
     597 
    597598        self.active_wave = WaveformClass.Waveform() 
    598599        self.saveWaveformPath = None 
    599600        self.waveNameBox.Clear() 
    600601        self.displayComps() 
    601              
     602 
    602603        event.Skip() 
    603604 
     
    619620            finally: 
    620621                dlg.Destroy() 
    621              
    622             if sflag == True:                   
     622 
     623            if sflag == True: 
    623624                if self.savePlatformPath != None: 
    624625                    tmpstr = 'Do you want to overwrite the existing platform file?\n' 
     
    640641                    finally: 
    641642                        dlg.Destroy() 
    642                  
     643 
    643644                else: 
    644645                    if self.PlatformSave(True) == False: 
    645646                        return 
    646                      
     647 
    647648        self.active_plat = PlatformClass.Platform() 
    648649        self.savePlatformPath = None 
    649650        self.displayNodes() 
    650              
     651 
    651652        event.Skip() 
    652653 
     
    658659            if tmpdir == "~": 
    659660                tmpdir = "/home" 
    660          
     661 
    661662        tmpwildcard = "Project Files (*.owd)|*.owd|Waveform Designs (*.sca)|*.sca|Platform Layouts (*.plt)|*.plt" 
    662663        dlg = wx.FileDialog(self, "Choose a file", tmpdir, "", tmpwildcard, wx.OPEN) 
     
    670671        finally: 
    671672            dlg.Destroy() 
    672              
     673 
    673674        f = open(tmpPath,'r') 
    674675        tmpObject = cPickle.load(f) 
     
    679680        elif tmpObject[0] == 'project': 
    680681            self.ProjectOpen(tmpPath,tmpObject[1],tmpObject[2]) 
    681          
     682 
    682683        event.Skip() 
    683684 
     
    704705                finally: 
    705706                    dlg.Destroy() 
    706                      
     707 
    707708            else: 
    708709                self.ProjectSave(False) 
    709710        else: 
    710711            self.ProjectSave(False) 
    711              
     712 
    712713        event.Skip() 
    713714 
     
    738739                finally: 
    739740                    dlg.Destroy() 
    740                      
     741 
    741742            else: 
    742743                self.WaveformSave(False) 
    743744        else: 
    744745            self.WaveformSave(False) 
    745      
     746 
    746747        event.Skip() 
    747748 
     
    769770                return False 
    770771            self.active_wave.name = tempLn 
    771              
     772 
    772773            if len(self.homeDir) > 0: 
    773774                tmpdir = self.homeDir 
    774775            else: 
    775776                tmpdir = os.path.expanduser("~") 
    776                  
     777 
    777778            dlg = wx.FileDialog(self, "Save As", tmpdir, tempLn + '.owd', "Project File (*.owd)|*.owd", wx.SAVE) 
    778779            try: 
     
    785786            finally: 
    786787                dlg.Destroy() 
    787              
     788 
    788789        f = open(self.saveProjectPath,'w') 
    789         cPickle.dump(('project',self.active_wave,self.active_plat),f)  
    790          
     790        cPickle.dump(('project',self.active_wave,self.active_plat),f) 
     791 
    791792        return True 
    792793 
     
    798799                return False 
    799800            self.active_wave.name = tempLn 
    800              
     801 
    801802            if len(self.homeDir) > 0: 
    802803                tmpdir = self.homeDir 
    803804            else: 
    804805                tmpdir = os.path.expanduser("~") 
    805                  
     806 
    806807            dlg = wx.FileDialog(self, "Save As", tmpdir, tempLn + '.sca', "*.sca", wx.SAVE) 
    807808            try: 
     
    814815            finally: 
    815816                dlg.Destroy() 
    816              
     817 
    817818        f = open(self.saveWaveformPath,'w') 
    818         cPickle.dump(('waveform',self.active_wave),f)      
    819          
     819        cPickle.dump(('waveform',self.active_wave),f) 
     820 
    820821        return True 
    821      
     822 
    822823    def PlatformSave(self,saveasFlag): 
    823         if saveasFlag == True or self.savePlatformPath == None:         
     824        if saveasFlag == True or self.savePlatformPath == None: 
    824825            if self.active_plat.name != "": 
    825826                tmpname = self.active_plat.name 
    826827            else: 
    827828                tmpname = 'Platform1' 
    828                  
     829 
    829830            if len(self.homeDir) > 0: 
    830831                tmpdir = self.homeDir 
    831832            else: 
    832833                tmpdir = os.path.expanduser("~") 
    833              
     834 
    834835            dlg = wx.FileDialog(self, "Save As", tmpdir, tmpname + '.plt', "Platform File (*.plt)|*.plt", wx.SAVE) 
    835836            try: 
     
    842843            finally: 
    843844                dlg.Destroy() 
    844              
     845 
    845846        f = open(self.savePlatformPath,'w') 
    846         cPickle.dump(('platform',self.active_plat),f)   
    847          
     847        cPickle.dump(('platform',self.active_plat),f) 
     848 
    848849        return True 
    849      
     850 
    850851    def WaveformOpen(self,newPath,newWav): 
    851852        if newPath != None: 
     
    862863                finally: 
    863864                    dlg.Destroy() 
    864              
     865 
    865866            self.saveWaveformPath = newPath 
    866              
     867 
    867868        self.active_wave = newWav 
    868          
     869 
    869870        # We must create new UUIDs for each instance and copy the file uuid from 
    870871        # the base component to the instance 
     
    878879            if c.generate == False and found == False: 
    879880                errorMsg(self,"Could not find " + c.baseName + " which " + c.name + " is an instance of.") 
    880                  
    881          
     881 
     882 
    882883        #Because device assignments are stored as python objects in each component 
    883884        #we must refresh the assignment with the available platform devices 
    884          
     885 
    885886        for c in self.active_wave.components: 
    886887            if c.device == None: 
     
    899900                errorMsg(self,tmpstr) 
    900901                c.device = None 
    901          
     902 
    902903        self.waveNameBox.Clear() 
    903904        self.waveNameBox.WriteText(self.active_wave.name) 
    904         self.displayComps()     
    905          
     905        self.displayComps() 
     906 
    906907        if self.active_wave.ace == True: 
    907908            self.menuWaveform.Check(wxID_FRAME1MENUWAVEFORMACESUPPORT,True) 
     
    909910        else: 
    910911            self.menuWaveform.Check(wxID_FRAME1MENUWAVEFORMACESUPPORT,False) 
    911             #self.ACEcheckBox.SetValue(False)  
    912      
     912            #self.ACEcheckBox.SetValue(False) 
     913 
    913914    def PlatformOpen(self,newPath,newPlat): 
    914915        if newPath != None: 
     
    925926                finally: 
    926927                    dlg.Destroy() 
    927              
     928 
    928929            self.savePlatformPath = newPath 
    929              
     930 
    930931        self.active_plat = newPlat 
    931          
     932 
    932933 
    933934        # NOTE: The following comment does not hold true now that the nodes are installed 
     
    947948                if found == False: 
    948949                    errorMsg(self,"Could not find " + d.baseName + " which " + d.name + " is an instance of.") 
    949          
     950 
    950951        self.displayNodes() 
    951      
    952      
     952 
     953 
    953954    def ProjectOpen(self,newPath,newWav,newPlat): 
    954955        if self.saveProjectPath != None: 
     
    964965            finally: 
    965966                dlg.Destroy() 
    966              
     967 
    967968        self.saveProjectPath = newPath 
    968                  
     969 
    969970        self.PlatformOpen(None,newPlat) 
    970971        self.WaveformOpen(None,newWav) 
    971972        self.displayNodes() 
    972          
    973          
     973 
     974 
    974975    ################################################################# 
    975976    ## Help Menu Stuff 
    976977    ################################################################# 
    977      
     978 
    978979    def OnMenuHelpAboutMenu(self, event): 
    979980        dlg = AboutDialog.Dialog1(self) 
     
    983984            dlg.Destroy() 
    984985        event.Skip() 
    985          
     986 
    986987    def OnMenuHelpSamplewaveformMenu(self, event): 
    987988        self.generateTestWF() 
    988989        event.Skip() 
    989      
     990 
    990991    def generateTestWF(self): 
    991992        self.active_wave = WaveformClass.Waveform() 
     
    10021003        t2.ports.append(p1); t2.ports.append(p2) 
    10031004        self.active_wave.components.append(t2) 
    1004          
     1005 
    10051006        t3 = ComponentClass.Component("Channel") 
    10061007        p1 = ComponentClass.Port('inPortCh1',copy.deepcopy(int1),'Provides') 
     
    10111012        p6 = ComponentClass.Port('outPortCh3',copy.deepcopy(int1),'Uses') 
    10121013        t3.ports.extend([p1,p2,p3,p4,p5,p6]) 
    1013         self.active_wave.components.append(t3)         
    1014          
     1014        self.active_wave.components.append(t3) 
     1015 
    10151016        t4 = ComponentClass.Component("Receiver") 
    10161017        p1 = ComponentClass.Port('inPortRx1',copy.deepcopy(int1),'Provides') 
    10171018        p2 = ComponentClass.Port('outPortRx1',copy.deepcopy(int1),'Uses') 
    10181019        t4.ports.append(p1); t4.ports.append(p2) 
    1019         self.active_wave.components.append(t4)         
    1020          
     1020        self.active_wave.components.append(t4) 
     1021 
    10211022        temp_dev = ComponentClass.Component("GPP") 
    10221023        self.active_wave.devices.append(temp_dev) 
    1023          
     1024 
    10241025        self.displayComps() 
    1025      
     1026 
     1027 
    10261028################################################################################ 
    10271029## Waveform Layout Functionality 
     
    10651067        finally: 
    10661068            dlg.Destroy() 
    1067      
     1069 
    10681070        sn = self.compBox.GetSelection() 
    10691071        if sn == self.compBox.GetRootItem(): 
     
    10721074            # a main level component 
    10731075            self.active_comp = self.compBox.GetPyData(sn) 
    1074             ti = self.active_wave.components.index(self.active_comp)  
     1076            ti = self.active_wave.components.index(self.active_comp) 
    10751077            # If any other component is connected to this component - connection must be removed 
    10761078            for c in self.active_wave.components: 
     
    10781080                    if con.remoteComp == self.active_comp: 
    10791081                        ci = c.connections.index(con) 
    1080                         del c.connections[ci]               
     1082                        del c.connections[ci] 
    10811083            del self.active_wave.components[ti] 
    10821084        else: 
     
    10861088            ti = self.active_comp.connections.index(tc) 
    10871089            del self.active_comp.connections[ti] 
    1088          
     1090 
    10891091        self.displayComps() 
    10901092        self.displayNodes() 
     
    11121114            for x in self.compBoxPopup.GetMenuItems(): 
    11131115                if x.GetLabel() != 'Remove': 
    1114                     x.Enable(False)            
    1115          
    1116         self.compBox.PopupMenu(self.compBoxPopup)             
     1116                    x.Enable(False) 
     1117 
     1118        self.compBox.PopupMenu(self.compBoxPopup) 
    11171119        event.Skip() 
    11181120 
    11191121    def OnCompBoxPopupSet_acMenu(self, event): 
    11201122        for c in self.active_wave.components: 
    1121             c.AssemblyController = False             
     1123            c.AssemblyController = False 
    11221124        self.active_comp.AssemblyController = True 
    11231125        self.displayComps() 
     
    11271129        self.EditComponent() 
    11281130        event.Skip() 
    1129          
     1131 
    11301132    def OnCompBoxPopupConnectMenu(self, event): 
    11311133        self.ConnectComponent() 
     
    11371139        # what to do when the connections are supported : 
    11381140        #sn = self.nodeBox.GetSelection() 
    1139         #self.active_comp = self.nodeBox.GetPyData(sn)  #active component is actually and active resource   
     1141        #self.active_comp = self.nodeBox.GetPyData(sn)  #active component is actually and active resource 
    11401142        #self.ConnectComponent() 
    11411143 
     
    11681170            self.active_comp = self.compBox.GetPyData(sn) 
    11691171            newname = event.GetLabel() 
    1170          
     1172 
    11711173        if len(newname) > 0: 
    11721174            for c in self.active_wave.components: 
     
    11751177                    event.Veto() 
    11761178                    return 
    1177              
     1179 
    11781180            #Component names with spaces do not work 
    11791181            if newname.find(' ') != -1: 
     
    11831185                #newname = newname.replace(' ','_') 
    11841186                #self.compBox.SetItemText(sn,newname) 
    1185                  
     1187 
    11861188            self.active_comp.changeName(newname) 
    11871189            #self.active_comp.name = newname 
     
    11921194            event.Veto() 
    11931195            return 
    1194         event.Skip()         
    1195  
    1196     def OnCompBoxTreeBeginLabelEdit(self, event):         
     1196        event.Skip() 
     1197 
     1198    def OnCompBoxTreeBeginLabelEdit(self, event): 
    11971199        sn = self.compBox.GetSelection() 
    11981200        if sn == self.compBox.GetRootItem(): 
     
    12071209            event.Veto() 
    12081210            return 
    1209         event.Skip()     
     1211        event.Skip() 
    12101212 
    12111213    def OnCompBoxPopupRenameMenu(self, event): 
     
    12271229 
    12281230        event.Skip() 
    1229          
     1231 
    12301232    def OnCompBoxPopupRefreshMenu(self, event): 
    12311233        self.displayComps() 
    1232         event.Skip()     
    1233          
     1234        event.Skip() 
     1235 
    12341236    ################################################################# 
    12351237    ## Waveform Menu Stuff 
    12361238    ################################################################# 
    1237      
     1239 
    12381240    def OnMenuWaveformAddcompMenu(self, event): 
    12391241        ComponentFrame.newComponentFrame() 
     
    12581260            errorMsg(self,'Only top level components can be connected!') 
    12591261            return 
    1260          
     1262 
    12611263        self.ConnectComponent() 
    12621264        event.Skip() 
     
    12741276            errorMsg(self,'Only top level components can be edited!') 
    12751277            return 
    1276          
     1278 
    12771279        self.EditComponent() 
    12781280        event.Skip() 
     
    12831285            errorMsg(self,'Please enter a waveform name first') 
    12841286            return 
    1285              
    1286         nFlag = False     
     1287 
     1288        nFlag = False 
    12871289        for c in self.active_wave.components: 
    12881290            if c.name == tempLn: 
    12891291                nFlag = True 
    1290          
     1292 
    12911293        if nFlag == True: 
    12921294            tmpstr = "One of the waveform components has the same name as the waveform.\n" 
     
    13021304            node_names.append(n.name) 
    13031305            for d in n.Devices: 
    1304                 device_ids.append(d.uuid)                 
     1306                device_ids.append(d.uuid) 
    13051307 
    13061308        ##check for duplicate node names 
     
    13091311        #    errorMsg(self,"Duplicate node names detected.  This is not allowed.") 
    13101312        #    return 
    1311          
     1313 
    13121314        #check for duplicates in the device uuids 
    13131315        tmp = list(set(device_ids))  #removes duplicates from the list 
    13141316        if len(tmp) != len(device_ids):  #if there were duplicates (multiple copies of same device instances) 
    13151317            errorMsg(self,"Duplicate nodes or device instantiation UUIDs have been detected.  This is not allowed.") 
    1316             return     
     1318            return 
    13171319 
    13181320        acFlag = False 
     
    13371339                dlg.Destroy() 
    13381340            #return 
    1339              
     1341 
    13401342        if len(noDevs) > 0: 
    13411343            tmpstr = 'The following components are not assigned to a device. ' 
     
    13441346                tmpstr += x + '\n' 
    13451347            errorMsg(self,tmpstr) 
    1346              
     1348 
    13471349        self.waveName = tempLn 
    13481350        self.active_wave.name = tempLn 
    1349      
     1351 
    13501352        dlg = wx.DirDialog(self,"Please select the place to generate the code",style=wx.DD_NEW_DIR_BUTTON) 
    13511353        dlg.SetPath(os.path.expanduser('~')) 
     
    13571359        finally: 
    13581360            dlg.Destroy() 
    1359          
    1360         gen = genStruct.genAll(self.path,copy.deepcopy(self.active_wave)) 
     1361 
     1362        gen = genStruct.genAll(self.path, self.wavedevPath, copy.deepcopy(self.active_wave)) 
    13611363        gen.genDirs() 
    13621364        # Only include the device manager files if there is just one node 
     
    13701372            if c.generate: 
    13711373                gen.genCompFiles(c) 
    1372          
    1373         xml_gen.genxml(copy.deepcopy(self.active_wave.components),self.path,self.active_wave.name) 
    1374         xml_gen.genDAS(copy.deepcopy(self.active_wave.components),self.path,self.active_wave.name) 
    1375         xml_gen.writeWaveSetuppy(self.path, self.active_wave.name)      
    1376    
    1377         #save the .owd file  
     1374 
     1375        xml_gen.genxml(copy.deepcopy(self.active_wave.components), self.path, self.wavedevPath, self.active_wave.name) 
     1376        xml_gen.genDAS(copy.deepcopy(self.active_wave.components), self.path, self.wavedevPath, self.active_wave.name) 
     1377        xml_gen.writeWaveSetuppy(self.path, self.wavedevPath, self.active_wave.name) 
     1378 
     1379        #save the .owd file 
    13781380        f = open(self.path + "/" + self.waveName +  "/" + self.waveName + ".owd",'w') 
    1379         cPickle.dump(('project',self.active_wave,self.active_plat),f)    
    1380                 
     1381        cPickle.dump(('project',self.active_wave,self.active_plat),f) 
     1382 
    13811383        #generate the dcd file for each node 
    13821384        #for n in self.active_plat.nodes: 
     
    13871389            #    tmpname = 'DeviceManager' + n.name 
    13881390            #    folderFlag = True 
    1389             #xml_gen.genDeviceManager(n,self.path,self.active_wave.name,tmpname,folderFlag) 
    1390          
     1391            #xml_gen.genDeviceManager(n, self.path, self.wavedevPath, self.active_wave.name, tmpname,folderFlag) 
     1392 
    13911393        gen.cleanUp() 
    13921394 
     
    14011403            for x in self.active_wave.components: 
    14021404                if x.generate == True: 
    1403                     x.ace = False  
    1404          
    1405         event.Skip() 
    1406          
    1407      
     1405                    x.ace = False 
     1406 
     1407        event.Skip() 
     1408 
     1409 
    14081410################################################################################ 
    14091411## Resource Functionality 
    14101412################################################################################ 
    1411          
     1413 
    14121414    def displayResources(self): 
    14131415        self.resourceBox.DeleteAllItems() 
     
    14161418        devRoot = self.resourceBox.AppendItem(troot,'Devices',image=1) 
    14171419        nodeRoot = self.resourceBox.AppendItem(troot,'Nodes',image=1) 
    1418          
     1420 
    14191421        for c in self.Available_Components: 
    14201422            t1 = self.resourceBox.AppendItem(compRoot,c.name) 
    14211423            self.resourceBox.SetPyData(t1,c) 
    1422          
     1424 
    14231425        for c in self.Available_Devices: 
    14241426            t1 = self.resourceBox.AppendItem(devRoot,c.name) 
    14251427            self.resourceBox.SetPyData(t1,c) 
    1426          
     1428 
    14271429        for n in self.Available_Nodes: 
    14281430            t1 = self.resourceBox.AppendItem(nodeRoot,n.name) 
    14291431            self.resourceBox.SetPyData(t1,n) 
    1430          
    1431          
     1432 
     1433 
    14321434        if self.resourceBox.GetChildrenCount(troot,recursively=False) > 0: 
    14331435            cid1,cookie1 = self.resourceBox.GetFirstChild(troot) 
     
    14371439                self.resourceBox.SortChildren(cid1) 
    14381440 
    1439     def loadResources(self):             
     1441    def loadResources(self): 
    14401442        self.Available_Components = [] 
    14411443        self.Available_Devices = [] 
    14421444        self.Available_Nodes = [] 
    1443   
     1445 
    14441446        resList = [] 
    14451447 
     
    14591461            tmpResPath = r[0] + r[1] 
    14601462            tmpComp = importResource.getResource(tmpResPath,tmpResName,self) 
    1461                  
     1463 
    14621464            if tmpComp == None: 
    14631465                continue 
     
    14701472            elif tmpComp.type == 'device': 
    14711473                self.Available_Devices.append(tmpComp) 
    1472          
     1474 
    14731475        nodeList = [] 
    14741476        if os.path.isdir(self.installPath + 'nodes'): 
     
    14761478        else: 
    14771479            errorMsg(self, "No nodes could be found in: " + self.installPath) 
    1478          
     1480 
    14791481        # find the scd files for each node 
    14801482        for node_name in nodeList: 
     
    14971499            nodeName = node_name 
    14981500            nodePath = self.installPath + 'nodes/' + nodeName + '/' 
    1499              
     1501 
    15001502            tmpNode = importNode.getNode(nodePath,nodeName,self) 
    15011503            if tmpNode == None: 
     
    15031505                continue 
    15041506            self.Available_Nodes.append(tmpNode) 
    1505            
     1507 
    15061508        self.displayResources() 
    15071509 
    1508     def OnRefreshResourceBtnButton(self, event):         
     1510    def OnRefreshResourceBtnButton(self, event): 
    15091511        self.loadResources() 
    15101512 
     
    15281530                    if c.baseName == tmpBaseName: 
    15291531                        tmpCount += 1 
    1530          
     1532 
    15311533                dlg = wx.TextEntryDialog(self, 'Please enter an instance name for this '\ 
    15321534                + tmpRes.name + ' component.', 'Enter Name', tmpRes.name + str(tmpCount)) 
     
    15391541                            dlg.Destroy() 
    15401542                            return 
    1541                  
     1543 
    15421544                        for c in self.active_wave.components: 
    15431545                            if newname == c.name: 
     
    15501552                finally: 
    15511553                    dlg.Destroy() 
    1552          
    1553          
     1554 
     1555 
    15541556                newRes = copy.deepcopy(tmpRes) 
    1555                 newRes.name = newname     
    1556                 newRes.baseName = tmpBaseName     
     1557                newRes.name = newname 
     1558                newRes.baseName = tmpBaseName 
    15571559                newRes.setUUID()    # this gives the component instance a unique id 
    15581560        # we do not set the newRes.file_uuid because it is the same for all components of this type 
    1559          
     1561 
    15601562                self.active_wave.components.append(newRes) 
    15611563                self.displayComps() 
     
    15781580                    x.Enable(True) 
    15791581            tmpRes =  self.resourceBox.GetPyData(sn) 
    1580             if tmpRes.type == 'resource':            
     1582            if tmpRes.type == 'resource': 
    15811583                x = self.resourceBoxPopup.FindItemById(wxID_FRAME1RESOURCEBOXPOPUPADDDEV) 
    1582                 x.Enable(False)            
     1584                x.Enable(False) 
    15831585                x = self.resourceBoxPopup.FindItemById(wxID_FRAME1RESOURCEBOXPOPUPADDNODE) 
    1584                 x.Enable(False)            
    1585                  
     1586                x.Enable(False) 
     1587 
    15861588                #x = self.resourceBoxPopup.FindItemById(wxID_FRAME1RESOURCEBOXPOPUPGETDESCR) 
    15871589                #x.Enable(False) 
    1588                  
     1590 
    15891591                #disable Doxygen docs display if no docs directory found 
    15901592                docsPath = self.installPath + 'docs/' + tmpRes.name 
     
    15941596            elif tmpRes.type == 'node': 
    15951597                x = self.resourceBoxPopup.FindItemById(wxID_FRAME1RESOURCEBOXPOPUPADDDEV) 
    1596                 x.Enable(False)            
     1598                x.Enable(False) 
    15971599                x = self.resourceBoxPopup.FindItemById(wxID_FRAME1RESOURCEBOXPOPUPADD) 
    1598                 x.Enable(False)           
    1599                 #x = self.resourceBoxPopup.FindItemById(wxID_FRAME1RESOURCEBOXPOPUPGETDESCR) 
    1600                 #x.Enable(False) 
    1601                 x = self.resourceBoxPopup.FindItemById(wxID_FRAME1RESOURCEBOXPOPUPGETDOXYGENREFMAN) 
    1602                 x.Enable(False)  
    1603             else:            
    1604                 x = self.resourceBoxPopup.FindItemById(wxID_FRAME1RESOURCEBOXPOPUPADDNODE) 
    1605                 x.Enable(False)            
    1606                 x = self.resourceBoxPopup.FindItemById(wxID_FRAME1RESOURCEBOXPOPUPADD) 
    1607                 x.Enable(False)            
     1600                x.Enable(False) 
    16081601                #x = self.resourceBoxPopup.FindItemById(wxID_FRAME1RESOURCEBOXPOPUPGETDESCR) 
    16091602                #x.Enable(False) 
    16101603                x = self.resourceBoxPopup.FindItemById(wxID_FRAME1RESOURCEBOXPOPUPGETDOXYGENREFMAN) 
    16111604                x.Enable(False) 
     1605            else: 
     1606                x = self.resourceBoxPopup.FindItemById(wxID_FRAME1RESOURCEBOXPOPUPADDNODE) 
     1607                x.Enable(False) 
     1608                x = self.resourceBoxPopup.FindItemById(wxID_FRAME1RESOURCEBOXPOPUPADD) 
     1609                x.Enable(False) 
     1610                #x = self.resourceBoxPopup.FindItemById(wxID_FRAME1RESOURCEBOXPOPUPGETDESCR) 
     1611                #x.Enable(False) 
     1612                x = self.resourceBoxPopup.FindItemById(wxID_FRAME1RESOURCEBOXPOPUPGETDOXYGENREFMAN) 
     1613                x.Enable(False) 
    16121614 
    16131615        #if tmpRes != None: 
    1614         self.resourceBox.PopupMenu(self.resourceBoxPopup)             
     1616        self.resourceBox.PopupMenu(self.resourceBoxPopup) 
    16151617        event.Skip() 
    16161618 
     
    16331635        sn = self.resourceBox.GetSelection() 
    16341636        tmpRes =  self.resourceBox.GetPyData(sn) 
    1635          
     1637 
    16361638        if len(self.active_plat.nodes) == 0: 
    16371639            tmpstr = "There are no available nodes to add a device instance to.\n" 
     
    16391641            errorMsg(self,tmpstr) 
    16401642            return 
    1641          
     1643 
    16421644        tmpBaseName = tmpRes.name 
    16431645        #tmpCount = 1 
     
    16461648        #        if x.baseName == tmpBaseName: 
    16471649        #            tmpCount += 1 
    1648          
     1650 
    16491651        #dlg = NodeDialog.create(self,self.active_plat.nodes,tmpBaseName + str(tmpCount)) 
    16501652        dlg = NodeDialog.create(self,self.active_plat.nodes,tmpBaseName) 
    1651          
     1653 
    16521654        try: 
    16531655            returnCode = dlg.ShowModal() 
     
    16591661                basename = newname 
    16601662                newname = newname+str(tmpCount) 
    1661                  
     1663 
    16621664                while iterator < len(tmpnode.Devices): 
    16631665                    for c in tmpnode.Devices: 
     
    16841686        finally: 
    16851687            dlg.Destroy() 
    1686          
    1687          
     1688 
     1689 
    16881690        newDev = copy.deepcopy(tmpRes) 
    1689         newDev.name = newname     
    1690         newDev.baseName = tmpBaseName    
    1691         newDev.generate = False  
     1691        newDev.name = newname 
     1692        newDev.baseName = tmpBaseName 
     1693        newDev.generate = False 
    16921694        newDev.node = tmpnode.name 
    16931695        newDev.setUUID()    # this gives the device instance a unique id 
    16941696        # we do not set the newDev.file_uuid because it is the same for all devices of this type 
    1695          
     1697 
    16961698        tmpnode.Devices.append(newDev) 
    16971699        self.displayNodes() 
     
    17311733                errorMsg(self,'Neither index.html nor refman.pdf found in ' + docsPath + ': directory listing: ' + str(docList)) 
    17321734        else: 
    1733             errorMsg(self,'No directory for ' + tmpRes.name + ' could be found in: ' + self.installPath + 'docs')             
     1735            errorMsg(self,'No directory for ' + tmpRes.name + ' could be found in: ' + self.installPath + 'docs') 
    17341736            return 
    17351737 
     
    17401742        self.displayNodes() 
    17411743        event.Skip() 
    1742              
     1744 
    17431745################################################################################ 
    17441746## Platform Layout Functionality 
     
    17481750        self.nodeBox.DeleteAllItems() 
    17491751        troot = self.nodeBox.AddRoot("the_root") 
    1750          
     1752 
    17511753        for n in self.active_plat.nodes: 
    17521754            t1 = self.nodeBox.AppendItem(troot,n.name) 
    17531755            self.nodeBox.SetPyData(t1,n) 
    1754      
     1756 
    17551757            for d in n.Devices: 
    17561758                t2 = self.nodeBox.AppendItem(t1,unicode(d.name)) 
    17571759                self.nodeBox.SetPyData(t2,d) 
    1758                  
     1760 
    17591761                for c in self.active_wave.components: 
    17601762                    if c.device == d: 
    17611763                        t3 = self.nodeBox.AppendItem(t2,c.name) 
    17621764                        self.nodeBox.SetPyData(t3,c) 
    1763                      
     1765 
    17641766    def AddNode(self): 
    17651767        tmpCount = len(self.active_plat.nodes) + 1 
    1766          
     1768 
    17671769        dlg = wx.TextEntryDialog(self, 'Please enter a name for this node ',\ 
    17681770         'Enter Name', 'Node' + str(tmpCount)) 
     
    17751777                    dlg.Destroy() 
    17761778                    return 
    1777                  
     1779 
    17781780                for c in self.active_plat.nodes: 
    17791781                    if newname == c.name: 
     
    17861788        finally: 
    17871789            dlg.Destroy() 
    1788          
     1790 
    17891791        #tmpNode = PlatformClass.Node(newname) 
    17901792        tmpNode = ComponentClass.Node(name=newname) 
     
    17951797        errorMsg(self, 'WARNING: You will have to regenerate your waveform if you continue') 
    17961798        sn = self.nodeBox.GetSelection() 
    1797          
     1799 
    17981800        #generate the dcd file for the selected node 
    17991801        dlg = wx.DirDialog(self,"Please select the place to generate the code",style=wx.DD_NEW_DIR_BUTTON) 
     
    18071809            dlg.Destroy() 
    18081810        active_node = None 
    1809         
     1811 
    18101812        tmp_count = 0 
    18111813        duplicate_name_flag = False 
     
    18141816                dev_count = 0 
    18151817                while dev_count < len(self.active_plat.nodes[tmp_count].Devices): 
    1816                     tmp_uuid = unicode(ComponentClass.uuidgen()) 
     1818                    tmp_uuid = unicode(uuidgen.uuidgen()) 
    18171819                    n.Devices[dev_count].uuid = tmp_uuid 
    18181820                    self.active_plat.nodes[tmp_count].Devices[dev_count].uuid = tmp_uuid 
    1819                     dev_count = dev_count + 1                 
     1821                    dev_count = dev_count + 1 
    18201822                active_node = n 
    18211823                break 
     
    18271829 
    18281830 
    1829         gen = genNode.genAll(self.path,copy.deepcopy(active_node)) 
     1831        gen = genNode.genAll(self.path, self.wavedevPath, copy.deepcopy(active_node)) 
    18301832        gen.genDirs() 
    18311833        gen.writeMakefile() 
    18321834        # TODO: use different configure.ac file for node -JDG 
    18331835        gen.genConfigureACFiles(self.installPath) 
    1834         xml_gen.genDeviceManager(n,self.path,n.name,"DeviceManager",False) 
    1835          
    1836                      
     1836        xml_gen.genDeviceManager(n, self.path, self.wavedevPath, n.name, "DeviceManager", False) 
     1837 
     1838 
    18371839    def RemoveNodeBoxSelection(self): 
    18381840        sn = self.nodeBox.GetSelection() 
    18391841        snParent = self.nodeBox.GetItemParent(sn) 
    1840         if snParent == self.nodeBox.GetRootItem():   
    1841             # a platform node           
     1842        if snParent == self.nodeBox.GetRootItem(): 
     1843            # a platform node 
    18421844            tmpMsg = "        Are you sure you want to remove this Node?\n\n" 
    18431845            tmpMsg += "All device instances assigned to this node will be removed,\n" 
     
    18461848                return 
    18471849            tmpNode = self.nodeBox.GetPyData(sn) 
    1848             for n in self.active_plat.nodes:     
    1849                 if tmpNode == n:   
     1850            for n in self.active_plat.nodes: 
     1851                if tmpNode == n: 
    18501852                    for d in n.Devices: 
    18511853                        # If any other component is connected to this device - connection must be removed 
     
    18601862                    dIndex = self.active_plat.nodes.index(tmpNode) 
    18611863                    del self.active_plat.nodes[dIndex] 
    1862              
     1864 
    18631865        elif self.nodeBox.GetItemParent(snParent) == self.nodeBox.GetRootItem(): 
    18641866            # a device instance 
     
    18731875                    if con.remoteComp == tmpDev: 
    18741876                        ci = c.connections.index(con) 
    1875                         del c.connections[ci]   
    1876              
    1877             for n in self.active_plat.nodes:     
     1877                        del c.connections[ci] 
     1878 
     1879            for n in self.active_plat.nodes: 
    18781880                for d in n.Devices: 
    18791881                    if tmpDev == d: 
     
    18901892            tmpComp = self.nodeBox.GetPyData(sn) 
    18911893            tmpComp.device = None 
    1892          
     1894 
    18931895        self.displayNodes() 
    18941896        self.displayComps() 
     
    19221924            self.nodeBoxPopup.Enable(wxID_FRAME1NODEBOXPOPUPGENERATE,False) 
    19231925            self.nodeBoxPopup.Enable(wxID_FRAME1NODEBOXPOPUPRENAME,False) 
    1924          
    1925         self.nodeBox.PopupMenu(self.nodeBoxPopup)             
     1926 
     1927        self.nodeBox.PopupMenu(self.nodeBoxPopup) 
    19261928        event.Skip() 
    19271929 
     
    19331935        self.RemoveNodeBoxSelection() 
    19341936        event.Skip() 
    1935          
     1937 
    19361938    def OnNodeBoxPopupGenerateMenu(self, event): 
    19371939        self.GenerateNodeBoxSelection() 
     
    19401942    def OnNodeBoxPopupExpandMenu(self, event): 
    19411943        troot = self.nodeBox.GetRootItem() 
    1942         if self.nodeBox.ItemHasChildren(troot):               
     1944        if self.nodeBox.ItemHasChildren(troot): 
    19431945            cid1,cookie1 = self.nodeBox.GetFirstChild(troot) 
    19441946            self.ExpandTreeNode(self.nodeBox,cid1) 
     
    19471949                self.ExpandTreeNode(self.nodeBox,cid1) 
    19481950                cid1 = self.nodeBox.GetNextSibling(cid1) 
    1949                  
    1950         event.Skip() 
    1951          
     1951 
     1952        event.Skip() 
     1953 
    19521954    def OnNodeBoxPopupRefreshMenu(self, event): 
    19531955        self.displayNodes() 
     
    19721974            event.Veto() 
    19731975            return 
    1974         event.Skip()     
     1976        event.Skip() 
    19751977 
    19761978    def OnNodeBoxTreeEndLabelEdit(self, event): 
     
    19901992                        event.Veto() 
    19911993                        return 
    1992                  
     1994 
    19931995                #Node names with spaces do not work 
    19941996                if newname.find(' ') != -1: 
     
    19961998                    event.Veto() 
    19971999                    return 
    1998                      
     2000 
    19992001                tempNode.name = newname 
    20002002            else: 
     
    20092011            newname = event.GetLabel() 
    20102012            if len(newname) > 0: 
    2011                 for d in tempNode.Devices:                     
     2013                for d in tempNode.Devices: 
    20122014                    if d != tempDev and d.name == newname: 
    20132015                        errorMsg(self,'Invalid name - a device instance with that name already exists') 
    20142016                        event.Veto() 
    20152017                        return 
    2016                  
     2018 
    20172019                #Device names with spaces do not work 
    20182020                if newname.find(' ') != -1: 
     
    20202022                    event.Veto() 
    20212023                    return 
    2022                      
     2024 
    20232025                tempDev.changeName(newname) 
    2024                  
     2026 
    20252027        else: 
    20262028            # a child component (connection) 
    20272029            event.Veto() 
    20282030            return 
    2029          
    2030         event.Skip()         
     2031 
     2032        event.Skip() 
    20312033 
    20322034    ################################################################# 
     
    20532055                self.ExpandTreeNode(whichBox,cid1) 
    20542056                cid1 = self.nodeBox.GetNextSibling(cid1) 
    2055                  
     2057 
    20562058############################################################################### 
    20572059## LoadConfiguration 
    2058 ## This function is not a part of the frame class so that other modules can  
     2060## This function is not a part of the frame class so that other modules can 
    20592061## call it 
    2060 ###############################################################################                 
     2062############################################################################### 
    20612063def LoadConfiguration(frame_obj): 
    20622064    '''Extracts information from configuration file''' 
     
    20702072    except: 
    20712073        frame_obj.version = "unknown" 
    2072      
     2074 
    20732075    # install path 
    20742076    try: 
     
    21102112            errorMsg(frame_obj,tmpstr) 
    21112113 
    2112     
     2114 
    21132115    # custom IDL path 
    21142116    use_default_customidlpath = False 
     
    21612163            tmpstr += "using CF interfaces.\n\n" 
    21622164            tmpstr += "If you have ossie installed in a location other than\n" 
    2163             tmpstr += "the default please specify that location in the\n"  
     2165            tmpstr += "the default please specify that location in the\n" 
    21642166            tmpstr += "wavedev.cfg file located in the top directory." 
    21652167            errorMsg(frame_obj,tmpstr) 
  • ossiedev/trunk/tools/WaveDev/wavedev/PropertiesDialog.py

    r5941 r8046  
    66from errorMsg import * 
    77import commands 
     8from uuidgen import uuidgen 
    89 
    910def create(parent): 
    1011    return PropertiesDialog(parent) 
    1112 
    12 [wxID_PROPERTIESDIALOG, wxID_PROPERTIESDIALOGACTIONCHOICE,  
    13  wxID_PROPERTIESDIALOGADDPROP, wxID_PROPERTIESDIALOGADDVALUE,  
    14  wxID_PROPERTIESDIALOGCANCEL, wxID_PROPERTIESDIALOGDESCRIPTION,  
    15  wxID_PROPERTIESDIALOGELEMENTCHOICE, wxID_PROPERTIESDIALOGENUMBOX,  
    16  wxID_PROPERTIESDIALOGIDBOX, wxID_PROPERTIESDIALOGKINDCHOICE,  
    17  wxID_PROPERTIESDIALOGMAXBOX, wxID_PROPERTIESDIALOGMINBOX,  
    18  wxID_PROPERTIESDIALOGMODECHOICE, wxID_PROPERTIESDIALOGNAMEBOX,  
    19  wxID_PROPERTIESDIALOGOK, wxID_PROPERTIESDIALOGSASHWINDOW1,  
    20  wxID_PROPERTIESDIALOGSASHWINDOW2, wxID_PROPERTIESDIALOGSPLITTERWINDOW1,  
    21  wxID_PROPERTIESDIALOGSTATICTEXT1, wxID_PROPERTIESDIALOGSTATICTEXT10,  
    22  wxID_PROPERTIESDIALOGSTATICTEXT11, wxID_PROPERTIESDIALOGSTATICTEXT12,  
    23  wxID_PROPERTIESDIALOGSTATICTEXT2, wxID_PROPERTIESDIALOGSTATICTEXT3,  
    24  wxID_PROPERTIESDIALOGSTATICTEXT4, wxID_PROPERTIESDIALOGSTATICTEXT5,  
    25  wxID_PROPERTIESDIALOGSTATICTEXT6, wxID_PROPERTIESDIALOGSTATICTEXT7,  
    26  wxID_PROPERTIESDIALOGSTATICTEXT8, wxID_PROPERTIESDIALOGSTATICTEXT9,  
    27  wxID_PROPERTIESDIALOGTYPECHOICE, wxID_PROPERTIESDIALOGUNITSCHOICE,  
    28  wxID_PROPERTIESDIALOGVALUEBOX, wxID_PROPERTIESDIALOGVALUELIST,  
     13[wxID_PROPERTIESDIALOG, wxID_PROPERTIESDIALOGACTIONCHOICE, 
     14 wxID_PROPERTIESDIALOGADDPROP, wxID_PROPERTIESDIALOGADDVALUE, 
     15 wxID_PROPERTIESDIALOGCANCEL, wxID_PROPERTIESDIALOGDESCRIPTION, 
     16 wxID_PROPERTIESDIALOGELEMENTCHOICE, wxID_PROPERTIESDIALOGENUMBOX, 
     17 wxID_PROPERTIESDIALOGIDBOX, wxID_PROPERTIESDIALOGKINDCHOICE, 
     18 wxID_PROPERTIESDIALOGMAXBOX, wxID_PROPERTIESDIALOGMINBOX, 
     19 wxID_PROPERTIESDIALOGMODECHOICE, wxID_PROPERTIESDIALOGNAMEBOX, 
     20 wxID_PROPERTIESDIALOGOK, wxID_PROPERTIESDIALOGSASHWINDOW1, 
     21 wxID_PROPERTIESDIALOGSASHWINDOW2, wxID_PROPERTIESDIALOGSPLITTERWINDOW1, 
     22 wxID_PROPERTIESDIALOGSTATICTEXT1, wxID_PROPERTIESDIALOGSTATICTEXT10, 
     23 wxID_PROPERTIESDIALOGSTATICTEXT11, wxID_PROPERTIESDIALOGSTATICTEXT12, 
     24 wxID_PROPERTIESDIALOGSTATICTEXT2, wxID_PROPERTIESDIALOGSTATICTEXT3, 
     25 wxID_PROPERTIESDIALOGSTATICTEXT4, wxID_PROPERTIESDIALOGSTATICTEXT5, 
     26 wxID_PROPERTIESDIALOGSTATICTEXT6, wxID_PROPERTIESDIALOGSTATICTEXT7, 
     27 wxID_PROPERTIESDIALOGSTATICTEXT8, wxID_PROPERTIESDIALOGSTATICTEXT9, 
     28 wxID_PROPERTIESDIALOGTYPECHOICE, wxID_PROPERTIESDIALOGUNITSCHOICE, 
     29 wxID_PROPERTIESDIALOGVALUEBOX, wxID_PROPERTIESDIALOGVALUELIST, 
    2930] = [wx.NewId() for _init_ctrls in range(34)] 
    3031 
     
    238239        self.calledByParent = False 
    239240        self.active_prop = None 
    240          
     241 
    241242    def OnPropertiesDialogActivate(self, event): 
    242243        if self.calledByParent == True: 
    243244 
    244245            self.active_comp = self.parent.active_comp 
    245            
     246 
    246247            if self.active_prop == None: 
    247248                self.elementType = "Simple" 
     
    262263                tmp = self.modeChoice.FindString(self.active_prop.mode) 
    263264                self.modeChoice.SetSelection(tmp) 
    264                 self.elementType = self.active_prop.elementType  
     265                self.elementType = self.active_prop.elementType 
    265266                tmp = self.elementChoice.FindString(self.elementType) 
    266267                self.elementChoice.SetSelection(tmp) 
     
    272273 
    273274            self.refreshDisplay() 
    274          
     275 
    275276            self.calledByParent = False 
    276277        event.Skip() 
     
    284285        pos = self.elementChoice.GetSelection() 
    285286        if pos == wx.NOT_FOUND: 
    286             return  
     287            return 
    287288        self.elementType = self.elementChoice.GetString(pos) 
    288289        if self.elementType != "Simple" and self.elementType != "SimpleSequence": 
     
    290291            self.elementType = "Simple" 
    291292            self.elementChoice.SetSelection(0) 
    292                          
     293 
    293294        self.refreshDisplay() 
    294295        event.Skip() 
    295          
     296 
    296297    def refreshDisplay(self): 
    297298        if self.active_prop != None: 
    298              
     299 
    299300            if self.active_prop.elementType == "Simple": 
    300301                pass 
     
    305306                self.addValue.Enable(True) 
    306307            self.enumBox.Enable(True) 
    307              
     308 
    308309            pos = self.kindChoice.GetSelection() 
    309310            if pos != wx.NOT_FOUND: 
     
    312313                else: 
    313314                    self.actionChoice.Enable(False) 
    314              
     315 
    315316        elif self.elementType == "SimpleSequence": 
    316317            self.addValue.Enable(True) 
    317318            self.enumBox.Enable(False) 
    318              
     319 
    319320    def initializeDisplay(self): 
    320321        if self.elementType == "Simple" or self.elementType == "SimpleSequence": 
     
    322323            pos = self.typeChoice.FindString(self.active_prop.type) 
    323324            self.typeChoice.SetSelection(pos) 
    324              
     325 
    325326            # Load the action (ie. eq, lt, ge) 
    326327            if self.active_prop.action != None: 
    327328                pos = self.actionChoice.FindString(self.active_prop.action) 
    328329                self.actionChoice.SetSelection(pos) 
    329              
     330 
    330331            # Load the kind (ie. allocation, configure, execparam) 
    331332            pos = self.kindChoice.FindString(self.active_prop.kind) 
     
    336337                pass 
    337338            else: 
    338                 self.minBox.SetValue(str(self.active_prop.range[0]))  
    339                 self.maxBox.SetValue(str(self.active_prop.range[1]))  
     339                self.minBox.SetValue(str(self.active_prop.range[0])) 
     340                self.maxBox.SetValue(str(self.active_prop.range[1])) 
    340341 
    341342            # If this is already installed on the system - can't change anything but the value(s) 
     
    352353                self.modeChoice.Enable(False) 
    353354                self.description.Enable(False) 
    354                 
    355         if self.elementType == "Simple":     
     355 
     356        if self.elementType == "Simple": 
    356357            # Load the value for a Simple type 
    357358            self.valueList.InsertStringItem(0,unicode(self.active_prop.value)) 
    358359            self.valueList.SetStringItem(0,1,unicode(self.active_prop.defaultValue)) 
    359              
     360 
    360361            # Load the enumeration 
    361362            if self.active_prop.enum != '': 
    362363                self.enumBox.SetValue(self.active_prop.enum) 
    363          
    364         if self.elementType == "SimpleSequence":     
     364 
     365        if self.elementType == "SimpleSequence": 
    365366            for v in self.active_prop.values: 
    366367                self.valueList.InsertStringItem(0,v)  #create list (backwards at first) 
     
    383384            self.valueList.SetStringItem(0,1,tmpStr) 
    384385            self.valueBox.Clear() 
    385              
     386 
    386387        self.refreshDisplay() 
    387388        event.Skip() 
     
    400401    def OnValueListRightUp(self, event): 
    401402        self.valueList.PopupMenu(self.valueListPopup) 
    402          
     403 
    403404        event.Skip() 
    404405 
     
    406407        self.Close() 
    407408        event.Skip() 
    408              
     409 
    409410    def OnAddPropButton(self, event): 
    410411        # Check for the name 
     
    413414            errorMsg(self,"Please enter a property name first!") 
    414415            return 
    415          
     416 
    416417        # Check for the id 
    417418        tmpid = self.idBox.GetLineText(0) 
     
    419420            errorMsg(self,"Please enter a property id first!") 
    420421            return 
    421          
     422 
    422423        # Check for the mode 
    423424        pos = self.modeChoice.GetSelection() 
    424425        if pos == wx.NOT_FOUND: 
    425426            errorMsg(self,"Please select a property mode first!") 
    426             return  
     427            return 
    427428        tmpMode = self.modeChoice.GetString(pos) 
    428          
     429 
    429430        # Get the description 
    430431        tmpDes = self.description.GetValue() 
    431                  
     432 
    432433        # Check for the type ex: bool, char, short, etc. 
    433434        pos = self.typeChoice.GetSelection() 
    434435        if pos == wx.NOT_FOUND: 
    435436            errorMsg(self,"Please select a type first!") 
    436             return  
     437            return 
    437438        tmpType = self.typeChoice.GetString(pos) 
    438          
     439 
    439440        if self.elementType == "Simple": 
    440441            # instantiate the property object 
    441442            newProp = CC.SimpleProperty(tmpName,tmpMode,tmpType,tmpDes) 
    442              
     443 
    443444            # store the default value and the value 
    444445            if self.valueList.GetItemCount() == 0: 
    445446                errorMsg(self,"Please enter a value first!") 
    446447                return 
    447              
     448 
    448449            v = self.valueList.GetItem(0,0) 
    449450            dv = self.valueList.GetItem(0,1) 
    450451            newProp.value = v.GetText() 
    451452            newProp.defaultValue = dv.GetText() 
    452              
     453 
    453454        if self.elementType == "SimpleSequence": 
    454455            # store the default value and the value 
     
    456457                    errorMsg(self,"Please enter a value first!") 
    457458                    return 
    458              
     459 
    459460            newProp = CC.SimpleSequenceProperty(tmpName,tmpMode,tmpType,tmpDes) 
    460              
    461     
     461 
     462 
    462463            newProp.values = [] 
    463             newProp.defaultValues = []         
    464              
     464            newProp.defaultValues = [] 
     465 
    465466            for x in range(self.valueList.GetItemCount()): 
    466467                v = self.valueList.GetItem(x,0) 
     
    472473        # store the enum if any 
    473474        newProp.enum = self.enumBox.GetLineText(0) 
    474              
     475 
    475476        # Check for the kind ex: allocation, configure, test, etc. 
    476477        pos = self.kindChoice.GetSelection() 
    477478        if pos == wx.NOT_FOUND: 
    478479            errorMsg(self,"Please select a kind first!") 
    479             return  
     480            return 
    480481        newProp.kind = self.kindChoice.GetString(pos) 
    481               
     482 
    482483        # Check and store the range 
    483484        tmpMin = self.minBox.GetLineText(0) 
    484485        tmpMax = self.maxBox.GetLineText(0) 
    485              
     486 
    486487        if tmpMin == 'min' or tmpMin == '': 
    487488            tmpMin = -1 
    488              
     489 
    489490        if tmpMax == 'max' or tmpMax == '': 
    490491            tmpMax = -1 
    491                  
     492 
    492493        newProp.range = (tmpMin,tmpMax) 
    493              
     494 
    494495        # Check and store the action 
    495496        pos = self.actionChoice.GetSelection() 
     
    497498            if newProp.kind == "allocation": 
    498499                errorMsg(self,"Please select an action first!") 
    499                 return  
     500                return 
    500501        else: 
    501502            newProp.action = self.actionChoice.GetString(pos) 
    502                             
     503 
    503504        self.parent.active_comp.properties.append(newProp) 
    504505        self.Close() 
    505              
    506         event.Skip() 
    507          
     506 
     507        event.Skip() 
     508 
    508509    def OnOkButton(self, event): 
    509510        if self.editable: 
     
    514515                return 
    515516            self.active_prop.name = tmpName 
    516              
     517 
    517518            # Check for the id 
    518519            tmpid = self.idBox.GetLineText(0) 
     
    521522                return 
    522523            self.active_prop.id = tmpid 
    523          
     524 
    524525            # Check for the mode 
    525526            pos = self.modeChoice.GetSelection() 
    526527            if pos == wx.NOT_FOUND: 
    527528                errorMsg(self,"Please select a property mode first!") 
    528                 return  
     529                return 
    529530            tmpMode = self.modeChoice.GetString(pos) 
    530531            self.active_prop.mode = tmpMode 
    531              
     532 
    532533            # Get the description 
    533534            tmpDes = self.description.GetValue() 
    534535            self.active_prop.description = tmpDes 
    535                  
     536 
    536537            # Check for the type ex: bool, char, short, etc. 
    537538            pos = self.typeChoice.GetSelection() 
    538539            if pos == wx.NOT_FOUND: 
    539540                errorMsg(self,"Please select a type first!") 
    540                 return  
     541                return 
    541542            tmpType = self.typeChoice.GetString(pos) 
    542543            self.active_prop.type = tmpType 
    543          
     544 
    544545            if self.elementType == "Simple": 
    545546                # store the default value and the value 
     
    547548                    errorMsg(self,"Please enter a value first!") 
    548549                    return 
    549                      
     550 
    550551                v = self.valueList.GetItem(0,0) 
    551552                dv = self.valueList.GetItem(0,1) 
    552553                self.active_prop.value = v.GetText() 
    553554                self.active_prop.defaultValue = dv.GetText() 
    554                  
     555 
    555556            if self.elementType == "SimpleSequence": 
    556557                # store the default value and the value 
     
    558559                    errorMsg(self,"Please enter a value first!") 
    559560                    return 
    560                 
     561 
    561562                self.active_prop.values = [] 
    562563                self.active_prop.defaultValues = [] 
    563                     
     564 
    564565                for x in range(self.valueList.GetItemCount()): 
    565566                    v = self.valueList.GetItem(x,0) 
    566567                    dv = self.valueList.GetItem(x,1) 
    567                  
     568 
    568569                    self.active_prop.values.append(v.GetText()) 
    569570                    self.active_prop.defaultValues.append(dv.GetText()) 
    570      
     571 
    571572            # store the enum if any 
    572573            self.active_prop.enum = self.enumBox.GetLineText(0) 
    573                  
     574 
    574575            # Check for the kind ex: allocation, configure, test, etc. 
    575576            pos = self.kindChoice.GetSelection() 
    576577            if pos == wx.NOT_FOUND: 
    577578                errorMsg(self,"Please select a kind first!") 
    578                 return  
     579                return 
    579580            self.active_prop.kind = self.kindChoice.GetString(pos) 
    580                   
     581 
    581582            # Check and store the range 
    582583            tmpMin = self.minBox.GetLineText(0) 
    583584            tmpMax = self.maxBox.GetLineText(0) 
    584                  
     585 
    585586            if tmpMin == 'min' or tmpMin == '': 
    586587                tmpMin = -1 
    587                  
     588 
    588589            if tmpMax == 'max' or tmpMax == '': 
    589590                tmpMax = -1 
    590                      
     591 
    591592            self.active_prop.range = (tmpMin,tmpMax) 
    592                  
     593 
    593594            # Check and store the action 
    594595            pos = self.actionChoice.GetSelection() 
     
    596597                if self.active_prop.kind == "allocation": 
    597598                    errorMsg(self,"Please select an action first!") 
    598                     return  
     599                    return 
    599600            else: 
    600601                self.active_prop.action = self.actionChoice.GetString(pos) 
    601                  
     602 
    602603        else: 
    603604            if self.elementType == "Simple": 
     
    606607                    errorMsg(self,"Please enter a value first!") 
    607608                    return 
    608                      
     609 
    609610                v = self.valueList.GetItem(0,0) 
    610611                dv = self.valueList.GetItem(0,1) 
    611612                self.active_prop.value = v.GetText() 
    612613                self.active_prop.defaultValue = dv.GetText() 
    613                  
     614 
    614615            if self.elementType == "SimpleSequence": 
    615616                # store the default value and the value 
     
    617618                    errorMsg(self,"Please enter a value first!") 
    618619                    return 
    619                 
     620 
    620621                self.active_prop.values = [] 
    621622                self.active_prop.defaultValues = [] 
    622                     
     623 
    623624                for x in range(self.valueList.GetItemCount()): 
    624625                    v = self.valueList.GetItem(x,0) 
     
    626627                    self.active_prop.values.append(v.GetText()) 
    627628                    self.active_prop.defaultValues.append(dv.GetText()) 
    628                      
     629 
    629630        self.Close() 
    630          
     631 
    631632    def OnKindChoiceChoice(self, event): 
    632633        self.refreshDisplay() 
    633634        event.Skip() 
    634          
    635 #-------------------------------------------------------------------------------     
    636 # 
    637 # UUID Generator 
    638 # 
    639 def uuidgen(): 
    640    return commands.getoutput('uuidgen -t') 
    641          
  • ossiedev/trunk/tools/WaveDev/wavedev/XML_gen/application_gen.py

    r5914 r8046  
    1919import sys 
    2020import commands 
    21 import os  
     21import os 
    2222import shutil 
    2323import component_gen 
     24from component_gen import ensureDocType 
    2425import xml.dom.minidom 
    2526from xml.dom.minidom import Node 
    2627import xmlBeautify 
    2728import WaveDev.wavedev.ComponentClass as CC 
    28  
    29  
    30 # UUID Generator 
    31 def uuidgen(): 
    32    return commands.getoutput('uuidgen -t') 
    33  
    34 try: 
    35     doc_cfg = xml.dom.minidom.parse('../wavedev.cfg') 
    36 except:   #if  not being called from wavedev, try looking for the file 
    37     doc_cfg = xml.dom.minidom.parse('/sdr/tools/WaveDev/wavedev.cfg') 
    38  
    39  
    40 version = str(doc_cfg.getElementsByTagName("version")[0].firstChild.data) 
    41  
    42 #vtext = open('../version.txt') 
    43 #version = unicode(vtext.readline()) 
    44 #version = version.strip('\n') 
    45 commentLine = u'<!--Created with OSSIE WaveDev ' + version \ 
    46     + u'-->\n<!--Powered by Python-->\n' 
    47      
     29from WaveDev.wavedev.uuidgen import uuidgen 
     30 
    4831 
    4932xmlpath = u'/xml/' 
    5033####################################################################### 
    5134# genxml generates xml profiles for each component and the waveform 
    52 #######################################################################     
    53 def genxml(complist, genPath, waveName): 
     35####################################################################### 
     36def genxml(complist, genPath, wavedevPath, waveName): 
    5437 
    5538    if genPath[len(genPath)-1] != '/': 
    5639        genPath = genPath + '/' 
    5740    genPath = unicode(genPath) 
     41    if len(wavedevPath) > 0 and wavedevPath[len(wavedevPath)-1] != '/': 
     42        wavedevPath = wavedevPath + '/' 
    5843    waveformDir = unicode(genPath + waveName + '/') 
    5944 
    60     
     45 
    6146    appName = unicode(waveName) 
    6247    #namingServicePrefix = u'ossie' 
    6348    outputFilename_sad = appName + u'.sad.xml' 
    64     
     49 
    6550    # Generate the individual component xml files 
    6651    for n in complist: 
    6752        if n.generate: 
    68             component_gen.gen_scd(n, genPath) 
    69             component_gen.gen_spd(n, genPath) 
    70             component_gen.gen_prf(n, genPath)       
    71     
     53            component_gen.gen_scd(n, genPath, wavedevPath) 
     54            component_gen.gen_spd(n, genPath, wavedevPath) 
     55            component_gen.gen_prf(n, genPath, wavedevPath) 
     56 
    7257    #---------------------------------------------------------------------------- 
    7358    # SAD Parser / Generator 
    7459    # 
    75     
     60 
    7661    # Use the minidom module to objectify and generate the SAD file 
    7762    try:  #if running from wavedev 
    78         doc_sad = xml.dom.minidom.parse('XML_gen/_sad.xml.tpl') 
     63        doc_sad = xml.dom.minidom.parse(wavedevPath + 'XML_gen/_sad.xml.tpl') 
    7964    except:   #if not being called from wavedev, try looking for the file 
    8065        doc_sad = xml.dom.minidom.parse('/sdr/tools/WaveDev/wavedev/XML_gen/_sad.xml.tpl') 
     
    8267    doc_sad.getElementsByTagName("softwareassembly")[0].setAttribute("name", u'OSSIE::' + appName ) 
    8368    doc_sad.getElementsByTagName("softwareassembly")[0].setAttribute("id", u'DCE:' + unicode(uuidgen()) ) 
    84      
     69 
    8570    # get root nodes for componentfiles, partitioning, assemblycontroller, and connections tags 
    8671    componentfilesNode = doc_sad.getElementsByTagName("componentfiles")[0] 
     
    8873    assemblycontrollerNode = doc_sad.getElementsByTagName("assemblycontroller")[0] 
    8974    connectionsNode = doc_sad.getElementsByTagName("connections")[0] 
    90      
    91     baseComponentList = []  
     75 
     76    baseComponentList = [] 
    9277    for n in complist: 
    9378        # Generate the componentfile entries 
    9479        #tmpid = unicode(n.name) + u'_' + unicode(uuidgen()) 
    9580        tmpid = unicode(n.baseName) + u'_' + unicode(n.file_uuid) 
    96          
     81 
    9782        if n.baseName not in baseComponentList: 
    9883            baseComponentList.append(n.baseName) 
     
    136121                except: 
    137122                    pass 
    138                          
     123 
    139124        if overload_flag: 
    140125            componentpropertiesNode = doc_sad.createElement("componentproperties") 
     
    184169        namingserviceNode.setAttribute("name", NSname) 
    185170        findcomponentNode.appendChild(namingserviceNode) 
    186          
     171 
    187172        #TODO: append child nodes to componentplacement 
    188173        componentinstantiationNode.appendChild(usagenameNode) 
     
    198183            devFlag = False 
    199184 
    200             print "Processing connection : " 
    201             print "  component name  : " + cname 
    202             print "  local comp type : " + n.type 
    203             print "  local port type : " + i.localPort.type 
    204             print "  local port name : " + unicode(i.localPort.name) 
    205             print "  remote comp type: " + i.remoteComp.type 
    206             print "  remote port type: " + i.remotePort.type 
    207             print "  remote port name: " + unicode(i.remotePort.name) 
     185#            print "Processing connection : " 
     186#            print "  component name  : " + cname 
     187#            print "  local comp type : " + n.type 
     188#            print "  local port type : " + i.localPort.type 
     189#            print "  local port name : " + unicode(i.localPort.name) 
     190#            print "  remote comp type: " + i.remoteComp.type 
     191#            print "  remote port type: " + i.remotePort.type 
     192#            print "  remote port name: " + unicode(i.remotePort.name) 
    208193 
    209194            if i.localPort.type == 'Uses': 
     
    244229                c1name = "DomainName1/USRP1" 
    245230            namingserviceUsesNode.setAttribute("name", c1name) 
    246              
     231 
    247232            # Append child nodes 
    248233            usesidentifierNode.appendChild(usesidentifierTextNode) 
     
    250235            usesportNode.appendChild(usesidentifierNode) 
    251236            usesportNode.appendChild(findbyUsesNode) 
    252              
     237 
    253238            if devFlag != True: 
    254239                providesportNode = doc_sad.createElement("providesport") 
     
    258243                namingserviceProvidesNode = doc_sad.createElement("namingservice") 
    259244                namingserviceProvidesNode.setAttribute("name", c2name) 
    260                  
     245 
    261246                # Make connections 
    262247                providesidentifierNode.appendChild(providesidentifierTextNode) 
     
    285270            assemblycontroller_id = u'DCE:' + unicode(n.uuid) 
    286271            assemblycontrollerNode.getElementsByTagName("componentinstantiationref")[0].setAttribute("refid", assemblycontroller_id) 
    287          
     272 
     273    # Define <!DOCTYPE> here (overriding template if necessary) 
     274    ensureDocType(doc_sad, u'softwareassembly', u'../../xml/dtd/softwareassembly.dtd') 
     275 
    288276    # Create and beautify the SAD file as a temporary file 
    289277    data = doc_sad.toxml('UTF-8') 
    290278    xmlBeautify.beautify(data,waveformDir + '.' + outputFilename_sad + '.tmp') 
    291  
    292279 
    293280    # Post Processing - add some of the header lines 
     
    304291    postProcessed_sad.writelines(remaining) 
    305292    postProcessed_sad.close() 
    306    
     293 
    307294    # Remove temporary files 
    308295    os.remove(waveformDir + '.' + outputFilename_sad + '.tmp') 
    309     
     296 
    310297    ####################### 
    311298    #Generate the DCD file 
     
    315302################################################################################ 
    316303# Generate the Device Assignment Sequence 
    317 def genDAS(complist, path, waveName): 
     304def genDAS(complist, path, wavedevPath, waveName): 
    318305    if path[len(path)-1] != '/': 
    319306        path = path + '/' 
     
    322309    try: 
    323310        # try to find the DAS template using a relative path (being called by OWD) 
    324         das = xml.dom.minidom.parse('XML_gen/_DAS.xml.tpl') 
    325     except:  
    326         # try to find the DAS template using an absolute path  
    327         # (being called by other application)   
     311        das = xml.dom.minidom.parse(wavedevPath + 'XML_gen/_DAS.xml.tpl') 
     312    except: 
     313        # try to find the DAS template using an absolute path 
     314        # (being called by other application) 
    328315        # if DAS file is still not found, should throw an IO Error 
    329316        das = xml.dom.minidom.parse('/sdr/tools/WaveDev/wavedev/XML_gen/_DAS.xml.tpl') 
     
    340327            continue 
    341328        tmpDev = u'DCE:' + unicode(n.device.uuid) 
    342          
     329 
    343330        deviceassignmenttypeNode = das.createElement("deviceassignmenttype") 
    344331        componentidNode = das.createElement("componentid") 
     
    354341        deviceassignmentsequenceNode.appendChild(deviceassignmenttypeNode) 
    355342 
     343    # Define <!DOCTYPE> here (overriding template if necessary) 
     344    # ensureDocType(das, u'deploymentenforcement', u'../../xml/dtd/deploymentenforcement.dtd') 
    356345    data = das.toxml('UTF-8') 
    357346    xmlBeautify.beautify(data,path+'.'+waveName+'_DAS.xml.tmp') 
    358      
     347 
    359348    # Post Processing - add some of the header lines 
    360349 
    361350    preProcessed_das = open(path+'.'+waveName+'_DAS.xml.tmp', 'r') 
    362351    postProcessed_das = open(path+waveName+'_DAS.xml', 'w') 
    363      
     352 
    364353    # Specify external DTD 
    365354    line0 = preProcessed_das.readline() 
     
    370359    postProcessed_das.writelines(remaining) 
    371360    postProcessed_das.close() 
    372      
     361 
    373362    # Remove temporary files 
    374363    os.remove(path+'.'+waveName+'_DAS.xml.tmp') 
     
    376365################################################################################ 
    377366# Generate the DeviceManager XML files 
    378 def genDeviceManager(node,path,wavName,dmName,folder=False): 
     367def genDeviceManager(node, path, wavedevPath, wavName, dmName, folder = False): 
    379368    if path[len(path)-1] != '/': 
    380369        path = path + '/' 
    381370    path += wavName + '/' 
    382      
     371 
    383372    waveformDir = path 
    384373    if folder == True: 
    385         if os.path.exists(path + node.name) == False:    
     374        if os.path.exists(path + node.name) == False: 
    386375            os.mkdir(path + node.name) 
    387376        path += node.name + '/' 
    388      
     377 
    389378    #Generate the DCD file for the Device Manager 
    390     genDCD(node.Devices,path,node.name,dmName,folder,node.generate,node.id)  
    391      
     379    genDCD(node.Devices, path, wavedevPath, node.name, dmName, folder, node.generate, node.id) 
     380 
    392381    outputFilename_spd = dmName + '.spd.xml' 
    393382    outputFilename_scd = dmName + '.scd.xml' 
    394383    outputFilename_prf = dmName + '.prf.xml' 
    395      
     384 
    396385    #Copy and modify the spd file 
    397     doc_spd = xml.dom.minidom.parse('XML_gen/DevMan/_spd.xml.tpl') 
     386    doc_spd = xml.dom.minidom.parse(wavedevPath + 'XML_gen/DevMan/_spd.xml.tpl') 
    398387    doc_spd.getElementsByTagName("softpkg")[0].setAttribute("name", dmName) 
    399388    localfileNode = doc_spd.getElementsByTagName("descriptor")[0].getElementsByTagName("localfile")[0] 
    400389    localfileNode.setAttribute("name", unicode(dmName) + u'.scd.xml') 
    401      
     390 
     391    # Define <!DOCTYPE> here (overriding template if necessary) 
     392    ensureDocType(doc_spd, u'softpkg', u'../../xml/dtd/softpkg.dtd') 
    402393    data = doc_spd.toxml('UTF-8') 
    403394    xmlBeautify.beautify(data,path + '.' + outputFilename_spd + '.tmp') 
     
    417408    postProcessed_spd.writelines(remaining) 
    418409    postProcessed_spd.close() 
    419    
     410 
    420411    # Remove temporary files 
    421412    os.remove(path + '.' + outputFilename_spd + '.tmp') 
    422      
     413 
    423414    #tempDM = CC.Component(dmName,generate=False) 
    424415    #component_gen.gen_scd(tempDM,waveformDir,node.name) 
    425      
     416 
    426417    # Copy the scd and prf files to directory - these aren't changed yet 
    427418    print "Performing a copy to: " + path + outputFilename_scd 
    428     shutil.copyfile('XML_gen/DevMan/_scd.xml.tpl', path + outputFilename_scd) 
    429     shutil.copyfile('XML_gen/DevMan/_prf.xml.tpl', path + outputFilename_prf) 
    430      
    431      
     419    shutil.copyfile(wavedevPath + 'XML_gen/DevMan/_scd.xml.tpl', path + outputFilename_scd) 
     420    shutil.copyfile(wavedevPath + 'XML_gen/DevMan/_prf.xml.tpl', path + outputFilename_prf) 
     421 
     422 
    432423 
    433424################################################################################ 
    434 # Generate the DeviceManager DCD.xml file     
    435 def genDCD(devlist,path,nodeName,dmName='DeviceManager',folder=False,generate=True,devconf=""): 
    436              
     425# Generate the DeviceManager DCD.xml file 
     426def genDCD(devlist, path, wavedevPath, nodeName, dmName = 'DeviceManager', folder = False, generate = True, devconf = ""): 
     427 
    437428    outputFilename_dcd = dmName + '.dcd.xml' 
    438      
    439     doc_dcd = xml.dom.minidom.parse('XML_gen/_dcd.xml.tpl') 
     429 
     430    doc_dcd = xml.dom.minidom.parse(wavedevPath + 'XML_gen/_dcd.xml.tpl') 
    440431 
    441432    deviceconfigurationNode = doc_dcd.getElementsByTagName("deviceconfiguration")[0] 
     
    450441    devicemanagersoftpkgNode = deviceconfigurationNode.getElementsByTagName("devicemanagersoftpkg")[0] 
    451442    devicemanagersoftpkgNode.getElementsByTagName("localfile")[0].setAttribute("name", unicode(dmName) + u'.spd.xml') 
    452      
     443 
    453444    baseDeviceList = [] 
    454445    componentfilesNode = deviceconfigurationNode.getElementsByTagName("componentfiles")[0] 
     
    459450        else: 
    460451            tmpid = unicode(n.file_uuid) 
    461          
     452 
    462453        if n.baseName not in baseDeviceList: 
    463454        # Generate the componentfile entries 
     
    466457            componentfileNode.setAttribute("type", "SPD") 
    467458            componentfileNode.setAttribute("id", tmpid) 
    468              
     459 
    469460            localcomponentfileNode = doc_dcd.createElement("localfile") 
    470461            localcomponentfileNode.setAttribute("name", unicode(xmlpath + n.baseName + '/' + n.baseName + '.spd.xml') ) 
     
    472463            componentfileNode.appendChild(localcomponentfileNode) 
    473464            componentfilesNode.appendChild(componentfileNode) 
    474     
     465 
    475466        # Generate the partitioning entries 
    476467        componentplacementNode = doc_dcd.createElement("componentplacement") 
     
    489480        partitioningNode.appendChild(componentplacementNode) 
    490481 
     482    # Define <!DOCTYPE> here (overriding template if necessary) 
     483    ensureDocType(doc_dcd, u'deviceconfiguration', u'../../xml/dtd/deviceconfiguration.dtd') 
    491484    # Create and beautify the dcd file as a temporary file 
    492485    data = doc_dcd.toxml('UTF-8') 
    493486    xmlBeautify.beautify(data,path + '.' + outputFilename_dcd + '.tmp') 
    494  
    495487 
    496488    # Post Processing - add some of the header lines 
     
    507499    postProcessed_dcd.writelines(remaining) 
    508500    postProcessed_dcd.close() 
    509    
     501 
    510502    # Remove temporary files 
    511503    os.remove(path + '.' + outputFilename_dcd + '.tmp') 
     
    513505 
    514506 
    515 def writeWaveSetuppy(wavePath,waveName): 
     507def writeWaveSetuppy(wavePath, wavedevPath, waveName): 
    516508    ''' 
    517     ##############################################################################  
     509    ############################################################################## 
    518510    ## writeWaveSetuppy - generates the setup.py file for a waveform 
    519511    ############################################################################## 
     
    524516 
    525517    #copy over the readme file 
    526     shutil.copy('XML_gen/README', wavePath) 
    527   
     518    shutil.copy(wavedevPath + 'XML_gen/README', wavePath) 
     519 
    528520    output = open(wavePath + '/setup.py','w') 
    529521    ts = "\ 
     
    544536         "',data_files=[(install_location+'/waveforms/" + waveName + "',['" + \ 
    545537         waveName + ".sad.xml', '" + waveName + "_DAS.xml'])])" 
    546     output.writelines(ts)    
     538    output.writelines(ts) 
    547539 
    548540    output.close()   #done creating the file 
  • ossiedev/trunk/tools/WaveDev/wavedev/XML_gen/component_gen.py

    r5887 r8046  
    2424import xml.dom.minidom 
    2525from xml.dom.minidom import Node 
    26  
    2726import xmlBeautify 
    28  
    29 # 
    30 # UUID Generator 
    31 # 
    32 def uuidgen(): 
    33    return commands.getoutput('uuidgen -t') 
    34  
    35  
    36 try:  
    37    doc_cfg = xml.dom.minidom.parse('../wavedev.cfg') 
    38 except:  #if not being called from wavedev, try looking for wavedev 
    39    doc_cfg = xml.dom.minidom.parse('/sdr/tools/WaveDev/wavedev.cfg') 
    40  
    41 version = str(doc_cfg.getElementsByTagName("version")[0].firstChild.data) 
    42  
    43 #vtext = open('../version.txt') 
    44 #version = unicode(vtext.readline()) 
    45 #version = version.strip('\n') 
    46 commentLine = u'<!--Created with OSSIE WaveDev ' + version \ 
    47     + u'-->\n<!--Powered by Python-->\n'  
     27from WaveDev.wavedev.uuidgen import uuidgen 
     28 
    4829 
    4930xmlpath = u'xml/' 
    5031binpath = u'bin/' 
    5132 
    52 def gen_scd(comp, waveformDir): 
     33def gen_scd(comp, waveformDir, wavedevPath): 
    5334    # Generate the componentfile entries 
    54     doc_scd = xml.dom.minidom.parse('XML_gen/_scd.xml.tpl') 
    55      
     35    doc_scd = xml.dom.minidom.parse(wavedevPath + 'XML_gen/_scd.xml.tpl') 
     36 
    5637    int_types = {} 
    5738 
    5839    portsNode = doc_scd.getElementsByTagName("ports")[0] 
    59      
     40 
    6041    # add provides ports to .scd.xml file 
    6142    for p in comp.ports: 
     
    7455        # append new provides port to <ports> 
    7556        portsNode.appendChild(providesPortNode) 
    76          
     57 
    7758        if p.interface.name not in int_types: 
    7859            int_types[p.interface.name] = copy.deepcopy(p.interface) 
    7960 
    8061        del providesPortNode, portTypeNode 
    81      
     62 
    8263    # add uses ports to .scd.xml file 
    8364    for p in comp.ports: 
     
    9374        portTypeNode.setAttribute("type", unicode(p.portType)) 
    9475        usesPortNode.appendChild(portTypeNode) 
    95          
     76 
    9677        # append new uses port to <ports> 
    9778        portsNode.appendChild(usesPortNode) 
    98          
     79 
    9980        if p.interface.name not in int_types: 
    10081            int_types[p.interface.name] = copy.deepcopy(p.interface) 
    10182 
    10283        del usesPortNode, portTypeNode 
    103      
     84 
    10485    # Add interfaces 
    10586    interfacesRootNode = doc_scd.getElementsByTagName("softwarecomponent")[0].getElementsByTagName("interfaces")[0] 
     
    11596    compDir = waveformDir + comp.name + '/' 
    11697    outputFileName_scd = comp.name + '.scd.xml' 
    117      
     98 
     99    # Define <!DOCTYPE> here (overriding template if necessary) 
     100    ensureDocType(doc_scd, u'softwarecomponent', u'../dtd/softwarecomponent.dtd') 
    118101    data = doc_scd.toxml('UTF-8') 
    119102    xmlBeautify.beautify(data,compDir + '.' + outputFileName_scd + '.tmp') 
     
    121104    preProcessed_scd = open(compDir + '.' + outputFileName_scd + '.tmp', 'r') 
    122105    postProcessed_scd = open(compDir + outputFileName_scd, 'w') 
    123      
     106 
    124107    # Specify external DTD 
    125108    line0 = preProcessed_scd.readline() 
     
    130113    postProcessed_scd.writelines(remaining) 
    131114    postProcessed_scd.close() 
    132     
     115 
    133116    # Remove temporary files 
    134117    os.remove(compDir + '.' + outputFileName_scd + '.tmp') 
    135     
    136     
    137 def gen_spd(comp, waveformDir): 
    138     componentName = unicode(comp.name)     
     118 
     119 
     120def gen_spd(comp, waveformDir, wavedevPath): 
     121    componentName = unicode(comp.name) 
    139122    componentDescr = unicode(comp.description) 
    140      
    141     doc_spd = xml.dom.minidom.parse('XML_gen/_spd.xml.tpl') 
    142     
     123 
     124    doc_spd = xml.dom.minidom.parse(wavedevPath + 'XML_gen/_spd.xml.tpl') 
     125 
    143126    #doc_spd.softpkg.name = u'ossie' + componentName + u'Resource' 
    144127    softpkgNode = doc_spd.getElementsByTagName("softpkg")[0] 
    145128    softpkgNode.setAttribute("name",componentName) 
    146129    softpkgNode.setAttribute("id", u'DCE:' + unicode(uuidgen()) ) 
    147      
     130 
    148131    # set the general resource description 
    149132    # note: this is NOT the description of the implementation 
     
    157140    propertyfilePathNode = softpkgNode.getElementsByTagName("propertyfile")[0].getElementsByTagName("localfile")[0] 
    158141    propertyfilePathNode.setAttribute("name", xmlpath + componentName  + '/' + componentName + u'.prf.xml') 
    159      
     142 
    160143    # set the descriptor file path 
    161144    descriptorPathNode = softpkgNode.getElementsByTagName("descriptor")[0].getElementsByTagName("localfile")[0] 
    162145    descriptorPathNode.setAttribute("name", xmlpath + componentName + '/' + componentName + u'.scd.xml') 
    163      
     146 
    164147    # set the implementation id 
    165148    implementationNode = softpkgNode.getElementsByTagName("implementation")[0] 
     
    167150    implementationNode.getElementsByTagName("code")[0].getElementsByTagName("localfile")[0].setAttribute( \ 
    168151        "name", binpath + componentName) 
    169      
     152 
    170153    # Now do final processing and write to file 
    171154    compDir = waveformDir + comp.name + '/' 
    172155    outputFileName_spd = comp.name + '.spd.xml' 
    173156    #outputFileName_spd = comp.name + 'Resource' + '.spd.xml' 
    174      
     157 
     158    # Define <!DOCTYPE> here (overriding template if necessary) 
     159    ensureDocType(doc_spd, u'softpkg', u'../dtd/softpkg.dtd') 
    175160    data = doc_spd.toxml('UTF-8') 
    176161    xmlBeautify.beautify(data,compDir + '.' + outputFileName_spd + '.tmp') 
     
    178163    preProcessed_spd = open(compDir + '.' + outputFileName_spd + '.tmp', 'r') 
    179164    postProcessed_spd = open(compDir + outputFileName_spd, 'w') 
    180      
     165 
    181166    # Specify external DTD 
    182167    line0 = preProcessed_spd.readline() 
     
    187172    postProcessed_spd.writelines(remaining) 
    188173    postProcessed_spd.close() 
    189     
     174 
    190175    # Remove temporary files 
    191176    os.remove(compDir + '.' + outputFileName_spd + '.tmp') 
    192      
    193 def gen_prf(comp, waveformDir): 
    194     componentName = unicode(comp.name)     
    195     doc_prf = xml.dom.minidom.parse('XML_gen/_prf.xml.tpl') 
    196      
     177 
     178def gen_prf(comp, waveformDir, wavedevPath): 
     179    componentName = unicode(comp.name) 
     180    doc_prf = xml.dom.minidom.parse(wavedevPath + 'XML_gen/_prf.xml.tpl') 
     181 
    197182    propertiesNode = doc_prf.getElementsByTagName("properties")[0] 
    198183 
     
    231216        descriptionNode.appendChild(descriptionText) 
    232217        e.appendChild(descriptionNode) 
    233              
     218 
    234219        # Add the property kind 
    235220        kindNode = doc_prf.createElement("kind") 
     
    238223 
    239224        propertiesNode.appendChild(e) 
    240              
     225 
    241226    # Create a simplesequence of string type that lists each Provides port in the component 
    242227    # Used for connecting to components from outside the framework (ex. control gui) 
     
    277262 
    278263        propertiesNode.appendChild(e) 
    279      
     264 
    280265    # Now do final processing and write to file 
    281266    compDir = waveformDir + comp.name + '/' 
    282267    outputFileName_prf = comp.name + '.prf.xml' 
    283268    #outputFileName_prf = comp.name + 'Resource' + '.prf.xml' 
    284      
     269 
     270    # Define <!DOCTYPE> here (overriding template if necessary) 
     271    ensureDocType(doc_prf, u'properties', u'../dtd/properties.dtd') 
    285272    data = doc_prf.toxml('UTF-8') 
    286273    xmlBeautify.beautify(data,compDir + '.' + outputFileName_prf + '.tmp') 
     
    288275    preProcessed_prf = open(compDir + '.' + outputFileName_prf + '.tmp', 'r') 
    289276    postProcessed_prf = open(compDir + outputFileName_prf, 'w') 
    290      
     277 
    291278    # Specify external DTD 
    292279    line0 = preProcessed_prf.readline() 
     
    297284    postProcessed_prf.writelines(remaining) 
    298285    postProcessed_prf.close() 
    299     
     286 
    300287    # Remove temporary files 
    301288    os.remove(compDir + '.' + outputFileName_prf + '.tmp') 
     289 
     290def ensureDocType(xmldoc, name, systemId): 
     291    # Define <!DOCTYPE> here (overriding template if necessary) 
     292    if xmldoc.doctype == None: 
     293        xmldoc.doctype = xml.dom.minidom.DocumentType(name) 
     294        xmldoc.insertBefore(xmldoc.doctype, xmldoc.firstChild) 
     295    xmldoc.doctype.name = name 
     296    xmldoc.doctype.systemId = systemId 
  • ossiedev/trunk/tools/WaveDev/wavedev/generate/genNode.py

    r5915 r8046  
    2323 
    2424class genAll: 
    25   def __init__(self,path,node): 
     25  def __init__(self, path, wavedevPath, node): 
    2626    if path[len(path)-1] != '/': 
    2727        path = path + '/' 
     28    self.path = path 
     29    if wavedevPath[len(wavedevPath)-1] != '/': 
     30        wavedevPath = wavedevPath + '/' 
    2831    self.path = path 
    2932    self.node = node 
     
    3740       errorMsg(self,"Node already exists - exiting") 
    3841       exit(1) 
    39         
    40     if os.path.exists(self.path+self.node.name) == False:    
     42 
     43    if os.path.exists(self.path+self.node.name) == False: 
    4144        os.mkdir(self.path + self.node.name) 
    42          
    43     shutil.copy('generate/reconf',self.path + self.node.name) 
    44                  
     45 
     46    shutil.copy(self.wavedevPath + 'generate/reconf',self.path + self.node.name) 
     47 
    4548  ############################################################################## 
    4649  ## writeMakefiles - generates the make file for the waveform and then calls 
     
    5255    Flags = ["-Wall"] 
    5356    self.info2str(output,"AM_CXXFLAGS = ",Flags,1) 
    54      
     57 
    5558    tstr = "ossieName = " + self.node.name + '\n\n' 
    5659    output.write(tstr) 
    57      
     60 
    5861    tstr = "waveformdir = $(prefix)/nodes/$(ossieName)\n" 
    5962    output.write(tstr) 
     
    8184      if mycount%2 == 0 and wrap and mylist.index(x) != len(mylist)-1: 
    8285        tstr = tstr + "\\\n" 
    83    
     86 
    8487    tstr = tstr + "\n" 
    8588    for x in range(extraLine): 
     
    9396  def genConfigureACFiles(self,installPath="/sdr/sca"): 
    9497    if installPath[-1] == '/': 
    95         installPath = installPath[0:-1]   
    96        
     98        installPath = installPath[0:-1] 
     99 
    97100    tmpPath = self.path + self.node.name + '/' 
    98101    self.writeConfAC(tmpPath,self.node.name,False,False,installPath) 
    99          
     102 
    100103  ############################################################################## 
    101104  ## writeConfAC - generates configure.ac files for autoconf 
     
    104107     if genPath[len(genPath)-1] != '/': 
    105108        genPath = genPath + '/' 
    106        
     109 
    107110     output = open(genPath + 'configure.ac','w') 
    108111     tstr = "AC_INIT(" + name + ", 0.5.0)\n\n" 
     
    116119     output.write(tstr) 
    117120     output.close() 
    118      
    119   ##############################################################################       
     121 
     122  ############################################################################## 
    120123  ## This function generates the cpp and h files for each component: 
    121124  ## component.h, component.cpp, main.cpp, port_impl.h, and port_impl.cpp 
    122   ##############################################################################       
     125  ############################################################################## 
    123126  def genCompFiles(self,comp): 
    124127      #for x in self.active_wave.components: 
    125128        # generate the .h files for each component 
    126         inputH = open('generate/sampleComp.h','r') 
     129        inputH = open(self.wavedevPath + 'generate/sampleComp.h','r') 
    127130        outputH = open(self.path + comp.name + "/" + comp.name + ".h",'w') 
    128131        self.addGPL(outputH,comp.name) 
     
    147150                  l_out = l_out.replace("__ACE_SVC_DECL__",'int svc(void);\n        size_t queue_size;') 
    148151              else: 
    149                   continue    
     152                  continue 
    150153          if l_out.find("__FRIEND_DECL__") != -1: 
    151154              l_out = l_out.replace("__FRIEND_DECL__","") 
    152155              self.writeFriendDecl(outputH,comp) 
    153156              continue 
    154                     
     157 
    155158          outputH.write(l_out) 
    156            
     159 
    157160        inputH.close() 
    158161        outputH.close() 
    159          
     162 
    160163        # generate the .cpp files for each component 
    161         inputCPP = open('generate/sampleComp.cpp','r') 
     164        inputCPP = open(self.wavedevPath + 'generate/sampleComp.cpp','r') 
    162165        outputCPP = open(self.path + comp.name + "/" + comp.name + ".cpp",'w') 
    163166        self.addGPL(outputCPP,comp.name) 
     
    181184              if comp.ace == True: 
    182185                  self.writeACESvcDef(outputCPP,comp,'component',comp.timing, comp) 
    183               continue               
     186              continue 
    184187          outputCPP.write(l_out) 
    185            
     188 
    186189        inputCPP.close() 
    187190        outputCPP.close() 
    188          
     191 
    189192        # generate the main.cpp files for each component 
    190         inputMain = open('generate/sampleMain.cpp','r') 
     193        inputMain = open(self.wavedevPath + 'generate/sampleMain.cpp','r') 
    191194        outputMain = open(self.path + comp.name + "/main.cpp",'w') 
    192195        self.addGPL(outputMain,comp.name) 
    193          
     196 
    194197        for line in inputMain.readlines(): 
    195198          l_out = line.replace("__IncludeFile__",comp.name) 
     
    200203                  l_out = l_out.replace("__CLASS_VAR_ACE__",comp.name.lower()) 
    201204              else: 
    202                   continue           
     205                  continue 
    203206          if l_out.find("__NAME_SPACE__") != -1: 
    204207              ns_list = [] 
     
    211214 
    212215          outputMain.write(l_out) 
    213            
     216 
    214217        inputMain.close() 
    215218        outputMain.close() 
    216          
     219 
    217220        # generate the port_impl.h file 
    218         inputPortImpl = open('generate/port_impl.h','r') 
     221        inputPortImpl = open(self.wavedevPath + 'generate/port_impl.h','r') 
    219222        outputPortImpl = open(self.path + comp.name + "/port_impl.h",'w') 
    220223        self.addGPL(outputPortImpl,comp.name) 
    221         portSample_p = open('generate/port_sample_p.h','r') 
    222         portSample_u = open('generate/port_sample_u.h','r') 
     224        portSample_p = open(self.wavedevPath + 'generate/port_sample_p.h','r') 
     225        portSample_u = open(self.wavedevPath + 'generate/port_sample_u.h','r') 
    223226        for line in inputPortImpl.readlines(): 
    224227            l_out = line.replace("__IncludeFile__",comp.name) 
     
    235238            if l_out.find("__PORT_DECL__") != -1: 
    236239              self.writePortImplDecl(outputPortImpl,portSample_p,portSample_u,comp) 
    237               continue           
     240              continue 
    238241            outputPortImpl.write(l_out) 
    239              
     242 
    240243        inputPortImpl.close() 
    241244        outputPortImpl.close() 
    242245        portSample_p.close() 
    243246        portSample_u.close() 
    244          
     247 
    245248        # generate the port_impl.cpp file 
    246         inputPortImpl = open('generate/port_impl.cpp','r') 
     249        inputPortImpl = open(self.wavedevPath + 'generate/port_impl.cpp','r') 
    247250        outputPortImpl = open(self.path + comp.name + "/port_impl.cpp",'w') 
    248251        self.addGPL(outputPortImpl,comp.name) 
    249         portSample_p = open('generate/port_sample_p.cpp','r') 
    250         portSample_u = open('generate/port_sample_u.cpp','r') 
     252        portSample_p = open(self.wavedevPath + 'generate/port_sample_p.cpp','r') 
     253        portSample_u = open(self.wavedevPath + 'generate/port_sample_u.cpp','r') 
    251254        for line in inputPortImpl.readlines(): 
    252255            l_out = line 
     
    255258              continue 
    256259            outputPortImpl.write(l_out) 
    257              
     260 
    258261        inputPortImpl.close() 
    259262        outputPortImpl.close() 
    260263        portSample_p.close() 
    261264        portSample_u.close() 
    262          
     265 
    263266    # Copy some required files into the main directory 
    264267    #  os.system('cp generate/basic_xml/* ' + self.path) 
     
    275278        output.write(ts) 
    276279    ts = '\n';output.write(ts); 
    277     intList = []  
     280    intList = [] 
    278281    for x in c.ports: 
    279282        if x.interface.name in intList: 
     
    339342                else: 
    340343                    l_out = l_out.replace("__COMP_REF_DECL__","") 
    341                  
     344 
    342345            output.write(l_out) 
    343346 
    344347  def writePortImplDef(self,output,portSample_p,portSample_u,c): 
    345348    """ This function writes port implementation definitions for the port_impl.cpp file""" 
    346     intList = []     
     349    intList = [] 
    347350    for x in c.ports: 
    348351        if x.interface.name in intList: 
     
    419422            outCount += 1 
    420423    ts = " "*8 + "bool component_alive;\n\n" + " "*8 + "string naming_service_name;\n"; output.write(ts) 
    421      
     424 
    422425  def writePortInst(self,output,c): 
    423426    """ This function writes the port instantiations to the component cpp file""" 
     
    442445    ts = "\n"; output.write(ts) 
    443446    ts = " "*4 + "queue_size = DEFAULT_QUEUE_BLOCK_SIZE;\n\n" + " "*4 + "component_alive = true;\n\n" + " "*4 + "naming_service_name = label;\n"; output.write(ts) 
    444      
     447 
    445448  def writeGetPort(self,output,c): 
    446449    """ This function writes the getPort functionality to the component cpp file""" 
     
    475478    ts = "\n"; output.write(ts) 
    476479    ts = " "*4 + 'return NULL;\n'; output.write(ts) 
    477      
     480 
    478481  def writeDelPort(self,output,c): 
    479482    """ This function writes the destructor functionality (for ports) to the component cpp file""" 
     
    492495            outCount += 1 
    493496    ts = "\n"; output.write(ts) 
    494      
     497 
    495498##  def writeACESvcPorts(self,output,c): 
    496499##    """ This function writes the svc port functionality to the component cpp file""" 
     
    501504##            output.write(ts) 
    502505##            outCount += 1 
    503 ##    ts = "\n"; output.write(ts)   
    504      
     506##    ts = "\n"; output.write(ts) 
     507 
    505508  def writeACESvcDef(self, output,c,type,timing_flag, comp=''): 
    506509    """ This function writes the implementation of the svn() function for a given component""" 
     
    693696        ts = " "*8 + "//ACE_OS::sleep (ACE_Time_Value (1));\n"; output.write(ts) 
    694697        ts = " "*4 + '}\n\n' + " "*4 + 'return 0;\n}\n'; output.write(ts) 
    695          
     698 
    696699    if type == 'port': 
    697700        #ts = 'int ' + c.u_cname + '::svc(void)\n{\n'; output.write(ts) 
     
    837840                else: 
    838841                        ts = " "*4 + 'return 0;\n' + '}\n'; output.write(ts) 
    839      
     842 
    840843  def writeTimingMessageDef(self, output,c,type): 
    841844    if type == 'port': 
     
    859862 
    860863  def writeOperation(self,output,i,prefix='',cppFlag=False,in_name='',using_ace=False,comp='',port=''): 
    861     """ Writes the declaration or definition of an operation (pushPacket) to  
     864    """ Writes the declaration or definition of an operation (pushPacket) to 
    862865        the port_impl.h and port_impl.cpp files respectively """ 
    863866    ocount = 0 
    864867    for o in i.operations: 
    865          
     868 
    866869 
    867870        ocount += 1 
     
    876879            ts = prefix + " "*4 + o.returnType + ' ' + o.name + '(' 
    877880            tscxx = prefix + " "*4 + o.cxxReturnType + ' ' + o.name + '(' 
    878          
     881 
    879882        first = True 
    880883        for p in o.params: 
     
    882885            _USE_CONST_ = 'const ' 
    883886            _USE__OUT_ = '' 
    884             if p.direction == 'out':  
     887            if p.direction == 'out': 
    885888                if len(p.dataType) > 8 and p.dataType[-8:] != 'Sequence': 
    886889                    _USE_CONST_ = '' 
     
    913916#        output.write(ts) 
    914917        output.write(tscxx) 
    915          
     918 
    916919        if cppFlag: 
    917920                #ts = "{\n" + " "*4 + "unsigned int len = " + "hello" + ".length();\n"; output.write(ts) 
     
    9981001                else: 
    9991002                        ts = "{\n\n}\n"; output.write(ts) 
    1000          
     1003 
    10011004  def writeFriendDecl(self,output,c): 
    10021005      friendList = [] 
     
    10081011              if p.p_cname not in friendList: 
    10091012                  friendList.append(p.p_cname) 
    1010                    
     1013 
    10111014      for x in friendList: 
    10121015          ts = " "*4 + "friend class " + x + ";\n" 
    1013           output.write(ts)  
    1014        
     1016          output.write(ts) 
     1017 
    10151018 
    10161019  def addGPL(self,outFile,name): 
    1017       inFile = open('generate/gpl_preamble','r') 
     1020      inFile = open(self.wavedevPath + 'generate/gpl_preamble','r') 
    10181021      for line in inFile.readlines(): 
    10191022          l_out = line.replace("__COMP_NAME__",name) 
    10201023          outFile.write(l_out) 
    1021          
     1024 
    10221025      inFile.close() 
    1023            
    1024          
     1026 
     1027 
    10251028  def cleanUp(self): 
    10261029      # Move the AssemblyController to the waveform Dir 
  • ossiedev/trunk/tools/WaveDev/wavedev/generate/templates/basic_ports/genStructure.py

    r5963 r8046  
    2828 
    2929class genAll: 
    30   def __init__(self,path,active_wave): 
     30  def __init__(self, path, wavedevPath, active_wave): 
    3131    if path[len(path)-1] != '/': 
    3232        path = path + '/' 
    3333    self.path = path 
     34    if len(wavedevPath) > 0 and wavedevPath[len(wavedevPath)-1] != '/': 
     35        wavedevPath = wavedevPath + '/' 
     36    self.wavedevPath = wavedevPath 
    3437    self.active_wave = active_wave 
    3538 
     
    4245       errorMsg(self,"Waveform already exists - exiting") 
    4346       exit(1) 
    44         
    45     if os.path.exists(self.path+self.active_wave.name) == False:    
     47 
     48    if os.path.exists(self.path+self.active_wave.name) == False: 
    4649        os.mkdir(self.path + self.active_wave.name) 
    47          
    48     shutil.copy('generate/reconf',self.path + self.active_wave.name) 
    49     for x in os.listdir('generate/basic_xml/'): 
     50 
     51    shutil.copy(self.wavedevPath + 'generate/reconf',self.path + self.active_wave.name) 
     52    for x in os.listdir(self.wavedevPath + 'generate/basic_xml/'): 
    5053        if not os.path.isdir(x): 
    51             shutil.copy('generate/basic_xml/' + x,self.path + self.active_wave.name) 
    52      
     54            shutil.copy(self.wavedevPath + 'generate/basic_xml/' + x,self.path + self.active_wave.name) 
     55 
    5356    for x in self.active_wave.components: 
    5457        if x.generate: 
     
    5659                os.mkdir(self.path+x.name) 
    5760            if x.AssemblyController != True: 
    58                 shutil.copy('generate/reconf',self.path + x.name) 
    59                 for f in os.listdir('generate/basic_xml/'): 
     61                shutil.copy(self.wavedevPath + 'generate/reconf',self.path + x.name) 
     62                for f in os.listdir(self.wavedevPath + 'generate/basic_xml/'): 
    6063                    if not os.path.isdir(f): 
    61                         shutil.copy('generate/basic_xml/' + f,self.path + x.name) 
    62                 shutil.copy('generate/LICENSE',self.path + x.name) 
    63                  
     64                        shutil.copy(self.wavedevPath + 'generate/basic_xml/' + f,self.path + x.name) 
     65                shutil.copy(self.wavedevPath + 'generate/LICENSE',self.path + x.name) 
     66 
    6467  ############################################################################## 
    6568  ## writeMakefiles - generates the make file for the waveform and then calls 
     
    7174    Flags = ["-Wall"] 
    7275    self.info2str(output,"AM_CXXFLAGS = ",Flags,1) 
    73      
     76 
    7477    tstr = "ossieName = " + self.active_wave.name + '\n\n' 
    7578    output.write(tstr) 
    76      
     79 
    7780    tstr = "SUBDIRS = " 
    7881    for c in self.active_wave.components: 
    7982        if c.AssemblyController == True and c.generate: 
    8083            tstr += c.name + '\n\n' 
    81             output.write(tstr)     
    82      
     84            output.write(tstr) 
     85 
    8386#    tstr = "waveformdir = $(prefix)/dom/waveforms/$(ossieName)\n" 
    8487    tstr = "waveformdir = $(prefix)/waveforms/" + self.active_wave.name + "\n" 
     
    102105 
    103106    output.close() 
    104      
     107 
    105108    for c in self.active_wave.components: 
    106109        if c.generate: 
    107110            tmpPath = self.path + c.name 
    108111            self.writeCompMakefile(c,tmpPath) 
    109              
    110   ##############################################################################  
     112 
     113  ############################################################################## 
    111114  ## writeCompMakefilee - generates the make file for an indivdual component 
    112115  ############################################################################## 
     
    114117    if compPath[len(compPath)-1] != '/': 
    115118        compPath = compPath + '/' 
    116      
     119 
    117120    Flags = ["-Wall"] 
    118      
     121 
    119122    output = open(compPath + 'Makefile.am','w') 
    120123    self.info2str(output,"AM_CXXFLAGS = ",Flags,1) 
    121      
     124 
    122125    tstr = "bin_PROGRAMS = " + comp.name + "\n\n" 
    123126    output.write(tstr) 
    124      
    125     tstr = comp.name + "_SOURCES = " + comp.name + ".cpp " + comp.name + ".h main.cpp\n\n"   
     127 
     128    tstr = comp.name + "_SOURCES = " + comp.name + ".cpp " + comp.name + ".h main.cpp\n\n" 
    126129    output.write(tstr) 
    127130    tstr = "ossieName = " + comp.name + "\n" 
    128131    output.write(tstr) 
    129        
     132 
    130133    tstr = "xmldir = $(prefix)/xml/$(ossieName)\n" 
    131134    output.write(tstr) 
    132      
     135 
    133136    tstr = "bindir = $(prefix)/bin\n" 
    134137    output.write(tstr) 
     
    141144    xmlData.append(tstr2 + ".spd.xml") 
    142145    self.info2str(output,"dist_xml_DATA = ",xmlData,1,wrapFlag=True) 
    143      
     146 
    144147    output.close() 
    145148 
     
    156159      if mycount%2 == 0 and wrap and mylist.index(x) != len(mylist)-1: 
    157160        tstr = tstr + "\\\n" 
    158    
     161 
    159162    tstr = tstr + "\n" 
    160163    for x in range(extraLine): 
     
    168171  def genConfigureACFiles(self,installPath): 
    169172    if installPath[-1] == '/': 
    170         installPath = installPath[0:-1]   
    171        
     173        installPath = installPath[0:-1] 
     174 
    172175    tmpPath = self.path + self.active_wave.name + '/' 
    173176    self.writeConfAC(tmpPath,self.active_wave.name,self.active_wave.ace,True,installPath) 
    174      
     177 
    175178    for c in self.active_wave.components: 
    176179        if c.AssemblyController ==  True or not c.generate: 
     
    178181        tmpPath = self.path + c.name + '/' 
    179182        self.writeConfAC(tmpPath,c.name,c.ace,False,installPath) 
    180          
     183 
    181184  ############################################################################## 
    182185  ## writeConfAC - generates configure.ac files for autoconf 
     
    185188     if genPath[len(genPath)-1] != '/': 
    186189        genPath = genPath + '/' 
    187        
     190 
    188191     output = open(genPath + 'configure.ac','w') 
    189192     tstr = "AC_INIT(" + name + ", 0.6.0)\nAM_INIT_AUTOMAKE\n\n" 
     
    199202     #tstr = "AC_CORBA_ORB\n\n" 
    200203     #output.write(tstr) 
    201       
     204 
    202205     tstr = 'AC_LANG_PUSH([C++])\n\n' 
    203206     output.write(tstr) 
     
    235238     tstr = 'IDL_FLAGS="$OSSIE_CFLAGS"\nAC_SUBST(IDL_FLAGS)\n\n' 
    236239     output.write(tstr) 
    237       
     240 
    238241     if aceFlag == True: 
    239242         tstr = 'PKG_CHECK_MODULES(ACE, ACE >= 5.4.7)\n' 
    240243         tstr = tstr + 'AC_SUBST(ACE_CFLAGS)\nAC_SUBST(ACE_LIBS)\nLIBS="$LIBS $ACE_LIBS"\n\n' 
    241244         output.write(tstr) 
    242       
     245 
    243246     tstr = 'LIBS="$LIBS $OSSIE_LIBS"\n\n' 
    244247     output.write(tstr) 
    245       
     248 
    246249     tstr = 'AC_SUBST(SI_PATH)\n\n' 
    247250     output.write(tstr) 
    248       
    249      tstr = "AC_CONFIG_FILES(Makefile"      
     251 
     252     tstr = "AC_CONFIG_FILES(Makefile" 
    250253     if wavFlag == True: 
    251254        for x in self.active_wave.components: 
     
    253256                tstr2 = " " + x.name + "/Makefile" 
    254257                tstr = tstr + tstr2 
    255             
    256      tstr = tstr + ")\n\n"  
     258 
     259     tstr = tstr + ")\n\n" 
    257260     output.write(tstr) 
    258261 
     
    261264 
    262265     output.close() 
    263      
    264   ##############################################################################       
     266 
     267  ############################################################################## 
    265268  ## This function generates the cpp and h files for each component: 
    266269  ## component.h, component.cpp, main.cpp, port_impl.h, and port_impl.cpp 
    267   ##############################################################################       
    268   def genCompFiles(self,comp):           
     270  ############################################################################## 
     271  def genCompFiles(self,comp): 
    269272      #for x in self.active_wave.components: 
    270273        # generate the .h files for each component 
    271         inputH = open('generate/templates/basic_ports/sampleComp.h','r') 
     274        inputH = open(self.wavedevPath + 'generate/templates/basic_ports/sampleComp.h','r') 
    272275        outputH = open(self.path + comp.name + "/" + comp.name + ".h",'w') 
    273276        self.addGPL(outputH,comp.name) 
     
    307310                  l_out = l_out.replace("__ACE_SVC_DECL__",'int svc(void);') 
    308311              else: 
    309                   continue    
     312                  continue 
    310313          if l_out.find("__FRIEND_DECL__") != -1: 
    311314              l_out = l_out.replace("__FRIEND_DECL__","") 
    312315              self.writeFriendDecl(outputH,comp) 
    313316              continue 
    314                     
     317 
    315318          outputH.write(l_out) 
    316            
     319 
    317320        inputH.close() 
    318321        outputH.close() 
    319          
     322 
    320323        # generate the .cpp files for each component 
    321         inputCPP = open('generate/templates/basic_ports/sampleComp.cpp','r') 
     324        inputCPP = open(self.wavedevPath + 'generate/templates/basic_ports/sampleComp.cpp','r') 
    322325        outputCPP = open(self.path + comp.name + "/" + comp.name + ".cpp",'w') 
    323326        self.addGPL(outputCPP,comp.name) 
     
    357360              if comp.ace == True: 
    358361                  self.writeACESvcDef(outputCPP,comp,'component') 
    359               continue               
     362              continue 
    360363          outputCPP.write(l_out) 
    361            
     364 
    362365        inputCPP.close() 
    363366        outputCPP.close() 
    364          
     367 
    365368        # generate the main.cpp files for each component 
    366         inputMain = open('generate/templates/basic_ports/sampleMain.cpp','r') 
     369        inputMain = open(self.wavedevPath + 'generate/templates/basic_ports/sampleMain.cpp','r') 
    367370        outputMain = open(self.path + comp.name + "/main.cpp",'w') 
    368371        self.addGPL(outputMain,comp.name) 
    369          
     372 
    370373        for line in inputMain.readlines(): 
    371374          l_out = line.replace("__IncludeFile__",comp.name) 
     
    377380                  l_out = l_out.replace("__CLASS_VAR_ACE__",comp.name.lower()) 
    378381              else: 
    379                   continue           
     382                  continue 
    380383          outputMain.write(l_out) 
    381            
     384 
    382385        inputMain.close() 
    383386        outputMain.close() 
    384387 
    385388        # generate the Doxygen documentation.txt file 
    386         inputDoc = open('generate/templates/basic_ports/sampleDocumentation.txt','r') 
     389        inputDoc = open(self.wavedevPath + 'generate/templates/basic_ports/sampleDocumentation.txt','r') 
    387390        outputDoc = open(self.path + comp.name + '/documentation.txt','w') 
    388391        self.addGPL(outputDoc, comp.name) 
     
    395398 
    396399        # generate the Doxygen configure file 
    397         inputDoxy = open('generate/templates/basic_ports/sampleDoxyfile','r') 
     400        inputDoxy = open(self.wavedevPath + 'generate/templates/basic_ports/sampleDoxyfile','r') 
    398401        outputDoxy = open(self.path + comp.name + '/Doxyfile','w') 
    399402 
     
    407410############################################################################################# 
    408411 
    409          
    410         ##code for generating port_impl.h and .cpp files has been temporarily  
    411         ##commented out. this code should be rewritten to put port_impl  
     412 
     413        ##code for generating port_impl.h and .cpp files has been temporarily 
     414        ##commented out. this code should be rewritten to put port_impl 
    412415        ##functionality into the appropriate .cpp function 
    413416##        # generate the port_impl.h file 
    414 ##        inputPortImpl = open('generate/port_impl.h','r') 
     417##        inputPortImpl = open(self.wavedevPath + 'generate/port_impl.h','r') 
    415418##        outputPortImpl = open(self.path + comp.name + "/port_impl.h",'w') 
    416419##        self.addGPL(outputPortImpl,comp.name) 
    417 ##        portSample = open('generate/port_sample.h','r') 
     420##        portSample = open(self.wavedevPath + 'generate/port_sample.h','r') 
    418421##        for line in inputPortImpl.readlines(): 
    419422##            l_out = line.replace("__IncludeFile__",comp.name) 
     
    425428##            if l_out.find("__PORT_DECL__") != -1: 
    426429##              self.writePortImplDecl(outputPortImpl,portSample,comp) 
    427 ##              continue           
     430##              continue 
    428431##            outputPortImpl.write(l_out) 
    429 ##             
     432## 
    430433##        inputPortImpl.close() 
    431434##        outputPortImpl.close() 
    432435##        portSample.close() 
    433 ##         
     436## 
    434437##        # generate the port_impl.cpp file 
    435 ##        inputPortImpl = open('generate/port_impl.cpp','r') 
     438##        inputPortImpl = open(self.wavedevPath + 'generate/port_impl.cpp','r') 
    436439##        outputPortImpl = open(self.path + comp.name + "/port_impl.cpp",'w') 
    437440##        self.addGPL(outputPortImpl,comp.name) 
    438 ##        portSample = open('generate/port_sample.cpp','r') 
     441##        portSample = open(self.wavedevPath + 'generate/port_sample.cpp','r') 
    439442##        for line in inputPortImpl.readlines(): 
    440443##            l_out = line 
     
    443446##              continue 
    444447##            outputPortImpl.write(l_out) 
    445 ##             
     448## 
    446449##        inputPortImpl.close() 
    447450##        outputPortImpl.close() 
    448451##        portSample.close() 
    449          
     452 
    450453    # Copy some required files into the main directory 
    451     #  os.system('cp generate/basic_xml/* ' + self.path) 
    452     #  os.system('cp generate/wavLoader.py ' + self.path) 
     454    #  os.system('cp ' + self.wavedevPath + 'generate/basic_xml/* ' + self.path) 
     455    #  os.system('cp ' + self.wavedevPath + 'generate/wavLoader.py ' + self.path) 
    453456#################################################################################################### 
    454457#--------------------------------------------------------------------------------------------------- 
    455458 
    456459 
    457      
     460 
    458461#---------------------------------------------------------------------------------- 
    459462################################################################################### 
     
    629632                output.write(ts) 
    630633                compLong += 1 
    631          
     634 
    632635 
    633636            elif x.interface.name == "realShort" and realShort == 0: 
     
    665668################################################################################## 
    666669 
    667      
     670 
    668671#  def writePortImplDecl(self, output,portSample,c): 
    669672#    """ This function writes port implementation declarations for the port_impl.h file""" 
     
    676679#        output.write(ts) 
    677680#    ts = '\n';output.write(ts); 
    678 #    intList = []     
     681#    intList = [] 
    679682#    for x in c.ports: 
    680683#        if x.interface.name in intList: 
     
    712715#                else: 
    713716#                    l_out = l_out.replace("__COMP_REF_DECL__","") 
    714 #                 
     717# 
    715718#            output.write(l_out) 
    716719 
     
    730733    for x in c.properties: 
    731734        tmp_type = str(x.type) 
    732               
     735 
    733736        if x.elementType == "Simple": 
    734             ts = " "*8 + "CORBA::" + tmp_type.capitalize() + " simple_" + str(simpleCount) + "_value;\n";  
     737            ts = " "*8 + "CORBA::" + tmp_type.capitalize() + " simple_" + str(simpleCount) + "_value;\n"; 
    735738            output.write(ts) 
    736739            simpleCount += 1; 
     
    749752    for x in c.properties: 
    750753        tmp_type = str(x.type) 
    751               
     754 
    752755        if x.elementType == "SimpleSequence": 
    753             ts = " "*8 + "CORBA::" + tmp_type.capitalize() + "Seq *simplesequence_" + str(simplesequenceCount) + ";\n"  
     756            ts = " "*8 + "CORBA::" + tmp_type.capitalize() + "Seq *simplesequence_" + str(simplesequenceCount) + ";\n" 
    754757            output.write(ts) 
    755758            simplesequenceCount = simplesequenceCount + 1 
     
    759762################################################################################ 
    760763#------------------------------------------------------------------------------- 
    761        
    762        
     764 
     765 
    763766#-------------------------------------------------------------------------------------------------------------- 
    764767############################################################################################################### 
     
    766769#  def writePortImplDef(self,output,portSample,c): 
    767770#    """ This function writes port implementation definitions for the port_impl.cpp file""" 
    768 #    intList = []     
     771#    intList = [] 
    769772#    for x in c.ports: 
    770773#        if x.interface.name in intList: 
     
    799802############################################################################################################### 
    800803#------------------------------------------------------------------------------------------------------------- 
    801              
     804 
    802805 
    803806#-------------------------------------------------------------------------------------------------------------- 
     
    825828#-------------------------------------------------------------------------------------------------------------- 
    826829############################################################################################################### 
    827     
     830 
    828831#  def writePortInst(self,output,c): 
    829832#    """ This function writes the port instantiations to the component cpp file""" 
     
    850853#--------------------------------------------------------------------------------- 
    851854################################################################################## 
    852      
     855 
    853856  def writeGetPort(self,output,c): 
    854857    """ This function writes the getPort functionality to the component cpp file""" 
     
    865868            continue 
    866869 
    867         ts = "\n"; output.write(ts)         
     870        ts = "\n"; output.write(ts) 
    868871        ts = " "*4 + "if (!CORBA::is_nil(p))\n"; output.write(ts) 
    869872        ts = " "*8 + "return p._retn();\n\n"; output.write(ts) 
    870          
     873 
    871874    ts = " "*4 + '/*exception*/\n'; output.write(ts) 
    872875    ts = " "*4 + 'throw CF::PortSupplier::UnknownPort();\n'; output.write(ts) 
     
    905908    for x in c.ports: 
    906909        if x.type == "Uses": 
    907             ts = " "*4 + 'delete dataOut_' + str(outCount) + ';\n';  
     910            ts = " "*4 + 'delete dataOut_' + str(outCount) + ';\n'; 
    908911            output.write(ts) 
    909912            outCount += 1; 
    910          
     913 
    911914        elif x.type == "Provides": 
    912             ts = " "*4 + 'delete dataIn_' + str(inCount) + ';\n';  
    913             output.write(ts)  
     915            ts = " "*4 + 'delete dataIn_' + str(inCount) + ';\n'; 
     916            output.write(ts) 
    914917            inCount += 1; 
    915918        else: 
     
    925928    for x in c.properties: 
    926929        tmp_type = str(x.type) 
    927               
     930 
    928931        if x.elementType == "SimpleSequence": 
    929             ts = " "*4 + "delete []simplesequence_" + str(simplesequenceCount) + ";\n"  
     932            ts = " "*4 + "delete []simplesequence_" + str(simplesequenceCount) + ";\n" 
    930933            output.write(ts) 
    931934            simplesequenceCount += 1; 
     
    938941#---------------------------------------------------------------------------------- 
    939942################################################################################### 
    940      
     943 
    941944  def writeReadProps(self,output,c): 
    942945    """write the code that will read properties from the prf file""" 
    943946    simpleCount = 0; 
    944     simplesequenceCount = 0;  
     947    simplesequenceCount = 0; 
    945948    #make sure there are properties first 
    946      
     949 
    947950    ts = " "*4 + 'std::cout << "props length : " << props.length() << std::endl;\n\n' 
    948951    ts = ts + " "*4 + "for (unsigned int i = 0; i <props.length(); i++)\n" 
     
    950953    ts = " "*8 + 'std::cout << "Property id : " << props[i].id << std::endl;\n\n' 
    951954    output.write(ts) 
    952          
     955 
    953956    for p in c.properties: 
    954          
     957 
    955958        ts = " "*8 + 'if (strcmp(props[i].id, "' + p.id + '") == 0)\n' + " "*8 + "{\n";output.write(ts) 
    956              
     959 
    957960        if p.elementType == "Simple": 
    958961            tmp_type = "unsupported_type"; 
     
    971974            ts = " "*12 + "CORBA::" + str(tmp_type) + " simple_temp;\n"; 
    972975            output.write(ts) 
    973             ts = " "*12 + 'props[i].value >>= simple_temp;\n';  
     976            ts = " "*12 + 'props[i].value >>= simple_temp;\n'; 
    974977            ts = ts + " "*12 + 'simple_' + str(simpleCount) + '_value = simple_temp;\n'; 
    975978            ts = ts + " "*8 + "}\n\n" 
     
    992995 
    993996            ts = " "*12 + "props[i].value >>= simplesequence_" + str(simplesequenceCount) + ";\n"; 
    994             output.write(ts)  
    995  
    996             ts = " "*8 + "}\n\n"        # close the if statement  
     997            output.write(ts) 
     998 
     999            ts = " "*8 + "}\n\n"        # close the if statement 
    9971000            output.write(ts) 
    9981001 
    9991002            simplesequenceCount += 1; 
    1000         else:  
     1003        else: 
    10011004            print "WARNING: properties other than simple and simple sequence are not supported yet" 
    10021005            continue 
    1003      
     1006 
    10041007    ts = " "*4 + "}\n"; output.write(ts)  #closes the for loop 
    10051008 
    10061009################################################################################# 
    10071010#-------------------------------------------------------------------------------- 
    1008   
    1009  
    1010   
     1011 
     1012 
     1013 
    10111014#-------------------------------------------------------------------------------- 
    10121015################################################################################# 
    1013      
     1016 
    10141017 
    10151018  def writeProcessDataDeclaration(self,output,c): 
    10161019    """This function sets up the majority of the process data function (in the .cpp file) based on the port type""" 
    1017      
     1020 
    10181021    outPort_present = False 
    10191022    inPort_present = False 
     
    10221025    #declare the output (uses) variables 
    10231026    for x in c.ports:  #assumes that you have at least one port 
    1024         if x.type == "Uses":   
     1027        if x.type == "Uses": 
    10251028 
    10261029            if x.interface.name == "complexShort": 
    1027                 ts = " "*4 + "PortTypes::ShortSequence I_out_" + str(outCount) + ", Q_out_" + str(outCount) + ";\n";  
    1028                 output.write(ts)     
     1030                ts = " "*4 + "PortTypes::ShortSequence I_out_" + str(outCount) + ", Q_out_" + str(outCount) + ";\n"; 
     1031                output.write(ts) 
    10291032                outCount += 1; 
    10301033 
    10311034            elif x.interface.name == "complexFloat": 
    1032                 ts = " "*4 + "PortTypes::FloatSequence I_out_" + str(outCount) + ", Q_out_" + str(outCount) + ";\n";  
     1035                ts = " "*4 + "PortTypes::FloatSequence I_out_" + str(outCount) + ", Q_out_" + str(outCount) + ";\n"; 
    10331036                output.write(ts) 
    10341037                outCount += 1; 
     
    10511054 
    10521055            elif x.interface.name == "realShort": 
    1053                 ts = " "*4 + "PortTypes::ShortSequence I_out_" + str(outCount) + ";\n";  
     1056                ts = " "*4 + "PortTypes::ShortSequence I_out_" + str(outCount) + ";\n"; 
    10541057                output.write(ts) 
    10551058                outCount += 1; 
    10561059            elif x.interface.name == "realFloat": 
    1057                 ts = " "*4 + "PortTypes::FloatSequence I_out_" + str(outCount) + ";\n";  
     1060                ts = " "*4 + "PortTypes::FloatSequence I_out_" + str(outCount) + ";\n"; 
    10581061                output.write(ts) 
    10591062                outCount += 1; 
    10601063            elif x.interface.name == "realDouble": 
    1061                 ts = " "*4 + "PortTypes::DoubleSequence I_out_" + str(outCount) + ";\n";  
     1064                ts = " "*4 + "PortTypes::DoubleSequence I_out_" + str(outCount) + ";\n"; 
    10621065                output.write(ts) 
    10631066                outCount += 1; 
    10641067 
    10651068            elif x.interface.name == "realChar": 
    1066                 ts = " "*4 + "PortTypes::CharSequence I_out_" + str(outCount) + ";\n";  
     1069                ts = " "*4 + "PortTypes::CharSequence I_out_" + str(outCount) + ";\n"; 
    10671070                output.write(ts) 
    10681071                outCount += 1; 
    10691072            elif x.interface.name == "realLong": 
    1070                 ts = " "*4 + "PortTypes::LongSequence I_out_" + str(outCount) + ";\n";  
     1073                ts = " "*4 + "PortTypes::LongSequence I_out_" + str(outCount) + ";\n"; 
    10711074                output.write(ts) 
    10721075                outCount += 1; 
     
    10841087    for x in c.ports: 
    10851088        if x.type == "Provides": 
    1086             
     1089 
    10871090            if x.interface.name == "complexShort": 
    1088                 ts = "\n" + " "*4 + "PortTypes::ShortSequence *I_in_"+str(inCount)+"(NULL), *Q_in_"+str(inCount)+"(NULL);\n";  
     1091                ts = "\n" + " "*4 + "PortTypes::ShortSequence *I_in_"+str(inCount)+"(NULL), *Q_in_"+str(inCount)+"(NULL);\n"; 
    10891092                output.write(ts) 
    10901093                ts = " "*4 + "CORBA::UShort I_in_" + str(inCount) + "_length, Q_in_" + str(inCount) + "_length;\n"; 
     
    11221125 
    11231126            elif x.interface.name == "realShort": 
    1124                 ts = "\n" + " "*4 + "PortTypes::ShortSequence *I_in_"+str(inCount)+"(NULL);\n";  
     1127                ts = "\n" + " "*4 + "PortTypes::ShortSequence *I_in_"+str(inCount)+"(NULL);\n"; 
    11251128                output.write(ts) 
    11261129                ts = " "*4 + "CORBA::UShort I_in_" + str(inCount) + "_length;\n"; 
     
    11291132 
    11301133            elif x.interface.name == "realFloat": 
    1131                 ts = "\n" + " "*4 + "PortTypes::FloatSequence *I_in_"+str(inCount)+"(NULL);\n";  
     1134                ts = "\n" + " "*4 + "PortTypes::FloatSequence *I_in_"+str(inCount)+"(NULL);\n"; 
    11321135                output.write(ts) 
    11331136                ts = " "*4 + "CORBA::UShort I_in_" + str(inCount) + "_length;\n"; 
     
    11361139 
    11371140            elif x.interface.name == "realDouble": 
    1138                 ts = "\n" + " "*4 + "PortTypes::DoubleSequence *I_in_"+str(inCount)+"(NULL);\n";  
     1141                ts = "\n" + " "*4 + "PortTypes::DoubleSequence *I_in_"+str(inCount)+"(NULL);\n"; 
    11391142                output.write(ts) 
    11401143                ts = " "*4 + "CORBA::UShort I_in_" + str(inCount) + "_length;\n"; 
     
    11431146 
    11441147            elif x.interface.name == "realChar": 
    1145                 ts = "\n" + " "*4 + "PortTypes::CharSequence *I_in_"+str(inCount)+"(NULL);\n";  
     1148                ts = "\n" + " "*4 + "PortTypes::CharSequence *I_in_"+str(inCount)+"(NULL);\n"; 
    11461149                output.write(ts) 
    11471150                ts = " "*4 + "CORBA::UShort I_in_" + str(inCount) + "_length;\n"; 
     
    11501153 
    11511154            elif x.interface.name == "realLong": 
    1152                 ts = "\n" + " "*4 + "PortTypes::LongSequence *I_in_"+str(inCount)+"(NULL);\n";  
     1155                ts = "\n" + " "*4 + "PortTypes::LongSequence *I_in_"+str(inCount)+"(NULL);\n"; 
    11531156                output.write(ts) 
    11541157                ts = " "*4 + "CORBA::UShort I_in_" + str(inCount) + "_length;\n"; 
     
    11611164            #only one provides port is supported at this point 
    11621165                continue 
    1163            
     1166 
    11641167################################################################################### 
    11651168#---------------------------------------------------------------------------------- 
     
    11681171################################################################################# 
    11691172 
    1170      
     1173 
    11711174  def writeProcessDataLoop(self,output,c): 
    11721175    """This function sets up the majority of the process data function (in the .cpp file) based on the port type""" 
    11731176    inCount = 0; 
    11741177    outCount = 0; 
    1175     ts = " "*4 + "while(1)\n" + " "*4 + "{\n";  
     1178    ts = " "*4 + "while(1)\n" + " "*4 + "{\n"; 
    11761179    output.write(ts) 
    1177      
     1180 
    11781181    #define input (provides) values input to them and get length on each loop 
    11791182    for x in c.ports: 
    11801183        if x.type == "Provides": 
    11811184            if x.interface.name == "complexShort": 
    1182                 ts = " "*8 + "dataIn_"+str(inCount)+"->getData(I_in_"+str(inCount)+", Q_in_"+str(inCount) + ");\n\n";  
     1185                ts = " "*8 + "dataIn_"+str(inCount)+"->getData(I_in_"+str(inCount)+", Q_in_"+str(inCount) + ");\n\n"; 
    11831186                output.write(ts) 
    11841187                ts = " "*8 + "I_in_" + str(inCount) + "_length = I_in_" + str(inCount) + "->length();\n"; 
     
    11891192 
    11901193            elif x.interface.name == "complexFloat": 
    1191                 ts = " "*8 + "dataIn_"+str(inCount)+"->getData(I_in_"+str(inCount)+", Q_in_"+str(inCount) + ");\n\n";  
     1194                ts = " "*8 + "dataIn_"+str(inCount)+"->getData(I_in_"+str(inCount)+", Q_in_"+str(inCount) + ");\n\n"; 
    11921195                output.write(ts) 
    11931196                ts = " "*8 + "I_in_" + str(inCount) + "_length = I_in_" + str(inCount) + "->length();\n"; 
     
    11981201 
    11991202            elif x.interface.name == "complexDouble": 
    1200                 ts = " "*8 + "dataIn_"+str(inCount)+"->getData(I_in_"+str(inCount)+", Q_in_"+str(inCount) + ");\n\n";  
     1203                ts = " "*8 + "dataIn_"+str(inCount)+"->getData(I_in_"+str(inCount)+", Q_in_"+str(inCount) + ");\n\n"; 
    12011204                output.write(ts) 
    12021205                ts = " "*8 + "I_in_" + str(inCount) + "_length = I_in_" + str(inCount) + "->length();\n"; 
     
    12071210 
    12081211            elif x.interface.name == "complexChar": 
    1209                 ts = " "*8 + "dataIn_"+str(inCount)+"->getData(I_in_"+str(inCount)+", Q_in_"+str(inCount) + ");\n\n";  
     1212                ts = " "*8 + "dataIn_"+str(inCount)+"->getData(I_in_"+str(inCount)+", Q_in_"+str(inCount) + ");\n\n"; 
    12101213                output.write(ts) 
    12111214                ts = " "*8 + "I_in_" + str(inCount) + "_length = I_in_" + str(inCount) + "->length();\n"; 
     
    12161219 
    12171220            elif x.interface.name == "complexLong": 
    1218                 ts = " "*8 + "dataIn_"+str(inCount)+"->getData(I_in_"+str(inCount)+", Q_in_"+str(inCount) + ");\n\n";  
     1221                ts = " "*8 + "dataIn_"+str(inCount)+"->getData(I_in_"+str(inCount)+", Q_in_"+str(inCount) + ");\n\n"; 
    12191222                output.write(ts) 
    12201223                ts = " "*8 + "I_in_" + str(inCount) + "_length = I_in_" + str(inCount) + "->length();\n"; 
     
    12251228 
    12261229            elif x.interface.name == "realShort": 
    1227                 ts = " "*8 + "dataIn_"+str(inCount)+"->getData(I_in_"+str(inCount)+");\n\n";  
     1230                ts = " "*8 + "dataIn_"+str(inCount)+"->getData(I_in_"+str(inCount)+");\n\n"; 
    12281231                output.write(ts) 
    12291232                ts = " "*8 + "I_in_" + str(inCount) + "_length = I_in_" + str(inCount) + "->length();\n\n"; 
     
    12321235 
    12331236            elif x.interface.name == "realFloat": 
    1234                 ts = " "*8 + "dataIn_"+str(inCount)+"->getData(I_in_"+str(inCount)+");\n\n";  
     1237                ts = " "*8 + "dataIn_"+str(inCount)+"->getData(I_in_"+str(inCount)+");\n\n"; 
    12351238                output.write(ts) 
    12361239                ts = " "*8 + "I_in_" + str(inCount) + "_length = I_in_" + str(inCount) + "->length();\n\n"; 
     
    12391242 
    12401243            elif x.interface.name == "realDouble": 
    1241                 ts = " "*8 + "dataIn_"+str(inCount)+"->getData(I_in_"+str(inCount)+");\n\n";  
     1244                ts = " "*8 + "dataIn_"+str(inCount)+"->getData(I_in_"+str(inCount)+");\n\n"; 
    12421245                output.write(ts) 
    12431246                ts = " "*8 + "I_in_" + str(inCount) + "_length = I_in_" + str(inCount) + "->length();\n\n"; 
     
    12461249 
    12471250            elif x.interface.name == "realChar": 
    1248                 ts = " "*8 + "dataIn_"+str(inCount)+"->getData(I_in_"+str(inCount)+");\n\n";  
     1251                ts = " "*8 + "dataIn_"+str(inCount)+"->getData(I_in_"+str(inCount)+");\n\n"; 
    12491252                output.write(ts) 
    12501253                ts = " "*8 + "I_in_" + str(inCount) + "_length = I_in_" + str(inCount) + "->length();\n\n"; 
     
    12521255                inCount += 1; 
    12531256            elif x.interface.name == "realLong": 
    1254                 ts = " "*8 + "dataIn_"+str(inCount)+"->getData(I_in_"+str(inCount)+");\n\n";  
     1257                ts = " "*8 + "dataIn_"+str(inCount)+"->getData(I_in_"+str(inCount)+");\n\n"; 
    12551258                output.write(ts) 
    12561259                ts = " "*8 + "I_in_" + str(inCount) + "_length = I_in_" + str(inCount) + "->length();\n\n"; 
     
    12631266                continue 
    12641267 
    1265     for x in c.ports:   
    1266         if x.type == "Uses":   
     1268    for x in c.ports: 
     1269        if x.type == "Uses": 
    12671270            if x.interface.name == "complexShort" or x.interface.name == "complexFloat" or x.interface.name == "complexDouble" or x.interface.name == "complexChar" or x.interface.name == "complexLong": 
    1268                 ts = " "*8 + "I_out_" + str(outCount) + ".length(); //must define length of output\n";  
    1269                 output.write(ts) 
    1270                 ts = " "*8 + "Q_out_" +  str(outCount) + ".length(); //must define length of output\n\n";  
     1271                ts = " "*8 + "I_out_" + str(outCount) + ".length(); //must define length of output\n"; 
     1272                output.write(ts) 
     1273                ts = " "*8 + "Q_out_" +  str(outCount) + ".length(); //must define length of output\n\n"; 
    12711274                output.write(ts) 
    12721275                outCount += 1; 
     
    12751278 
    12761279            elif x.interface.name == "realShort" or x.interface.name == "realFloat" or x.interface.name == "realDouble" or x.interface.name == "realChar" or x.interface.name == "realLong": 
    1277                 ts = " "*8 + "I_out_" + str(outCount) + ".length(); //must define length of output\n\n";  
     1280                ts = " "*8 + "I_out_" + str(outCount) + ".length(); //must define length of output\n\n"; 
    12781281                output.write(ts) 
    12791282                outCount += 1; 
     
    12841287                continue 
    12851288 
    1286     ts = " "*8 + "/*insert code here to do work*/\n\n\n\n\n\n\n";  
     1289    ts = " "*8 + "/*insert code here to do work*/\n\n\n\n\n\n\n"; 
    12871290    output.write(ts) 
    12881291 
     
    12911294        if x.type == "Provides": 
    12921295            if x.interface.name == "complexShort" or x.interface.name == "complexFloat" or x.interface.name == "complexDouble" or x.interface.name == "complexChar" or x.interface.name == "complexLong": 
    1293                 ts = " "*8 + "dataIn_" + str(inCount) + "->bufferEmptied();\n";  
     1296                ts = " "*8 + "dataIn_" + str(inCount) + "->bufferEmptied();\n"; 
    12941297                output.write(ts) 
    12951298                inCount += 1; 
    12961299 
    12971300            elif x.interface.name == "realShort" or x.interface.name == "realFloat" or x.interface.name == "realDouble" or x.interface.name == "realChar" or x.interface.name == "realLong": 
    1298                 ts = " "*8 + "dataIn_" + str(inCount) + "->bufferEmptied();\n";  
     1301                ts = " "*8 + "dataIn_" + str(inCount) + "->bufferEmptied();\n"; 
    12991302                output.write(ts) 
    13001303                inCount += 1; 
     
    13031306                print "\nInterfaces other than complexand real Short, Char, long, FLoat and Double are not supported yet in the process data function generation!!\nSee writeProcessDataLoop in genStructure.\n" 
    13041307                continue 
    1305              
     1308 
    13061309    outCount = 0; 
    13071310    for x in c.ports:  #assumes that you have at least one port 
    1308         if x.type == "Uses":  
     1311        if x.type == "Uses": 
    13091312            if x.interface.name == "complexShort" or x.interface.name == "complexFloat" or x.interface.name == "complexDouble" or x.interface.name == "complexChar" or x.interface.name == "complexLong": 
    1310                 ts = " "*8 + "dataOut_" + str(outCount) + "->pushPacket(I_out_" + str(outCount) + ", Q_out_" + str(outCount) + ");\n";  
     1313                ts = " "*8 + "dataOut_" + str(outCount) + "->pushPacket(I_out_" + str(outCount) + ", Q_out_" + str(outCount) + ");\n"; 
    13111314                output.write(ts) 
    13121315                outCount += 1; 
     
    13141317            elif x.interface.name == "realShort" or x.interface.name == "realFloat" or x.interface.name == "realDouble" or x.interface.name == "realChar" or x.interface.name == "realLong": 
    13151318 
    1316                 ts = " "*8 + "dataOut_" + str(outCount) + "->pushPacket(I_out_" + str(outCount) + ");\n";  
     1319                ts = " "*8 + "dataOut_" + str(outCount) + "->pushPacket(I_out_" + str(outCount) + ");\n"; 
    13171320                output.write(ts) 
    13181321                outCount += 1; 
     
    13231326            #declare input values short, shortsequence, float, floatSequence, unsupported 
    13241327    #close the infinate while loop 
    1325          
     1328 
    13261329    ts = " "*4 + "}\n"; output.write(ts) 
    13271330 
     
    13311334 
    13321335 
    1333      
     1336 
    13341337  def writeACESvcDef(self, output,c,type): 
    13351338    """ This function writes the implementation of the svn() function for a given component""" 
     
    15181521        ts = " "*8 + "ACE_OS::sleep (ACE_Time_Value (1));\n"; output.write(ts) 
    15191522        ts = " "*4 + '}\n\n' + " "*4 + 'return 0;\n}\n'; output.write(ts) 
    1520          
     1523 
    15211524    if type == 'port': 
    15221525        #ts = 'int ' + c.u_cname + '::svc(void)\n{\n'; output.write(ts) 
     
    16231626    output.write(ts) 
    16241627 
    1625          
     1628 
    16261629  def writeFriendDecl(self,output,c): 
    16271630      friendList = [] 
     
    16331636              if p.p_cname not in friendList: 
    16341637                  friendList.append(p.p_cname) 
    1635                    
     1638 
    16361639      for x in friendList: 
    16371640          ts = " "*4 + "friend class " + x + ";\n" 
    1638           output.write(ts)  
    1639        
     1641          output.write(ts) 
     1642 
    16401643 
    16411644  def addGPL(self,outFile,name): 
    1642       inFile = open('generate/gpl_preamble','r') 
     1645      inFile = open(self.wavedevPath + 'generate/gpl_preamble','r') 
    16431646      for line in inFile.readlines(): 
    16441647          l_out = line.replace("__COMP_NAME__",name) 
    16451648          outFile.write(l_out) 
    1646          
     1649 
    16471650      inFile.close() 
    1648            
    1649          
     1651 
     1652 
    16501653  def cleanUp(self): 
    16511654      # Move the AssemblyController to the waveform Dir 
     
    16541657            os.system('mv ' + self.path + c.name + ' ' + self.path + self.active_wave.name) 
    16551658 
    1656          
     1659 
  • ossiedev/trunk/tools/WaveDev/wavedev/generate/templates/custom_ports/genStructure.py

    r5933 r8046  
    2929 
    3030class genAll: 
    31   def __init__(self,path,active_wave): 
     31  def __init__(self, path, wavedevPath, active_wave): 
    3232    if path[len(path)-1] != '/': 
    3333        path = path + '/' 
    3434    self.path = path 
     35    if len(wavedevPath) > 0 and wavedevPath[len(wavedevPath)-1] != '/': 
     36        wavedevPath = wavedevPath + '/' 
     37    self.wavedevPath = wavedevPath 
    3538    self.active_wave = active_wave 
    3639 
     
    4144  def genDirs(self): 
    4245    if os.path.exists(self.path) == False: 
    43        errorMsg(self,"Waveform already exists - exiting") 
     46       errorMsg(self,"Output directory does not exist") 
    4447       exit(1) 
    45         
    46     if os.path.exists(self.path+self.active_wave.name) == False:    
     48 
     49    if os.path.exists(self.path+self.active_wave.name) == False: 
    4750        os.mkdir(self.path + self.active_wave.name) 
    48       
    49     shutil.copy('generate/reconf',self.path + self.active_wave.name) 
    50     #for x in os.listdir('generate/basic_xml/'): 
     51 
     52    shutil.copy(self.wavedevPath + 'generate/reconf',self.path + self.active_wave.name) 
     53    #for x in os.listdir(self.wavedevPath + 'generate/basic_xml/'): 
    5154    #    if not os.path.isdir(x): 
    52     #        shutil.copy('generate/basic_xml/' + x,self.path + self.active_wave.name) 
    53      
     55    #        shutil.copy(self.wavedevPath + 'generate/basic_xml/' + x,self.path + self.active_wave.name) 
     56 
    5457    for x in self.active_wave.components: 
    5558        if x.generate: 
     
    5760                os.mkdir(self.path+x.name) 
    5861            if x.AssemblyController != True: 
    59                 shutil.copy('generate/reconf',self.path + x.name) 
    60                 #for f in os.listdir('generate/basic_xml/'): 
     62                shutil.copy(self.wavedevPath + 'generate/reconf',self.path + x.name) 
     63                #for f in os.listdir(self.wavedevPath + 'generate/basic_xml/'): 
    6164                #    if not os.path.isdir(f): 
    62                 #        shutil.copy('generate/basic_xml/' + f,self.path + x.name) 
    63                 shutil.copy('generate/LICENSE',self.path + x.name) 
    64                  
     65                #        shutil.copy(self.wavedevPath + 'generate/basic_xml/' + f,self.path + x.name) 
     66                shutil.copy(self.wavedevPath + 'generate/LICENSE',self.path + x.name) 
     67 
    6568  ############################################################################## 
    6669  ## writeMakefiles - generates the make file for the waveform and then calls 
     
    7275    Flags = ["-Wall"] 
    7376    self.info2str(output,"AM_CXXFLAGS = ",Flags,1) 
    74      
     77 
    7578    tstr = "ossieName = " + self.active_wave.name + '\n\n' 
    7679    output.write(tstr) 
    77      
     80 
    7881    tstr = "SUBDIRS = " 
    7982    for c in self.active_wave.components: 
    8083        if c.AssemblyController == True and c.generate: 
    8184            tstr += c.name + '\n\n' 
    82             output.write(tstr)     
    83      
     85            output.write(tstr) 
     86 
    8487#    tstr = "waveformdir = $(prefix)/dom/waveforms/$(ossieName)\n" 
    8588    tstr = "waveformdir = $(prefix)/waveforms/" + self.active_wave.name + "\n" 
     
    105108 
    106109    output.close() 
    107      
     110 
    108111    for c in self.active_wave.components: 
    109112        if c.generate: 
    110113            tmpPath = self.path + c.name 
    111114            self.writeCompMakefile(c,tmpPath) 
    112              
    113   ##############################################################################  
     115 
     116  ############################################################################## 
    114117  ## writeCompMakefilee - generates the make file for an indivdual component 
    115118  ############################################################################## 
     
    117120    if compPath[len(compPath)-1] != '/': 
    118121        compPath = compPath + '/' 
    119      
     122 
    120123    header = "%SK.cpp %.h : %.idl\n\t@IDL@ @IDL_FLAGS@ " 
    121124    header += "-bcxx -Wbh=.h -Wbs=SK.cpp -Wbkeep_inc_path $<\n\n" 
    122125    header += "%.idl :\n\tcp @SI_PATH@/standardinterfaces/$@ .\n" 
    123      
     126 
    124127    Flags = ["-Wall"] 
    125      
     128 
    126129    output = open(compPath + 'Makefile.am','w') 
    127130    output.writelines(header + "\n") 
    128131    self.info2str(output,"AM_CXXFLAGS = ",Flags,1) 
    129        
     132 
    130133    BuiltSources = [] 
    131134    CleanFiles = [] 
     
    150153        nodist.append(x.interface.filename+'SK.cpp') 
    151154        tempIntList.append(x.interface.filename) 
    152        
     155 
    153156    self.info2str(output,"BUILT_SOURCES = ",BuiltSources,wrapFlag=True) 
    154157    self.info2str(output,"CLEANFILES = ",CleanFiles,1) 
    155        
     158 
    156159    tstr = "ossieName = " + comp.name + "\n" 
    157160    output.write(tstr) 
    158161    tstr = "bin_PROGRAMS = " + comp.name + "\n\n" 
    159162    output.write(tstr) 
    160        
     163 
    161164    tstr = "xmldir = $(prefix)/xml/$(ossieName)\n" 
    162165    output.write(tstr) 
     
    168171    xmlData.append(tstr2 + ".spd.xml") 
    169172    self.info2str(output,"dist_xml_DATA = ",xmlData,1,wrapFlag=True) 
    170        
     173 
    171174    tstr = comp.name + "_SOURCES = " + comp.name+".cpp " + comp.name+".h " 
    172175    tstr += "main.cpp port_impl.cpp port_impl.h\n" 
    173     output.write(tstr)     
     176    output.write(tstr) 
    174177    self.info2str(output,"nodist_"+comp.name+"_SOURCES = ",nodist,1) 
    175      
     178 
    176179    output.close() 
    177180 
     
    188191      if mycount%2 == 0 and wrap and mylist.index(x) != len(mylist)-1: 
    189192        tstr = tstr + "\\\n" 
    190    
     193 
    191194    tstr = tstr + "\n" 
    192195    for x in range(extraLine): 
     
    200203  def genConfigureACFiles(self,installPath="/sdr/sca"): 
    201204    if installPath[-1] == '/': 
    202         installPath = installPath[0:-1]   
    203        
     205        installPath = installPath[0:-1] 
     206 
    204207    tmpPath = self.path + self.active_wave.name + '/' 
    205208    self.writeConfAC(tmpPath,self.active_wave.name,self.active_wave.ace,True,installPath) 
    206      
     209 
    207210    for c in self.active_wave.components: 
    208211        if c.AssemblyController ==  True or not c.generate: 
    209212            continue 
    210213        tmpPath = self.path + c.name + '/' 
    211         self.writeConfAC(tmpPath,c.name,c.ace,c.timing,False,installPath) 
    212          
     214        self.writeConfAC(tmpPath,c.name,c.ace, #c.timing, 
     215                         False,installPath) 
     216 
    213217  ############################################################################## 
    214218  ## writeConfAC - generates configure.ac files for autoconf 
     
    217221     if genPath[len(genPath)-1] != '/': 
    218222        genPath = genPath + '/' 
    219        
     223 
    220224     output = open(genPath + 'configure.ac','w') 
    221225     tstr = "AC_INIT(" + name + ", 0.5.0)\nAM_INIT_AUTOMAKE\n\n" 
     
    269273     tstr = 'IDL_FLAGS="$OSSIE_CFLAGS"\nAC_SUBST(IDL_FLAGS)\n\n' 
    270274     output.write(tstr) 
    271       
     275 
    272276     if aceFlag == True: 
    273277         tstr = 'PKG_CHECK_MODULES(ACE, ACE >= 5.4.7)\n' 
    274278         tstr = tstr + 'AC_SUBST(ACE_CFLAGS)\nAC_SUBST(ACE_LIBS)\nLIBS="$LIBS $ACE_LIBS"\n\n' 
    275279         output.write(tstr) 
    276       
    277      tstr = "AC_CONFIG_FILES(Makefile"      
     280 
     281     tstr = "AC_CONFIG_FILES(Makefile" 
    278282     if wavFlag == True: 
    279283        for x in self.active_wave.components: 
     
    281285                tstr2 = " " + x.name + "/Makefile" 
    282286                tstr = tstr + tstr2 
    283             
    284      tstr = tstr + ")\n\n"  
     287 
     288     tstr = tstr + ")\n\n" 
    285289     output.write(tstr) 
    286290 
     
    289293 
    290294     output.close() 
    291      
    292   ##############################################################################       
     295 
     296  ############################################################################## 
    293297  ## This function generates the cpp and h files for each component: 
    294298  ## component.h, component.cpp, main.cpp, port_impl.h, and port_impl.cpp 
    295   ##############################################################################       
     299  ############################################################################## 
    296300  def genCompFiles(self,comp): 
    297301      #for x in self.active_wave.components: 
    298302        # generate the .h files for each component 
    299         inputH = open('generate/templates/custom_ports/sampleComp.h','r') 
     303        inputH = open(self.wavedevPath + 'generate/templates/custom_ports/sampleComp.h','r') 
    300304        outputH = open(self.path + comp.name + "/" + comp.name + ".h",'w') 
    301305        self.addGPL(outputH,comp.name) 
     
    320324                  l_out = l_out.replace("__ACE_SVC_DECL__",'int svc(void);\n        size_t queue_size;') 
    321325              else: 
    322                   continue    
     326                  continue 
    323327          if l_out.find("__FRIEND_DECL__") != -1: 
    324328              l_out = l_out.replace("__FRIEND_DECL__","") 
    325329              self.writeFriendDecl(outputH,comp) 
    326330              continue 
    327                     
     331 
    328332          outputH.write(l_out) 
    329            
     333 
    330334        inputH.close() 
    331335        outputH.close() 
    332          
     336 
    333337        # generate the .cpp files for each component 
    334         inputCPP = open('generate/templates/custom_ports/sampleComp.cpp','r') 
     338        inputCPP = open(self.wavedevPath + 'generate/templates/custom_ports/sampleComp.cpp','r') 
    335339        outputCPP = open(self.path + comp.name + "/" + comp.name + ".cpp",'w') 
    336340        self.addGPL(outputCPP,comp.name) 
     
    355359              if comp.ace == True: 
    356360                  self.writeACESvcDef(outputCPP,comp,'component',comp.timing, comp) 
    357               continue               
     361              continue 
    358362          outputCPP.write(l_out) 
    359            
     363 
    360364        inputCPP.close() 
    361365        outputCPP.close() 
    362          
     366 
    363367        # generate the main.cpp files for each component 
    364         inputMain = open('generate/templates/custom_ports/sampleMain.cpp','r') 
     368        inputMain = open(self.wavedevPath + 'generate/templates/custom_ports/sampleMain.cpp','r') 
    365369        outputMain = open(self.path + comp.name + "/main.cpp",'w') 
    366370        self.addGPL(outputMain,comp.name) 
    367          
     371 
    368372        for line in inputMain.readlines(): 
    369373          l_out = line.replace("__IncludeFile__",comp.name) 
     
    375379                  l_out = l_out.replace("__CLASS_VAR_ACE__",comp.name.lower()) 
    376380              else: 
    377                   continue           
     381                  continue 
    378382          if l_out.find("__NAME_SPACE__") != -1: 
    379383              ns_list = [] 
     
    386390 
    387391          outputMain.write(l_out) 
    388            
     392 
    389393        inputMain.close() 
    390394        outputMain.close() 
    391          
     395 
    392396        # generate the port_impl.h file 
    393         inputPortImpl = open('generate/templates/custom_ports/port_impl.h','r') 
     397        inputPortImpl = open(self.wavedevPath + 'generate/templates/custom_ports/port_impl.h','r') 
    394398        outputPortImpl = open(self.path + comp.name + "/port_impl.h",'w') 
    395399        self.addGPL(outputPortImpl,comp.name) 
    396         portSample_p = open('generate/templates/custom_ports/port_sample_p.h','r') 
    397         portSample_u = open('generate/templates/custom_ports/port_sample_u.h','r') 
     400        portSample_p = open(self.wavedevPath + 'generate/templates/custom_ports/port_sample_p.h','r') 
     401        portSample_u = open(self.wavedevPath + 'generate/templates/custom_ports/port_sample_u.h','r') 
    398402        for line in inputPortImpl.readlines(): 
    399403            l_out = line.replace("__IncludeFile__",comp.name) 
     
    410414            if l_out.find("__PORT_DECL__") != -1: 
    411415              self.writePortImplDecl(outputPortImpl,portSample_p,portSample_u,comp) 
    412               continue           
     416              continue 
    413417            outputPortImpl.write(l_out) 
    414              
     418 
    415419        inputPortImpl.close() 
    416420        outputPortImpl.close() 
    417421        portSample_p.close() 
    418422        portSample_u.close() 
    419          
     423 
    420424        # generate the port_impl.cpp file 
    421         inputPortImpl = open('generate/templates/custom_ports/port_impl.cpp','r') 
     425        inputPortImpl = open(self.wavedevPath + 'generate/templates/custom_ports/port_impl.cpp','r') 
    422426        outputPortImpl = open(self.path + comp.name + "/port_impl.cpp",'w') 
    423427        self.addGPL(outputPortImpl,comp.name) 
    424         portSample_p = open('generate/templates/custom_ports/port_sample_p.cpp','r') 
    425         portSample_u = open('generate/templates/custom_ports/port_sample_u.cpp','r') 
     428        portSample_p = open(self.wavedevPath + 'generate/templates/custom_ports/port_sample_p.cpp','r') 
     429        portSample_u = open(self.wavedevPath + 'generate/templates/custom_ports/port_sample_u.cpp','r') 
    426430        for line in inputPortImpl.readlines(): 
    427431            l_out = line 
     
    430434              continue 
    431435            outputPortImpl.write(l_out) 
    432              
     436 
    433437        inputPortImpl.close() 
    434438        outputPortImpl.close() 
    435439        portSample_p.close() 
    436440        portSample_u.close() 
    437          
     441 
    438442    # Copy some required files into the main directory 
    439     #  os.system('cp generate/basic_xml/* ' + self.path) 
    440     #  os.system('cp generate/wavLoader.py ' + self.path) 
     443    #  os.system('cp ' + self.wavedevPath + 'generate/basic_xml/* ' + self.path) 
     444    #  os.system('cp ' + self.wavedevPath + 'generate/wavLoader.py ' + self.path) 
    441445 
    442446  def writePortImplDecl(self, output,portSample_p,portSample_u,c): 
     
    522526                else: 
    523527                    l_out = l_out.replace("__COMP_REF_DECL__","") 
    524                  
     528 
    525529            output.write(l_out) 
    526530 
    527531  def writePortImplDef(self,output,portSample_p,portSample_u,c): 
    528532    """ This function writes port implementation definitions for the port_impl.cpp file""" 
    529     intList = []     
     533    intList = [] 
    530534    for x in c.ports: 
    531535        found_match = False 
     
    610614            outCount += 1 
    611615    ts = " "*8 + "bool component_alive;\n\n" + " "*8 + "string naming_service_name;\n"; output.write(ts) 
    612      
     616 
    613617  def writePortInst(self,output,c): 
    614618    """ This function writes the port instantiations to the component cpp file""" 
     
    633637    ts = "\n"; output.write(ts) 
    634638    ts = " "*4 + "queue_size = DEFAULT_QUEUE_BLOCK_SIZE;\n\n" + " "*4 + "component_alive = true;\n\n" + " "*4 + "naming_service_name = label;\n"; output.write(ts) 
    635      
     639 
    636640  def writeGetPort(self,output,c): 
    637641    """ This function writes the getPort functionality to the component cpp file""" 
     
    666670    ts = "\n"; output.write(ts) 
    667671    ts = " "*4 + 'return NULL;\n'; output.write(ts) 
    668      
     672 
    669673  def writeDelPort(self,output,c): 
    670674    """ This function writes the destructor functionality (for ports) to the component cpp file""" 
     
    683687            outCount += 1 
    684688    ts = "\n"; output.write(ts) 
    685      
     689 
    686690##  def writeACESvcPorts(self,output,c): 
    687691##    """ This function writes the svc port functionality to the component cpp file""" 
     
    692696##            output.write(ts) 
    693697##            outCount += 1 
    694 ##    ts = "\n"; output.write(ts)   
    695      
     698##    ts = "\n"; output.write(ts) 
     699 
    696700  def writeACESvcDef(self, output,c,type,timing_flag, comp=''): 
    697701    """ This function writes the implementation of the svn() function for a given component""" 
     
    884888        ts = " "*8 + "//ACE_OS::sleep (ACE_Time_Value (1));\n"; output.write(ts) 
    885889        ts = " "*4 + '}\n\n' + " "*4 + 'return 0;\n}\n'; output.write(ts) 
    886          
     890 
    887891    if type == 'port': 
    888892        #t