Exemple #1
0
def parseGlobalVariableDeclaration(line):
    cdifId = line.split("M")[1]

    name = ""
    uniqueName = ""
    declaredType = ""
    declaredClass = ""
    sourceFile = ""
    start = ""
    typeSourceFile = ""
    typeLineNr = ""

    for globalVarLine in input_file:
        globalVarLine = globalVarLine.strip()

        if globalVarLine.startswith(")"):
            break
        elif globalVarLine.startswith("(name \""):
            name = globalVarLine.split("\"")[1]
        elif globalVarLine.startswith("(uniqueName \""):
            uniqueName = globalVarLine.split("\"")[1]
        elif globalVarLine.startswith("(declaredType \""):
            declaredType = globalVarLine.split("\"")[1]
        elif globalVarLine.startswith("(declaredClass \""):
            declaredClass = globalVarLine.split("\"")[1]
        elif globalVarLine.startswith("(sourceAnchor "):
            sourceFile = globalVarLine.split("\"")[1]
            start = globalVarLine.split("\"")[2].split(" ")[2]
        elif globalVarLine.startswith("(typeSourceAnchor "):
            typeSourceFile = globalVarLine.split("\"")[1]
            typeLineNr = globalVarLine.split("\"")[2].split(" ")[2]

    globalVarInfo = cdifId + "\t\"" + uniqueName + "\"\n"
    output_file.write(globalVarInfo)

    if (sourceFile != ""):
        if (not (sourceFile in utility.fileDict)):
            assert False, ("Unknown file " + sourceFile + " globalVar " +
                           cdifId)

        fileId = utility.fileDict[sourceFile]
        globalVarContainmentInfo = cdifId + "\t" + fileId + "\t" + start + "\n"
        accessibleEntityContainmentFile.write(globalVarContainmentInfo)

    if (declaredClass != "" and typeSourceFile != ""):
        declaredClassId = utility.getClassId(typeSourceFile, typeLineNr)

        if declaredClassId != "":
            globalVarTypeInfo = cdifId + "\t" + declaredClassId + "\n"
            globalVarTypeFile.write(globalVarTypeInfo)
Exemple #2
0
def parseGlobalVariableDeclaration(line):
	cdifId=line.split("M")[1]	
	
	name = ""
	uniqueName = ""
	declaredType = ""
	declaredClass = ""
	sourceFile = ""
	start = ""
	typeSourceFile = ""
	typeLineNr = ""
		
	for globalVarLine in input_file:
		globalVarLine = globalVarLine.strip()
		
		if globalVarLine.startswith(")"):
			break
		elif globalVarLine.startswith("(name \""):
			name=globalVarLine.split("\"")[1]
		elif globalVarLine.startswith("(uniqueName \""):
			uniqueName=globalVarLine.split("\"")[1]
		elif globalVarLine.startswith("(declaredType \""):
			declaredType=globalVarLine.split("\"")[1]
		elif globalVarLine.startswith("(declaredClass \""):
			declaredClass=globalVarLine.split("\"")[1]
		elif globalVarLine.startswith("(sourceAnchor "):
			sourceFile = globalVarLine.split("\"")[1]
			start = globalVarLine.split("\"")[2].split(" ")[2]
		elif globalVarLine.startswith("(typeSourceAnchor "):
			typeSourceFile = globalVarLine.split("\"")[1]
			typeLineNr = globalVarLine.split("\"")[2].split(" ")[2]	
		
	globalVarInfo=cdifId + "\t\"" + uniqueName + "\"\n"
	output_file.write(globalVarInfo)

	if ( sourceFile != "" ):
		if ( not (sourceFile in utility.fileDict) ):
			assert False, ("Unknown file "+sourceFile+" globalVar "+cdifId)

		fileId=utility.fileDict[sourceFile]				
		globalVarContainmentInfo=cdifId + "\t" + fileId + "\t" + start + "\n"
		accessibleEntityContainmentFile.write(globalVarContainmentInfo)

	if ( declaredClass != "" and typeSourceFile != ""):
		declaredClassId = utility.getClassId(typeSourceFile,typeLineNr)

		if declaredClassId != "":
			globalVarTypeInfo=cdifId + "\t" + declaredClassId + "\n"
			globalVarTypeFile.write(globalVarTypeInfo)
			if inhLine.startswith(")"):
				break
			elif inhLine.startswith("(subclass \""):
				subName=inhLine.split("\"")[1]
			elif inhLine.startswith("(superclass \""):
				superName=inhLine.split("\"")[1]
			elif inhLine.startswith("(sourceAnchor "):
				sourceFile=inhLine.split("\"")[1].strip()
				lineNr = inhLine.split("\"")[2].split(" ")[2]
			elif inhLine.startswith("(superclassSourceAnchor"):
				superClassSourceFile=inhLine.split("\"")[1].strip()
				superClassLineNr = inhLine.split("\"")[2].split(" ")[2]
				
		if ( inhId != "" ):
			subclassId = utility.getClassId(sourceFile,lineNr)
			superclassId = utility.getClassId(superClassSourceFile,superClassLineNr)
			
			if ( subclassId != "" ) and (superclassId != ""):
				inhInfo=inhId + "\t\"" + subName + "->" + superName + "\""
				output_file.write(inhInfo)
				
				inhInfo="\t" + subclassId + "\t" + superclassId + "\n"
				output_file.write(inhInfo)
			else:
				print "subclassId  ("+subName+","+sourceFile+"@"+lineNr+"): ",subclassId
				print "superclassId(" + superName + "," + superClassSourceFile + "@" + superClassLineNr + "): ", superclassId
		else:
			"inhId is empty"
								
