From: Tero K. <te...@us...> - 2005-08-26 17:15:42
|
Update of /cvsroot/openexvis/openexvis In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30403 Modified Files: oevt_python.py openexvis.py visualizer.py Log Message: Fix some problems found in pre-release testing. Index: oevt_python.py =================================================================== RCS file: /cvsroot/openexvis/openexvis/oevt_python.py,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- oevt_python.py 26 Aug 2005 16:10:37 -0000 1.14 +++ oevt_python.py 26 Aug 2005 17:15:34 -0000 1.15 @@ -60,6 +60,7 @@ # oev_class == the value is a class name # oev_function == the value is a function name # oev_tuple == the value is a tuple + # oev_result == the value is a result from an evaluation # oev_temp == the value is something just to fill the stack # # The second item is the actual value. @@ -168,10 +169,35 @@ elif op['opcode'] == 'COMPARE_OP': r_name, r_value = lastvals.pop() l_name, l_value = lastvals.pop() - viscommands += 'COMPARE:' + op['oparg2'] + ':' + \ + try: + r_value = int(r_value) + l_value = int(l_value) + except ValueError: + pass + sign = op['oparg2'] + if sign == '==': + if (l_value == r_value): + result = 'TRUE' + else: + result = 'FALSE' + elif sign == '<': + if (l_value < r_value): + result = 'TRUE' + else: + result = 'FALSE' + elif sign == '>': + if (l_value > r_value): + result = 'TRUE' + else: + result = 'FALSE' + else: + print "Unsupported comparison operation: ", sign + continue + viscommands += 'COMPARE:' + sign + ':' + \ str(l_name) + ':' + str(l_value) + ':' + \ - str(r_name) + ':' + str(r_value) + ';' - lastvals.append(['oev_temp', 'comparison_result']) + str(r_name) + ':' + str(r_value) + ':' + \ + result + ';' + lastvals.append(['oev_result', result]) elif op['opcode'] == 'INPLACE_ADD': r_name, r_value = lastvals.pop() @@ -180,7 +206,7 @@ str(l_name) + ':' + str(l_value) + ':' + \ str(r_name) + ':' + str(r_value) + ';' sum = int(l_value) + int(r_value) - lastvals.append(['eval_result', sum]) + lastvals.append(['oev_result', sum]) elif op['opcode'] == 'BUILD_TUPLE': if int(op['oparg1']) < 1: @@ -212,9 +238,9 @@ if lastvals: lastvals.pop() - - elif op['opcode'] == 'POP_BLOCK': - viscommands += 'EXIT_BLOCK' +# TODO: Hmm, this didn't work when a typo was fixed. +# elif op['opcode'] == 'POP_BLOCK': +# viscommands += 'EXIT_BLOCK;' elif op['opcode'] == 'PRINT_ITEM': name, output = lastvals.pop() Index: openexvis.py =================================================================== RCS file: /cvsroot/openexvis/openexvis/openexvis.py,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- openexvis.py 26 Aug 2005 16:31:51 -0000 1.25 +++ openexvis.py 26 Aug 2005 17:15:34 -0000 1.26 @@ -203,9 +203,9 @@ elif elem[1] == 'structure': direction = elem[2] if direction == 'UP': - #print "DEBUG: About to pop from structure, which is ",\ - #self.structure - self.structure.pop() + #print "DEBUG: About to pop from ", self.structure + if self.structure: + self.structure.pop() elif direction == 'DOWN': pass @@ -271,24 +271,7 @@ # cmd[4] is the variable on the right side of the comparison or # None if the value is a constant. # cmd[5] is the value of the right side of the comparison. - if cmd[1] == '==': - if cmd[3] == cmd[5]: - result = 'TRUE' - else: - result = 'FALSE' - elif cmd[1] == '<': - if cmd[3] < cmd[5]: - result = 'TRUE' - else: - result = 'FALSE' - elif cmd[1] == '>': - if cmd[3] > cmd[5]: - result = 'TRUE' - else: - result = 'FALSE' - else: - print "Unsupported comparison operation: ", cmd[1] - continue + # cmd[6] is the comparison result. if cmd[2] != 'None': left = str(cmd[2]) + '_value' else: @@ -297,7 +280,7 @@ right = str(cmd[4]) + '_value' else: right = 'const_' + str(cmd[5]) - self.draw_show_eval(left, cmd[1], right, result) + self.draw_show_eval(left, cmd[1], right, cmd[6]) elif cmd[0] == 'SHOW_OPERATION': # cmd[1] is the operation sign (+,-,*,/) @@ -592,7 +575,7 @@ pmname = 'move_const_' + const self.create_element_pixmap(pmname, startx, starty,\ self.moving_const_color, w, h, const) - elif source == 'eval_result': + elif source == 'oev_result': pmname = 'result_' + const else: # The source should be another variable. Index: visualizer.py =================================================================== RCS file: /cvsroot/openexvis/openexvis/visualizer.py,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- visualizer.py 26 Aug 2005 16:10:37 -0000 1.14 +++ visualizer.py 26 Aug 2005 17:15:34 -0000 1.15 @@ -102,7 +102,9 @@ # c[4] is the variable on the right side of the comparison or # None if the value is a constant. # c[5] is the value of the right side of the comparison. - cmd.append(['SHOW_COMPARISON', c[1], c[2], c[3], c[4], c[5]]) + # cmd[6] is the comparison result. + cmd.append(['SHOW_COMPARISON', c[1], \ + c[2], c[3], c[4], c[5], c[6]]) elif c[0] == 'SHOW_INT_OPERATION': # c[1] is the sign of the operation. # c[2] is the variable on the left side of the operation or |