def readXml(self): self.msg.debug('Reading %s file - ...' % self.xmlFileBase) parser = xparser.xparser(self.msgLevel,self.pkgName) self.data = parser.parseSource(self.xmlFile) if self.data: self.msg.debug('Reading %s file - OK' % self.xmlFileBase) return 1 else : self.msg.error('Reading %s file - FAILED' % self.xmlFileBase) self.err = 1 return 0
def doit(self): # print 'GODII %s' % self.version # print self.fullCommand x = xparser.xparser() srcFiles = [] for src in self.xmlSources: if os.path.isdir(src): for file in src: if file.split(".")[-1] == "xml": srcFiles.append(file) elif os.path.isfile(src) and src.split(".")[-1] == "xml": srcFiles.append(src) else: print "%s: ERROR: %s passed as source location is neither directory nor a .xml file" % (self.argv0, src) if self.gClasses: gClasses = genClasses.genClasses(self.godRoot) if self.gLinkDef: gLinkDef = genLinkDef.genLinkDef(self.godRoot) if self.gClassDicts: gClassDicts = genClassDicts.genClassDicts(self.godRoot, self.dictOutput, self.srcOutput) if not self.gClasses: gClasses = genClasses.genClasses(self.godRoot) if self.gNamespaces: gNamespaces = genNamespaces.genNamespaces(self.godRoot) if self.gAssocDicts: gAssocDicts = genAssocDicts.genAssocDicts(self.godRoot, self.dictOutput, self.srcOutput) for srcFile in srcFiles: gdd = x.parseSource(srcFile) godPackage = gdd["package"][0] # Set default namespace if not set in <package> try: ns = godPackage["attrs"]["namespace"] except KeyError: ns = self.default_namespace godPackage["attrs"]["namespace"] = ns package = genPackage.genPackage(godPackage) print "Processing package " + package.dict["packagename"] lname = self.findLongestName(godPackage) if godPackage.has_key("assoc") and self.gAssocDicts: print " Generating Dictionaries for Associations" gAssocDicts.doit(godPackage) print " - Done" if godPackage.has_key("namespace") and self.gNamespaces: print " Generating Namespaces" gNamespaces.doit(package, godPackage["namespace"], self.srcOutput, lname) print " - Done" if godPackage.has_key("class") and self.gClasses: print " Generating Header Files" gClasses.doit(package, godPackage["class"], self.srcOutput, lname, self.allocatorType) print " - Done" if godPackage.has_key("class") and self.gLinkDef: print " Generating LinkDef Files" gLinkDef.doit(package, godPackage["class"], ns, self.linkDefOutput) print " - Done" if self.gClassDicts: print " Generating Dictionaries" if godPackage.has_key("class") or godPackage.has_key("namespace"): gClassDicts.doit(godPackage) print " - Done" print "- Done "
def doit(self): #print 'GODII %s' % self.version #print self.fullCommand x = xparser.xparser(dtdPath=self.dtdPath) srcFiles = [] for src in self.xmlSources: if os.path.isdir(src): for file in src: if file.split('.')[-1] == 'xml': srcFiles.append(file) elif os.path.isfile(src) and src.split('.')[-1] == 'xml': srcFiles.append(src) else: self._log.error( self.argv0 + ': ERROR: ' + src + ' passed as source location is neither directory nor a .xml file' ) sys.exit(1) if self.gClasses: gClasses = genClasses.genClasses(self.godRoot) if self.gNamespaces: gNamespaces = genNamespaces.genNamespaces(self.godRoot) if self.gAssocDicts: gAssocDicts = genAssocDicts.genAssocDicts(self.godRoot, self.dictOutput, self.srcOutput) for srcFile in srcFiles: #--->PM<--- Needs to be reset each time! Otherwise it doubles the contents for 'instantiations' and 'exclusions' if self.gClassDicts: gClassDicts = genClassDicts.genClassDicts( self.godRoot, self.dictOutput, self.srcOutput) if not self.gClasses: gClasses = genClasses.genClasses(self.godRoot) gdd = x.parseSource(srcFile) godPackage = gdd['package'][0] if self.opts.package: godPackage['attrs']['name'] = self.opts.package # Set default namespace if not set in <package> try: ns = godPackage['attrs']['namespace'] except KeyError: ns = self.default_namespace godPackage['attrs']['namespace'] = ns package = genPackage.genPackage(godPackage) self._log.debug('Processing package ' + package.dict['packagename']) lname = self.findLongestName(godPackage) if godPackage.has_key('assoc') and self.gAssocDicts: self._log.debug(' Generating Dictionaries for Associations') gAssocDicts.doit(godPackage) self._log.debug(' - Done') if godPackage.has_key('namespace') and self.gNamespaces: self._log.debug(' Generating Namespaces') gNamespaces.doit(package, godPackage['namespace'], self.srcOutput, lname) self._log.debug(' - Done') if godPackage.has_key('class'): if self.gClasses: self._log.debug(' Generating Header Files') gClasses.doit(package, godPackage['class'], self.srcOutput, lname, self.allocatorType) self._log.debug(' - Done') if self.gClassDicts: self._log.debug(' Generating Dictionaries') gClassDicts.doit(godPackage) self._log.debug(' - Done') self._log.debug('- Done ')
def parseXld( self ): x = xparser.xparser() xld = x.parseSource( self.godRoot + 'xml_files/xld.xml' ) return xld