input_file.close()
Exemple #4
0
        cdifEntity = ""
        for typedefLine in input_file:
            typedefLine = typedefLine.strip()

            if typedefLine.startswith(")"):
                break
            elif typedefLine.startswith("(declaredReturnType \""):
                aliasName = typedefLine.split("\"")[1]
            elif typedefLine.startswith("(baseReturnType \""):
                baseName = typedefLine.split("\"")[1]
            elif typedefLine.startswith("(sourceAnchor "):
                sourceFile = typedefLine.split("\"")[1].strip()
            elif typedefLine.startswith("(destinationSourceAnchor"):
                destSourceFile = typedefLine.split("\"")[1].strip()
                destLineNr = typedefLine.split("\"")[2].split(" ")[2]

        if (typeDefId != ""):
            baseNameWithoutTemplates = baseName.split("<")[0]
            print "utility.getClassId(" + destSourceFile + "," + destLineNr + ")"
            baseId = utility.getClassId(destSourceFile, destLineNr)

            if (baseId != ""):
                typeDefInfo = typeDefId + "\t\"" + aliasName + "\"\t\"" + baseName + "\""
                output_file.write(typeDefInfo)

                typeDefInfo = "\t" + baseId + "\t\n"
                output_file.write(typeDefInfo)

input_file.close()
output_file.close()
Exemple #5
0
            elif attributeLine.startswith("(sourceAnchor "):
                sourceFile = attributeLine.split("\"")[1]
                lineNr = attributeLine.split("\"")[2].split(" ")[2]
            elif attributeLine.startswith("(typeSourceAnchor "):
                typeSourceFile = attributeLine.split("\"")[1]
                typeLineNr = attributeLine.split("\"")[2].split(" ")[2]
            elif attributeLine.startswith("(parentSourceAnchor "):
                parentSourceFile = attributeLine.split("\"")[1]
                parentLineNr = attributeLine.split("\"")[2].split(" ")[2]

        if (parentClassName != ""):
            uniqueName = parentClassName + "." + name
            attrInfo = cdifId + "\t\"" + uniqueName + "\"\n"
            output_file.write(attrInfo)

            attributeOwnerId = utility.getClassId(parentSourceFile,
                                                  parentLineNr)

            if attributeOwnerId != "":
                attrContainmentInfo = cdifId + "\t" + attributeOwnerId + "\n"
                attributeContainmentFile.write(attrContainmentInfo)

        if (declaredClass != "" and typeSourceFile != ""):
            declaredClassId = utility.getClassId(typeSourceFile, typeLineNr)

            if declaredClassId != "":
                attrTypeInfo = cdifId + "\t" + declaredClassId + "\n"
                attributeTypeFile.write(attrTypeInfo)

