MCPcopy Create free account
hub / github.com/Geant4/geant4 / ExecuteCommand

Method ExecuteCommand

source/interfaces/core/src/G4UIterminal.cc:160–212  ·  view source on GitHub ↗

//////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

158
159///////////////////////////////////////////////////////////
160void G4UIterminal::ExecuteCommand(const G4String& aCommand)
161///////////////////////////////////////////////////////////
162{
163 if (aCommand.length() < 2) return;
164
165 G4int returnVal = UI->ApplyCommand(aCommand);
166
167 G4int paramIndex = returnVal % 100;
168 // 0 - 98 : paramIndex-th parameter is invalid
169 // 99 : convination of parameters is invalid
170 G4int commandStatus = returnVal - paramIndex;
171
172 G4UIcommand* cmd = nullptr;
173 if (commandStatus != fCommandSucceeded) {
174 cmd = FindCommand(aCommand);
175 }
176
177 switch (commandStatus) {
178 case fCommandSucceeded:
179 break;
180 case fCommandNotFound:
181 G4cerr << "command <" << UI->SolveAlias(aCommand) << "> not found" << G4endl;
182 if (aCommand.find("@@") != G4String::npos) {
183 G4cout << "@@G4UIterminal" << G4endl;
184 }
185 break;
186 case fIllegalApplicationState:
187 G4cerr << "illegal application state -- command refused" << G4endl;
188 break;
189 case fParameterOutOfRange:
190 // if(paramIndex<99) {
191 // G4cerr << "Parameter is out of range (index " << paramIndex << ")" << G4endl;
192 // G4cerr << "Allowed range : " << cmd->GetParameter(paramIndex)->GetParameterRange() <<
193 // G4endl;
194 // } else {
195 // G4cerr << "Parameter is out of range" << G4endl;
196 // G4cerr << "Allowed range : " << cmd->GetRange() << G4endl;
197 // }
198 break;
199 case fParameterOutOfCandidates:
200 G4cerr << "Parameter is out of candidate list (index " << paramIndex << ")" << G4endl;
201 G4cerr << "Candidates : " << cmd->GetParameter(paramIndex)->GetParameterCandidates()
202 << G4endl;
203 break;
204 case fParameterUnreadable:
205 G4cerr << "Parameter is wrong type and/or is not omittable (index " << paramIndex << ")"
206 << G4endl;
207 break;
208 case fAliasNotFound:
209 default:
210 G4cerr << "command refused (" << commandStatus << ")" << G4endl;
211 }
212}
213
214//////////////////////////////////////////////////
215G4String G4UIterminal::GetCommand(const char* msg)

Callers

nothing calls this directly

Calls 5

SolveAliasMethod · 0.80
GetParameterMethod · 0.80
lengthMethod · 0.45
ApplyCommandMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected