def _mapComponent(self, softpkg): ''' Extends the pull mapper _mapComponent method by defining the 'mFunction' and 'license' key/value pairs to the component dictionary. ''' component = PullComponentMapper._mapComponent(self, softpkg) mFunction = None for prop in softpkg.properties(): if str(prop.identifier()) == "__mFunction": mFunction = prop.value() break if mFunction: # point towards the m file that has been copied # to the implementation directory mFilePath = os.path.join(softpkg.path(), self._outputdir, mFunction+".m") parameters = mfile.parse(mFilePath) name = parameters.functionName inputs = parameters.inputs outputs = parameters.outputs else: name = "" inputs = [] outputs = [] component['mFunction'] = {'name' : name, 'inputs' : inputs, 'numInputs' : len(inputs), 'outputs' : outputs} component['license'] = "GPL" return component
def _getMFunctionParameters(function, mFiles): ''' Parse the function declaration of the primary m file to get the input and output parameters. ''' mFunctionParameters = None # find the master m file and parse its m function for mFile in mFiles: if mFile.find(function + '.m') != -1: mFunctionParameters = mfile.parse(mFile) break if mFunctionParameters is None: raise SystemExit('ERROR: No matching m file for specified function') return mFunctionParameters
def _getMFunctionParameters(function, mFiles): ''' Parse the function declaration of the primary m file to get the input and output parameters. ''' mFunctionParameters = None # find the master m file and parse its m function for mFile in mFiles: if mFile.find(function + '.m') != -1: mFunctionParameters = mfile.parse(mFile) break if mFunctionParameters is None: raise SystemExit('ERROR: No matching m file for specified function') return mFunctionParameters