input_file.close()
output_file.close()
attributeContainmentFile.close()
def parseFunctionDeclaration(line, input_file, output_file, files,\
       invokableEntityContainmentFile,\
       functionTypeFile, functionTypeDefFile):
    cdifId = line.split("M")[1]
    cdif_current_object = line
    name = ""
    uniqueName = ""
    parameters = ""
    declaredReturnType = ""
    declaredReturnClass = ""
    sourceFile = ""
    start = ""
    typeSourceFile = ""
    typeLineNr = ""

    for functionLine in input_file:
        cdif_current_object = cdif_current_object + functionLine
        functionLine = functionLine.strip()

        if functionLine.startswith(")"):
            break
        elif functionLine.startswith("(name \""):
            name = functionLine.split("\"")[1]
        elif functionLine.startswith("(uniqueName \""):
            uniqueName = functionLine.split("\"")[1]
            parameters = ""
            uniqueNameBrokenUp = uniqueName.split("(")
            nrOfBrackets = len(uniqueNameBrokenUp)

            bracketIndex = 1
            while (bracketIndex < nrOfBrackets):
                parameters += uniqueNameBrokenUp[bracketIndex]
                bracketIndex += 1

            parameters = parameters.rstrip(")")

        elif functionLine.startswith("(declaredReturnType \""):
            declaredReturnType = functionLine.split("\"")[1]
        elif functionLine.startswith("(declaredReturnClass \""):
            declaredReturnClass = functionLine.split("\"")[1]
        elif functionLine.startswith("(sourceAnchor "):
            sourceFile = functionLine.split("\"")[1]
            start = functionLine.split("\"")[2].split(" ")[2]
        elif functionLine.startswith("(typeSourceAnchor "):
            typeSourceFile = functionLine.split("\"")[1]
            typeLineNr = functionLine.split("\"")[2].split(" ")[2]

    functionInfo = cdifId + "\t\"" + uniqueName + "\"\n"
    output_file.write(functionInfo)
    typeId = ""
    found = False

    if (sourceFile != ""):
        if (not (sourceFile in files)):
            print sourceFile, files
            assert False, ("Unknown file " + sourceFile + " function " +
                           cdifId)

        fileId = files[sourceFile]
        functionContainmentInfo = cdifId + "\t" + fileId + "\t" + start + "\n"
        invokableEntityContainmentFile.write(functionContainmentInfo)

    if (declaredReturnClass != "" and typeSourceFile != ""):
        declaredReturnClassId = utility.getClassId(typeSourceFile, typeLineNr)
        #declaredReturnClassId = utility.getId(typeSourceFile,typeLineNr)
        declaredReturnTypeDefId = utility.getId(typeSourceFile, typeLineNr,
                                                declaredReturnType)

        if (declaredReturnClassId == "" and declaredReturnTypeDefId == ""):
            #print ("Function Type not found: " + cdif_current_object)
            className = declaredReturnClass
            found = retrieveFunctionClass(className, cdifId,
                                          functionTypeDefFile,
                                          functionTypeFile,
                                          cdif_current_object, name)
            if not found:
                #print (cdif_current_object)
                typeId = utility.getTypeIdHelper(className)  #returns TypedefID
                if (typeId != ""):
                    functionTypeDefInfo = cdifId + "\t" + typeId + "\n"
                    functionTypeDefFile.write(functionTypeDefInfo)
                    if typeDefDict[typeId] != str(-1):
                        functionTypeInfo = cdifId + "\t" + typeDefDict[
                            typeId] + "\n"
                        functionTypeFile.write(functionTypeInfo)
                #else:
                #print ("First Type not found: " + className)

        elif declaredReturnClassId != declaredReturnTypeDefId:

            if declaredReturnTypeDefId != "":
                typeId = declaredReturnTypeDefId
                functionTypeDefInfo = cdifId + "\t" + typeId + "\n"
                functionTypeDefFile.write(functionTypeDefInfo)
                if typeDefDict[typeId] != str(-1):
                    functionTypeInfo = cdifId + "\t" + typeDefDict[
                        typeId] + "\n"
                    functionTypeFile.write(functionTypeInfo)
            elif declaredReturnClassId != "":
                typeId = declaredReturnClassId
                functionTypeInfo = cdifId + "\t" + declaredReturnClassId + "\n"
                functionTypeFile.write(functionTypeInfo)
        else:
            if declaredReturnClassId != "":
                typeId = declaredReturnClassId
                functionTypeInfo = cdifId + "\t" + declaredReturnClassId + "\n"
                functionTypeFile.write(functionTypeInfo)
    else:
        className = declaredReturnType

        #className = className.split("<")[0]
        className = re.sub("\\((.*)\\)", "", className).strip()
        #className = className.split("(")[0]
        className = re.sub("\\<(.*)\\>", "", className).strip()
        className = className.replace("*", "").replace("&", "").replace(
            "[", "").replace("]", "").strip()
        if " " in className:
            className = className.split(" ")[1]

        prefixBase = uniqueName
        #prefixBase = prefixBase.split("<")[0]
        prefixBase = re.sub("\\((.*)\\)", "", prefixBase).strip()
        #prefixBase = prefixBase.split("(")[0]
        prefixBase = re.sub("\\<(.*)\\>", "", prefixBase).strip()

        if "<" in className or "(" in className or "<" in prefixBase or "(" in prefixBase:
            print("trol")

        prefix = '::'.join(
            prefixBase.split("::")[:(len(prefixBase.split("::")) - 1)])
        while (prefix != ""):
            tempName = prefix + "::" + className
            found = retrieveFunctionClass(tempName, cdifId,
                                          functionTypeDefFile,
                                          functionTypeFile,
                                          cdif_current_object, name)
            if not found:
                typeId = utility.getTypeIdHelper(tempName)
                if (typeId != ""):
                    functionTypeDefInfo = cdifId + "\t" + typeId + "\n"
                    functionTypeDefFile.write(functionTypeDefInfo)
                    if typeDefDict[typeId] != str(-1):
                        functionTypeInfo = cdifId + "\t" + typeDefDict[
                            typeId] + "\n"
                        functionTypeFile.write(functionTypeInfo)
                    break
                else:
                    prefix = '::'.join(
                        prefix.split("::")[:(len(prefix.split("::")) - 1)])
            else:
                break
        if "::" not in prefixBase:
            found = retrieveFunctionClass(className, cdifId,
                                          functionTypeDefFile,
                                          functionTypeFile,
                                          cdif_current_object, name)
            if not found:
                typeId = utility.getTypeIdHelper(className)
                if (typeId != ""):
                    functionTypeDefInfo = cdifId + "\t" + typeId + "\n"
                    functionTypeDefFile.write(functionTypeDefInfo)
                    if typeDefDict[typeId] != str(-1):
                        functionTypeInfo = cdifId + "\t" + typeDefDict[
                            typeId] + "\n"
                        functionTypeFile.write(functionTypeInfo)
