예제 #1
0
def parseFunctionDefinition(line, input_file, def_file, files, \
      invokableEntityContainmentFile):
    cdifId = line.split("M")[1].strip()

    name = ""
    declaredBy = ""
    uniqueName = ""
    sourceFile = ""
    lineNr = ""
    declSourceFile = ""
    declSourceLine = ""

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

        if functionLine.startswith(")"):
            break
        elif functionLine.startswith("(name \""):
            name = functionLine.split("\"")[1]
        elif functionLine.startswith("(declaredBy \""):
            declaredBy = functionLine.split("\"")[1]
        elif functionLine.startswith("(uniqueName \""):
            uniqueName = functionLine.split("\"")[1]
        elif functionLine.startswith("(sourceAnchor "):
            sourceFile = functionLine.split("\"")[1]
            lineNr = functionLine.split("\"")[2].split(" ")[2]
        elif functionLine.startswith("(declSourceAnchor "):
            declSourceFile = functionLine.split("\"")[1]
            declSourceLine = functionLine.split("\"")[2].split(" ")[2]

    declId = utility.getEntityId(declSourceFile, declSourceLine)

    if declId != "":
        functionDefInfo = cdifId + "\t" + declId + "\n"
        def_file.write(functionDefInfo)

    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)
예제 #2
0
def parseMethodDefinition(line):
	cdifId=line.split("M")[2].strip()

	name = ""
	declaredBy = ""
	uniqueName = ""
	sourceFile = ""
	lineNr = ""
	declSourceFile = ""
	declSourceLine = ""

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

		if methodLine.startswith(")"):
			break
		elif methodLine.startswith("(name \""):
			name=methodLine.split("\"")[1]
		elif methodLine.startswith("(declaredBy \""):
			declaredBy=methodLine.split("\"")[1]
		elif methodLine.startswith("(uniqueName \""):
			uniqueName=methodLine.split("\"")[1]
		elif methodLine.startswith("(sourceAnchor "):
			sourceFile = methodLine.split("\"")[1]
			lineNr = methodLine.split("\"")[2].split(" ")[2]
		elif methodLine.startswith("(declSourceAnchor "):
			declSourceFile = methodLine.split("\"")[1]
			declSourceLine = methodLine.split("\"")[2].split(" ")[2]

	declId = utility.getEntityId(declSourceFile, declSourceLine)

	if declId != "":
		methodDefInfo=cdifId + "\t" + declId + "\n"
		def_file.write(methodDefInfo)

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

		fileId=files[sourceFile]
		invokableEntityContainmentInfo=cdifId + "\t" + fileId + "\t" + lineNr + "\n"
		invokableEntityContainmentFile.write(invokableEntityContainmentInfo)
예제 #3
0
            elif accessLine.startswith("(destinationSourceAnchor "):
                # line resembles  (destinationSourceAnchor #[file "" start  end |]#)
                destSourceFile = accessLine.split("\"")[1]
                destLineNr = accessLine.split("\"")[2].split(" ")[2]
            elif accessLine.startswith("(sourceAnchor "):
                # line resembles (sourceAnchor #[file "Acquisition/Api/Src/AcqApi/AcqApiCommandHandler.cpp" start 000673 end 000673|]#)
                sourceFile = accessLine.split("\"")[1]
                sourceLineNr = accessLine.split("\"")[2].split(" ")[2]
            elif accessLine.startswith("(isAccessLValue "):
                # line resembles (isAccessLValue -TRUE-)
                value = accessLine.split("-")[1]
                isAccessLValue = (value == "TRUE")

        accessorId = ""
        accessorId = utility.getEntityId(srcSourceFile,
                                         srcLineNr,
                                         needDef=True)

        accesseeId = ""
        if (accesseeUniqueName in attributes):
            accesseeId = attributes[accesseeUniqueName]
        elif (accesseeUniqueName in globalVars):
            accesseeId = globalVars[accesseeUniqueName]

        if not ((accessorId != "") and (accesseeId != "")):
            continue

        accessInfo = accessId + "\t" + accessorId + "\t" + accesseeId + "\n"
        output_file.write(accessInfo)

        if (isAccessLValue):
