src/main.py
def runFromFile(smm, fileName):
    '''Takes the SystemMemoryManager object and file name to run
    a prewritted set of commands

    Input---
        smm : SystemMemoryManager object
        fileName : Name of file located in root directory '''
    #Test the Sample output
    with open(fileName, 'r') as f:
        cursor = str.strip(f.readline())
        while cursor != '':
            if cursor == 'R':
                cursor = str.strip(f.readline())
                tmpAddress = int(cursor, 16)
                smm.read(tmpAddress)
            elif cursor == 'W':
                cursor = str.strip(f.readline())
                tmpAddress = int(cursor, 16)
                cursor = str.strip(f.readline())
                tmpData = int(cursor, 16)
                print(tmpAddress, tmpData)
                smm.write(tmpAddress,tmpData)
            elif cursor == 'D':
                smm.displayCache()

            #Load up the next line from the file
            cursor = str.strip(f.readline())
Takes the SystemMemoryManager object and file name to run
    a prewritted set of commands

    Input---
        smm : SystemMemoryManager object
        fileName : Name of file located in root directory 
Takes the SystemMemoryManager object and file name to run
a prewritted set of commands

Input
smm : SystemMemoryManager object
fileName : Name of file located in root directory
Takes the SystemMemoryManager object and file name to run a prewritted set of commands Input smm : SystemMemoryManager object fileName : Name of file located in root directory
def runFromFile(smm, fileName):
    with open(fileName, 'r') as f:
        cursor = str.strip(f.readline())
        while cursor != '':
            if cursor == 'R':
                cursor = str.strip(f.readline())
                tmpAddress = int(cursor, 16)
                smm.read(tmpAddress)
            elif cursor == 'W':
                cursor = str.strip(f.readline())
                tmpAddress = int(cursor, 16)
                cursor = str.strip(f.readline())
                tmpData = int(cursor, 16)
                print(tmpAddress, tmpData)
                smm.write(tmpAddress,tmpData)
            elif cursor == 'D':
                smm.displayCache()
            cursor = str.strip(f.readline())
def runFromFile ( smm , fileName ) : with open ( fileName , 'r' ) as f : cursor = str . strip ( f . readline ( ) ) while cursor != '' : if cursor == 'R' : cursor = str . strip ( f . readline ( ) ) tmpAddress = int ( cursor , 16 ) smm . read ( tmpAddress ) elif cursor == 'W' : cursor = str . strip ( f . readline ( ) ) tmpAddress = int ( cursor , 16 ) cursor = str . strip ( f . readline ( ) ) tmpData = int ( cursor , 16 ) print ( tmpAddress , tmpData ) smm . write ( tmpAddress , tmpData ) elif cursor == 'D' : smm . displayCache ( ) cursor = str . strip ( f . readline ( ) )
Takes the SystemMemoryManager object and file name to run
a prewritted set of commands
Takes the SystemMemoryManager object and file name to run a prewritted set of commands
'''Takes the SystemMemoryManager object and file name to run
    a prewritted set of commands

    Input---
        smm : SystemMemoryManager object
        fileName : Name of file located in root directory ''' #Test the Sample output #Load up the next line from the file
smm
fileName