| Summary: | Semantics problem in G4UICommand | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | lapsintra |
| Component: | intercoms | Assignee: | asai |
| Status: | RESOLVED FIXED | ||
| Severity: | minor | ||
| Priority: | P4 | ||
| Version: | 10.4 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
|
Description
lapsintra
2018-07-07 18:19:01 CEST
Hi, If "0" is a valid value for "a" or "b", you should define the range as "a>=0 && b>=0". Also, please note that "a>=0 && b>=0 && b>a" is equivalent to "a>=0 && b>a". Makoto So sorry for my poor example. Let's try again testing only for "a>b":
cmd = new G4UIcommand("/my/path/cmd", this);
cmd->SetRange("a>b");
G4UIparameter* a = new G4UIparameter("a", 'i', false);
cmd->SetParameter(a);
G4UIparameter* b = new G4UIparameter("b", 'i', false);
cmd->SetParameter(b);
# this is supposed to fail
# Command: /my/path/cmd 1 2
# Output
integer operand expected for a>b.
integer operand expected for a>b.
parameter out of range: a>b
command refused (399):"/my/path/cmd 1 2"
# this should work
# Command: /my/path/cmd 2 1
# Output
integer operand expected for a>b.
integer operand expected for a>b.
parameter out of range: a>b
command refused (399):"/my/path/cmd 2 1"
It fails either way. Normally when a command fails due to parameter range only the message "parameter out of range..." is printed.
But I'm also getting the additional message of "integer operand expected for a>b"
These messages come from G4UIcommand::Eval2. I think it's because arg1.type = arg2.type = IDENTIFIER, which I don't think is supposed to happen. I couldn't figure out anything else.
Thanks for the clarification. Now I understand the issue and I will look into it. Kind regards, Makoto The fix will be included in the coming release of version 10.5. Thanks once again for reporting this bug. Makoto |