Exemple #7
0
def parseFunctionDeclaration(line):
    cdifId = line.split("M")[1]

    name = ""
    uniqueName = ""
    parameters = ""
    declaredReturnType = ""
    declaredReturnClass = ""
    sourceFile = ""
    start = ""
    typeSourceFile = ""
    typeLineNr = ""

    for functionLine in input_file:
        functionLine = functionLine.strip()

        if functionLine.startswith(")"):
            break
        elif functionLine.startswith("(name \""):
            name = functionLine.split("\"")[1]
        elif functionLine.startswith("(uniqueName \""):
            uniqueName = functionLine.split("\"")[1]
            parameters = ""
            uniqueNameBrokenUp = uniqueName.split("(")
            nrOfBrackets = len(uniqueNameBrokenUp)

            bracketIndex = 1
            while (bracketIndex < nrOfBrackets):
                parameters += uniqueNameBrokenUp[bracketIndex]
                bracketIndex += 1

            parameters = parameters.rstrip(")")

        elif functionLine.startswith("(declaredReturnType \""):
            declaredReturnType = functionLine.split("\"")[1]
        elif functionLine.startswith("(declaredReturnClass \""):
            declaredReturnClass = functionLine.split("\"")[1]
        elif functionLine.startswith("(sourceAnchor "):
            sourceFile = functionLine.split("\"")[1]
            start = functionLine.split("\"")[2].split(" ")[2]
        elif functionLine.startswith("(typeSourceAnchor "):
            typeSourceFile = functionLine.split("\"")[1]
            typeLineNr = functionLine.split("\"")[2].split(" ")[2]

    functionInfo = cdifId + "\t\"" + uniqueName + "\"\n"
    output_file.write(functionInfo)

    if (sourceFile != ""):
        if (not (sourceFile in files)):
            print sourceFile, files
            assert False, ("Unknown file " + sourceFile + " function " +
                           cdifId)

        fileId = files[sourceFile]
        functionContainmentInfo = cdifId + "\t" + fileId + "\t" + start + "\n"
        invokableEntityContainmentFile.write(functionContainmentInfo)

    if (declaredReturnClass != "" and typeSourceFile != ""):
        declaredReturnClassId = utility.getClassId(typeSourceFile, typeLineNr)

        if declaredReturnClassId != "":
            functionTypeInfo = cdifId + "\t" + declaredReturnClassId + "\n"
            functionTypeFile.write(functionTypeInfo)
