def load_ajax(): if request.method == "POST": data = request.get_json() fileNames = data['files'] fileNames = [str(i) for i in fileNames] filedata = {} for file in fileNames: with open(file, 'r') as f: filedata[file] = f.read() main.x = fileNames main.runass() main.runlin() symTable = main.getSymTable() globTable = main.getGlobTable() extTable = main.getExtTable() pass1 = {} pass2 = {} iftable = main.getifTable() # print 'lol' # print iftable for file in fileNames: file = file.split('.')[0] with open(file+'.l') as f: pass1[file] = f.read() with open(file+'.li') as f: pass2[file] = f.read() with open(fileNames[0].split('.')[0]+'.ls') as f: lin = f.read() return json.dumps({'status':'OK' ,'pass1':pass1, 'pass2':pass2, 'lin':lin, 'symTable':symTable, 'globTable':globTable, 'extTable':extTable , 'ifTable': iftable, 'filedata':filedata})
def load_ajax(): if request.method == "POST": data = request.get_json() fileNames = data['files'] fileNames = [str(i) for i in fileNames] filedata = {} for file in fileNames: with open(file, 'r') as f: filedata[file] = f.read() main.x = fileNames main.runass() main.runlin() symTable = main.getSymTable() globTable = main.getGlobTable() extTable = main.getExtTable() litTable = main.getLitTable() # print("LITTAB", litTable) # print("SYMTAB", symTable) # print("GLOBTABLE", globTable) pass1 = {} pass2 = {} iftable = main.getifTable() for file in fileNames: file = file.split('.')[0] with open(file+'.pass1') as f: pass1[file] = f.read() with open(file+'.pass2') as f: pass2[file] = f.read() with open(fileNames[0].split('.')[0]+'.linked') as f: lin = f.read() return json.dumps({'status':'OK' ,'pass1':pass1, 'pass2':pass2, 'lin':lin, 'symTable':symTable, 'globTable':globTable, 'extTable':extTable , 'ifTable': iftable, 'filedata':filedata, 'litTable':litTable})
def calculate(*args): finalfile = main.x[0].split('.')[0] + '.8085' str1 = '' str1 = str1 + 'Interpreting...........\nRunning Assembler \n' meters.set(str1) main.runass() str1 = str1 + 'Assembler Completed \n' + 'Running Linker \n' meters.set(str1) main.runlin() str1 = str1 + 'Linker Completed \n' + 'Running Loader \n' meters.set(str1) main.runload() str1 = str1 + 'Loading Complete \n' + '\t\tFile is ready to simulate.\n' + '\t\tFile name is : ' + finalfile + '\n' meters.set(str1)
def calculate(*args): finalfile = main.x[0].split('.')[0] + '.8085' str1 = '' str1 = str1 + 'Interpreting...........\nRunning Assembler \n' meters.set(str1) main.runass() str1 = str1 + 'Assembler Completed \n' + 'Running Linker \n' meters.set(str1) main.runlin() str1 = str1 + 'Linker Completed \n' + 'Running Loader \n' meters.set(str1) main.runload() str1 = str1 + 'Loading Complete \n' + '\t\tFile is ready to simulate.\n' + '\t\tFile name is : ' + finalfile + '\n' meters.set(str1)
def load_ajax(): if request.method == "POST": data = request.get_json() fileNames = data['files'] fileNames = [str(i) for i in fileNames] filedata = {} for file in fileNames: with open(file, 'r') as f: filedata[file] = f.read() main.x = fileNames global error_ass error_ass = "No Error" main.runass() # print("compilation_error:") error_ass = main.error_found print(error_ass) # print(filedata[fileNames[0]]) # print() # messagebox.showinfo("Code",filedata[fileNames[0]]) display = str(filedata[fileNames[0]]) + "\n\n" + str(error_ass) # hide main window root = tkinter.Tk() root.option_add('*Dialog.msg.width', 30) root.withdraw() if str(error_ass) != "No Error": messagebox.showerror("Error Details", display) root.update() else: display = str(filedata[fileNames[0]]) + "\n\n" + "No Error" messagebox.showinfo("Code Details", display) root.update() # if error_ass != "No Error": # flash(error_ass) main.runlin() symTable = main.getSymTable() globTable = main.getGlobTable() extTable = main.getExtTable() litTable = main.getLitTable() # print("LITTAB", litTable) # print("SYMTAB", symTable) # print("GLOBTABLE", globTable) pass1 = {} pass2 = {} iftable = main.getifTable() for file in fileNames: file = file.split('.')[0] with open(file + '.pass1') as f: pass1[file] = f.read() with open(file + '.pass2') as f: pass2[file] = f.read() with open(fileNames[0].split('.')[0] + '.linked') as f: lin = f.read() return json.dumps({ 'status': 'OK', 'pass1': pass1, 'pass2': pass2, 'lin': lin, 'symTable': symTable, 'globTable': globTable, 'extTable': extTable, 'ifTable': iftable, 'filedata': filedata, 'litTable': litTable, 'error_ass': error_ass })