예제 #4
0
                invokeeBase = invLine.split("\"")[1]
                if (invokeeBase != ""):
                    invokeeUniqueName = invokeeBase + "." + invokeeUniqueName
            elif invLine.startswith("(sourceAnchor "):
                sourceFile = invLine.split("\"")[1]
                sourceLineNr = invLine.split("\"")[2].split(" ")[2]
            elif invLine.startswith("(sourceSourceAnchor "):
                # line resembles  (sourceSourceAnchor #[file "" start  end |]#)
                srcSourceFile = invLine.split("\"")[1]
                srcLineNr = invLine.split("\"")[2].split(" ")[2]
            elif invLine.startswith("(destinationSourceAnchor "):
                # line resembles  (destinationSourceAnchor #[file "" start  end |]#)
                destSourceFile = invLine.split("\"")[1]
                destLineNr = invLine.split("\"")[2].split(" ")[2]

        invokerId = utility.getEntityId(srcSourceFile, srcLineNr, needDef=True)
        #invokerId = ""
        #if ( invokerUniqueName in methods ):
        #	invokerId = methods[invokerUniqueName]
        #elif ( invokerUniqueName in functions ):
        #	invokerId = functions[invokerUniqueName]

        #invokeeId = utility.getEntityId(destSourceFile, destLineNr, needDef = True)
        invokeeId = utility.getEntityId(destSourceFile,
                                        destLineNr,
                                        needDef=False)

        #invokeeId = ""
        #if ( invokeeUniqueName in methods ):
        #	invokeeId = methods[invokeeUniqueName]
        #elif ( invokeeUniqueName in functions ):
예제 #5
0
				srcLineNr=accessLine.split("\"")[2].split(" ")[2]
			elif accessLine.startswith("(destinationSourceAnchor "):
				# line resembles  (destinationSourceAnchor #[file "" start  end |]#)
				destSourceFile=accessLine.split("\"")[1]
				destLineNr=accessLine.split("\"")[2].split(" ")[2]
			elif accessLine.startswith("(sourceAnchor "):
				# line resembles (sourceAnchor #[file "Acquisition/Api/Src/AcqApi/AcqApiCommandHandler.cpp" start 000673 end 000673|]#)
				sourceFile = accessLine.split("\"")[1]
				sourceLineNr = accessLine.split("\"")[2].split(" ")[2]
			elif accessLine.startswith("(isAccessLValue "):
				# line resembles (isAccessLValue -TRUE-)
				value = accessLine.split("-")[1]
				isAccessLValue = (value == "TRUE")

		accessorId = ""
		accessorId = utility.getEntityId(srcSourceFile, srcLineNr, needDef = True)

		accesseeId = ""
		if ( accesseeUniqueName in attributes ):
			accesseeId = attributes[accesseeUniqueName]
		elif ( accesseeUniqueName in globalVars ):
			accesseeId = globalVars[accesseeUniqueName]

		if not ( (accessorId != "") and (accesseeId != "") ):
			continue

		accessInfo=accessId + "\t" + accessorId + "\t" + accesseeId + "\n"
		output_file.write(accessInfo)

		if ( isAccessLValue ):
			access_type_file.write(accessId + "\n")
예제 #6
0
				if ( invokeeBase != "" ):
					invokeeUniqueName=invokeeBase+"."+invokeeUniqueName	
			elif invLine.startswith("(sourceAnchor "):
				sourceFile = invLine.split("\"")[1]
				sourceLineNr = invLine.split("\"")[2].split(" ")[2]
			elif invLine.startswith("(sourceSourceAnchor "):
				# line resembles  (sourceSourceAnchor #[file "" start  end |]#)
				srcSourceFile=invLine.split("\"")[1]
				srcLineNr=invLine.split("\"")[2].split(" ")[2]
			elif invLine.startswith("(destinationSourceAnchor "):
				# line resembles  (destinationSourceAnchor #[file "" start  end |]#)
				destSourceFile=invLine.split("\"")[1]
				destLineNr=invLine.split("\"")[2].split(" ")[2]
				
		
		invokerId = utility.getEntityId(srcSourceFile, srcLineNr, needDef = True)
		#invokerId = ""
		#if ( invokerUniqueName in methods ):
		#	invokerId = methods[invokerUniqueName]
		#elif ( invokerUniqueName in functions ):
		#	invokerId = functions[invokerUniqueName]

		#invokeeId = utility.getEntityId(destSourceFile, destLineNr, needDef = True)
		invokeeId = utility.getEntityId(destSourceFile, destLineNr, needDef = False)

		#invokeeId = ""
		#if ( invokeeUniqueName in methods ):
		#	invokeeId = methods[invokeeUniqueName]
		#elif ( invokeeUniqueName in functions ):
		#	invokeeId = functions[invokeeUniqueName]