Exemple #8
0
def parseMethodDeclaration(line):
    cdifId = line.split("M")[2].strip()

    name = ""
    uniqueName = ""
    parentClassName = ""
    parameters = ""
    declaredReturnType = ""
    declaredReturnClass = ""
    sourceFile = ""
    lineNr = ""
    parentSourceFile = ""
    parentLineNr = ""
    typeSourceFile = ""
    typeLineNr = ""
    signature = ""
    visibility = ""

    for methodLine in cdif_file:
        methodLine = methodLine.strip()

        if methodLine.startswith(")"):
            break
        elif methodLine.startswith("(name \""):
            name = methodLine.split("\"")[1]
        elif methodLine.startswith("(belongsTo \""):
            parentClassName = methodLine.split("\"")[1]
        elif methodLine.startswith("(uniqueName \""):
            uniqueName = methodLine.split("\"")[1]
            parameters = ""
            uniqueNameBrokenUp = uniqueName.split("(")
            nrOfBrackets = len(uniqueNameBrokenUp)

            bracketIndex = 1
            while (bracketIndex < nrOfBrackets):
                parameters += uniqueNameBrokenUp[bracketIndex]
                bracketIndex += 1

            parameters = parameters.rstrip(")")

        elif methodLine.startswith("(declaredReturnType \""):
            declaredReturnType = methodLine.split("\"")[1]
        elif methodLine.startswith("(declaredReturnClass \""):
            declaredReturnClass = methodLine.split("\"")[1]
        elif methodLine.startswith("(sourceAnchor "):
            sourceFile = methodLine.split("\"")[1]
            lineNr = methodLine.split("\"")[2].split(" ")[2]
        elif methodLine.startswith("(parentSourceAnchor "):
            parentSourceFile = methodLine.split("\"")[1]
            parentLineNr = methodLine.split("\"")[2].split(" ")[2]
        elif methodLine.startswith("(typeSourceAnchor "):
            typeSourceFile = methodLine.split("\"")[1]
            typeLineNr = methodLine.split("\"")[2].split(" ")[2]
        elif methodLine.startswith("(accessControlQualifier "):
            visibility = methodLine.split("\"")[1]
        elif methodLine.startswith("(signature "):
            signature = methodLine.split("\"")[1]

    if (parentClassName != ""):
        methodInfo = cdifId + "\t\"" + uniqueName + "\"\n"
        decl_file.write(methodInfo)

        methodOwnerId = utility.getClassId(parentSourceFile, parentLineNr)

        if (methodOwnerId != ""):
            methContainmentInfo = cdifId + "\t" + methodOwnerId + "\n"
            methodContainmentFile.write(methContainmentInfo)

        if (sourceFile != ""):
            if (not (sourceFile in files)):
                assert False, ("Unknown file " + sourceFile + " function " +
                               cdifId)

            fileId = files[sourceFile]
            invokableEntityContainmentInfo = cdifId + "\t" + fileId + "\t" + lineNr + "\n"
            invokableEntityContainmentFile.write(
                invokableEntityContainmentInfo)

    if (declaredReturnClass != "" and typeSourceFile != ""):
        declaredReturnClassId = utility.getClassId(typeSourceFile, typeLineNr)

        if declaredReturnClassId != "":
            methodTypeInfo = cdifId + "\t" + declaredReturnClassId + "\n"
            methodTypeFile.write(methodTypeInfo)

    if visibility != "":
        visibilityInfo = cdifId + "\t" + "\"" + visibility + "\"" + "\n"
        methodVisibilityFile.write(visibilityInfo)

    if signature != "":
        signatureInfo = cdifId + "\t" + "\"" + signature + "\"" + "\n"
        methodSignatureFile.write(signatureInfo)
			elif attributeLine.startswith("(sourceAnchor "):
				sourceFile = attributeLine.split("\"")[1]
				lineNr = attributeLine.split("\"")[2].split(" ")[2]	
			elif attributeLine.startswith("(typeSourceAnchor "):
				typeSourceFile = attributeLine.split("\"")[1]
				typeLineNr = attributeLine.split("\"")[2].split(" ")[2]	
			elif attributeLine.startswith("(parentSourceAnchor "):				
				parentSourceFile = attributeLine.split("\"")[1]
				parentLineNr = attributeLine.split("\"")[2].split(" ")[2]	

		if ( parentClassName != "" ):
			uniqueName=parentClassName+"."+name
			attrInfo=cdifId + "\t\"" + uniqueName + "\"\n"
			output_file.write(attrInfo)

			attributeOwnerId = utility.getClassId(parentSourceFile,parentLineNr)
			
			if attributeOwnerId != "":
				attrContainmentInfo=cdifId + "\t" + attributeOwnerId + "\n"
				attributeContainmentFile.write(attrContainmentInfo)
		
		if ( declaredClass != "" and typeSourceFile != ""):
			declaredClassId = utility.getClassId(typeSourceFile,typeLineNr)
			
			if declaredClassId != "":
				attrTypeInfo=cdifId + "\t" + declaredClassId + "\n"
				attributeTypeFile.write(attrTypeInfo)
	
