Changeset 533
- Timestamp:
- 02/08/2012 04:16:37 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
SHX/trunk/SeismicHandler/modules/parse.py
r531 r533 300 300 except: 301 301 # cannot open 302 raise ShxError(" Input not readable!")302 raise ShxError("Command or procedure not found!", status=1001) 303 303 304 304 # Cache self-handled commands. These methods begin with "command". … … 378 378 print cmd 379 379 380 logMessage("debug.parse", "executing '%s'" % cmd) 381 380 382 cmd = Parse(cmd, switches=self.switches).parsed 381 383 … … 383 385 _ = Translate(cmd, self, switches=self.switches) 384 386 self.__recent = cmd.get("shx_translated", cmd["shx_input_conv"]) 387 388 logMessage("debug.parse", "converted '%s'" % self.__recent) 385 389 386 390 # Check for internal command ... … … 510 514 511 515 def commandIf(self, *args, **kwargs): 512 print args, kwargs513 pass514 515 def IfGoto(self, cmd):516 516 # cast format 517 517 cast = { … … 521 521 } 522 522 523 cmp, check = cmd.p[2].value, cmd.p[2].value[:2] 524 525 var1 = cast[cmp[-1]](cmd.p[1].value) 526 var2 = cast[cmp[-1]](cmd.p[3].value) 523 try: 524 var1, cmp, var2, operation = args[:4] 525 except: 526 raise ShxError("invalid parameters", status=1701) 527 528 operation = operation.lower() 529 if operation not in ["goto", "return"]: 530 raise ShxError("illegal IF command %s" % operation, status=1712) 531 532 var1 = cast[cmp[-1].upper()](var1) 533 var2 = cast[cmp[-1].upper()](var2) 527 534 528 535 # comparison … … 548 555 549 556 # check condition 550 if comp[check](var2): 551 self.Goto(cmd.p[5].value) 557 if not comp[cmp[:2].upper()](var2): 558 logMessage("debug.parse.if", "statement is evaluated as false") 559 return 560 561 logMessage("debug.parse.if", "statement is evaluated as true") 562 563 if operation == "return": 564 self.commandReturn() 565 else: 566 # GOTO is left 567 try: 568 self.commandGoto(args[4]) 569 except IndexError: 570 raise ShxError("too less parameters passed", status=1712) 552 571 553 572 … … 662 681 cmd["shx_converted"] and cmd["shx_command"].upper() or \ 663 682 cmd["shx_command"], 664 " ".join( cmd["shx_parameter"]),683 " ".join(map(str, cmd["shx_parameter"])), 665 684 len(qual) and "/" + " /".join(qual) or "", 666 685 ])
Note: See TracChangeset
for help on using the changeset viewer.