def macroSize(splitInput): #Call the macro expander to give us the expanded form of the macro expLine = macroExpand.expandline(splitInput) lineCount = 0 #Grep through the output, counting lines that hold actual assembly instructions for line in expLine: thisLine = line.split() if thisLine[0] in opcodes: lineCount += 1 return lineCount
print "Serious exception: Included file not opened! " + globalVars.FList[gobalVars.FIndex] + '\n' print "Proceeding with other files. Output may not be valid.\n" else: print "Fatal exception: Base file not opened!" raise #keep enforcing the organisation with files, but not between them. globalVars.DataFields = False #comments good DBuffer.append("\n;Start of data from " + globalVars.FList[globalVars.FIndex] + "\n") IBuffer.append("\n;Start of code from " + globalVars.FList[globalVars.FIndex] + "\n") #use the functions we defined above for line in inFile.readlines(): expandedLine = macroExpand.expandline(line.split()) for expLine in expandedLine: if(globalVars.DataFields): DBuffer.append(expLine) else: IBuffer.append(expLine) #comments foamy DBuffer.append("\n;End of data from " + globalVars.FList[globalVars.FIndex]) IBuffer.append("\n;End of code from " + globalVars.FList[globalVars.FIndex]) #housekeeping globalVars.FIndex += 1 inFile.close() #Add the one line of INF header that we care about