input_file.close()
output_file.close()
attributeContainmentFile.close()
Exemple #10
0
def parseMethodDeclaration(line):
	cdifId=line.split("M")[2].strip()

	name = ""
	uniqueName = ""
	parentClassName = ""
	parameters = ""
	declaredReturnType = ""
	declaredReturnClass = ""
	sourceFile = ""
	lineNr = ""
	parentSourceFile = ""
	parentLineNr = ""
	typeSourceFile = ""
	typeLineNr = ""
	signature = ""
	visibility = ""

	for methodLine in cdif_file:
		methodLine = methodLine.strip()

		if methodLine.startswith(")"):
			break
		elif methodLine.startswith("(name \""):
			name=methodLine.split("\"")[1]
		elif methodLine.startswith("(belongsTo \""):
			parentClassName=methodLine.split("\"")[1]
		elif methodLine.startswith("(uniqueName \""):
			uniqueName=methodLine.split("\"")[1]
			parameters=""
			uniqueNameBrokenUp=uniqueName.split("(")
			nrOfBrackets=len(uniqueNameBrokenUp)

			bracketIndex=1
			while ( bracketIndex < nrOfBrackets ):
				parameters += uniqueNameBrokenUp[bracketIndex]
				bracketIndex+=1

			parameters = parameters.rstrip(")")

		elif methodLine.startswith("(declaredReturnType \""):
			declaredReturnType=methodLine.split("\"")[1]
		elif methodLine.startswith("(declaredReturnClass \""):
			declaredReturnClass=methodLine.split("\"")[1]
		elif methodLine.startswith("(sourceAnchor "):
			sourceFile = methodLine.split("\"")[1]
			lineNr = methodLine.split("\"")[2].split(" ")[2]
		elif methodLine.startswith("(parentSourceAnchor "):
			parentSourceFile = methodLine.split("\"")[1]
			parentLineNr = methodLine.split("\"")[2].split(" ")[2]
		elif methodLine.startswith("(typeSourceAnchor "):
			typeSourceFile = methodLine.split("\"")[1]
			typeLineNr = methodLine.split("\"")[2].split(" ")[2]
		elif methodLine.startswith("(accessControlQualifier "):
			visibility = methodLine.split("\"")[1]
		elif methodLine.startswith("(signature "):
			signature = methodLine.split("\"")[1]

	if ( parentClassName != "" ):
		methodInfo=cdifId + "\t\"" + uniqueName + "\"\n"
		decl_file.write(methodInfo)

		methodOwnerId = utility.getClassId(parentSourceFile,parentLineNr)

		if ( methodOwnerId != "" ):
			methContainmentInfo=cdifId + "\t" + methodOwnerId + "\n"
			methodContainmentFile.write(methContainmentInfo)

		if ( sourceFile != "" ):
			if ( not (sourceFile in files) ):
				assert False, ("Unknown file "+sourceFile+" function "+cdifId)

			fileId=files[sourceFile]
			invokableEntityContainmentInfo=cdifId + "\t" + fileId + "\t" + lineNr + "\n"
			invokableEntityContainmentFile.write(invokableEntityContainmentInfo)

	if ( declaredReturnClass != "" and typeSourceFile != ""):
		declaredReturnClassId = utility.getClassId(typeSourceFile,typeLineNr)

		if declaredReturnClassId != "":
			methodTypeInfo=cdifId + "\t" + declaredReturnClassId + "\n"
			methodTypeFile.write(methodTypeInfo)

	if visibility != "":
		visibilityInfo = cdifId + "\t" + "\"" + visibility + "\"" + "\n"
		methodVisibilityFile.write(visibilityInfo)

	if signature != "":
		signatureInfo = cdifId + "\t" + "\"" + signature + "\"" + "\n"
		methodSignatureFile.write(signatureInfo)
Exemple #11
0
            if inhLine.startswith(")"):
                break
            elif inhLine.startswith("(subclass \""):
                subName = inhLine.split("\"")[1]
            elif inhLine.startswith("(superclass \""):
                superName = inhLine.split("\"")[1]
            elif inhLine.startswith("(sourceAnchor "):
                sourceFile = inhLine.split("\"")[1].strip()
                lineNr = inhLine.split("\"")[2].split(" ")[2]
            elif inhLine.startswith("(superclassSourceAnchor"):
                superClassSourceFile = inhLine.split("\"")[1].strip()
                superClassLineNr = inhLine.split("\"")[2].split(" ")[2]

        if (inhId != ""):
            subclassId = utility.getClassId(sourceFile, lineNr)
            superclassId = utility.getClassId(superClassSourceFile,
                                              superClassLineNr)

            if (subclassId != "") and (superclassId != ""):
                inhInfo = inhId + "\t\"" + subName + "->" + superName + "\""
                output_file.write(inhInfo)

                inhInfo = "\t" + subclassId + "\t" + superclassId + "\n"
                output_file.write(inhInfo)
            else:
                print "subclassId  (" + subName + "," + sourceFile + "@" + lineNr + "): ", subclassId
                print "superclassId(" + superName + "," + superClassSourceFile + "@" + superClassLineNr + "): ", superclassId
        else:
            "inhId is empty"
Exemple #12
0
def parseFunctionDeclaration(line):
	cdifId=line.split("M")[1]

	name = ""
	uniqueName = ""
	parameters = ""
	declaredReturnType = ""
	declaredReturnClass = ""
	sourceFile = ""
	start = ""
	typeSourceFile = ""
	typeLineNr = ""

	for functionLine in input_file:
		functionLine = functionLine.strip()

		if functionLine.startswith(")"):
			break
		elif functionLine.startswith("(name \""):
			name=functionLine.split("\"")[1]
		elif functionLine.startswith("(uniqueName \""):
			uniqueName=functionLine.split("\"")[1]
			parameters=""
			uniqueNameBrokenUp=uniqueName.split("(")
			nrOfBrackets=len(uniqueNameBrokenUp)

			bracketIndex=1
			while ( bracketIndex < nrOfBrackets ):
				parameters += uniqueNameBrokenUp[bracketIndex]
				bracketIndex+=1

			parameters = parameters.rstrip(")")

		elif functionLine.startswith("(declaredReturnType \""):
			declaredReturnType=functionLine.split("\"")[1]
		elif functionLine.startswith("(declaredReturnClass \""):
			declaredReturnClass=functionLine.split("\"")[1]
		elif functionLine.startswith("(sourceAnchor "):
			sourceFile = functionLine.split("\"")[1]
			start = functionLine.split("\"")[2].split(" ")[2]
		elif functionLine.startswith("(typeSourceAnchor "):
			typeSourceFile = functionLine.split("\"")[1]
			typeLineNr = functionLine.split("\"")[2].split(" ")[2]

	functionInfo=cdifId + "\t\"" + uniqueName + "\"\n"
	output_file.write(functionInfo)

	if ( sourceFile != "" ):
		if ( not (sourceFile in files) ):
			print sourceFile, files
			assert False, ("Unknown file "+sourceFile+" function "+cdifId)

		fileId=files[sourceFile]
		functionContainmentInfo=cdifId + "\t" + fileId + "\t" + start + "\n"
		invokableEntityContainmentFile.write(functionContainmentInfo)

	if ( declaredReturnClass != "" and typeSourceFile != ""):
		declaredReturnClassId = utility.getClassId(typeSourceFile,typeLineNr)

		if declaredReturnClassId != "":
			functionTypeInfo=cdifId + "\t" + declaredReturnClassId + "\n"
			functionTypeFile.write(functionTypeInfo)
Exemple #13
0
		
		cdifEntity=""
		for typedefLine in input_file:
			typedefLine = typedefLine.strip()

			if typedefLine.startswith(")"):
				break
			elif typedefLine.startswith("(declaredReturnType \""):
				aliasName=typedefLine.split("\"")[1]
			elif typedefLine.startswith("(baseReturnType \""):
				baseName=typedefLine.split("\"")[1]
			elif typedefLine.startswith("(sourceAnchor "):
				sourceFile=typedefLine.split("\"")[1].strip()
			elif typedefLine.startswith("(destinationSourceAnchor"):
				destSourceFile=typedefLine.split("\"")[1].strip()
				destLineNr = typedefLine.split("\"")[2].split(" ")[2]	
		
		if ( typeDefId != "" ):
			baseNameWithoutTemplates = baseName.split("<")[0]
			print "utility.getClassId("+destSourceFile+","+destLineNr+")"
			baseId = utility.getClassId(destSourceFile,destLineNr)
			
			if ( baseId != "" ):
				typeDefInfo=typeDefId + "\t\"" + aliasName + "\"\t\"" + baseName + "\""
				output_file.write(typeDefInfo)
				
				typeDefInfo="\t" + baseId + "\t\n"
				output_file.write(typeDefInfo)
								
input_file.close()
output_file.close()