Import Geant4 10.6.0.beta source tree
This commit is contained in:
@@ -75,6 +75,7 @@ G4UIbatch::G4UIbatch(const char* fileName, G4UIsession* prevSession)
|
||||
G4cerr << "ERROR: Can not open a macro file <"
|
||||
<< fileName << ">. Set macro path with \"/control/macroPath\" if needed."
|
||||
<< G4endl;
|
||||
lastRC = fParameterUnreadable;
|
||||
} else {
|
||||
isOpened= true;
|
||||
}
|
||||
@@ -215,6 +216,7 @@ G4UIsession * G4UIbatch::SessionStart()
|
||||
G4int rc= ExecCommand(newCommand);
|
||||
if(rc != fCommandSucceeded) {
|
||||
G4cerr << G4endl << "***** Batch is interrupted!! *****" << G4endl;
|
||||
lastRC = rc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,7 +374,14 @@ void G4UIcontrolMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
}
|
||||
if(command==ExecuteCommand)
|
||||
{
|
||||
command->ResetFailure();
|
||||
UI-> ExecuteMacroFile(UI-> FindMacroPath(newValue));
|
||||
if(UI->GetLastReturnCode() != 0)
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Command aborted (" << UI->GetLastReturnCode() << ")";
|
||||
command->CommandFailed(UI->GetLastReturnCode(),ed);
|
||||
}
|
||||
}
|
||||
if(command==suppressAbortionCommand)
|
||||
{
|
||||
@@ -414,6 +421,7 @@ void G4UIcontrolMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
}
|
||||
if(command==getEnvCmd)
|
||||
{
|
||||
command->ResetFailure();
|
||||
if(getenv(newValue))
|
||||
{
|
||||
G4String st = "/control/alias ";
|
||||
@@ -423,7 +431,11 @@ void G4UIcontrolMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
UI->ApplyCommand(st);
|
||||
}
|
||||
else
|
||||
{ G4cerr << "<" << newValue << "> is not defined as a shell variable. Command ignored." << G4endl; }
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "<" << newValue << "> is not defined as a shell variable. Command ignored.";
|
||||
command->CommandFailed(ed);
|
||||
}
|
||||
}
|
||||
if(command==getValCmd)
|
||||
{
|
||||
@@ -451,16 +463,36 @@ void G4UIcontrolMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{ G4cout << UI->SolveAlias(newValue) << G4endl; }
|
||||
if(command==shellCommand)
|
||||
{
|
||||
command->ResetFailure();
|
||||
int rc = system(newValue);
|
||||
if ( rc < 0 ) {}
|
||||
if ( rc < 0 )
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "<" << newValue << "> is not a valid shell command. Command ignored.";
|
||||
command->CommandFailed(ed);
|
||||
}
|
||||
}
|
||||
if(command==loopCommand)
|
||||
{
|
||||
command->ResetFailure();
|
||||
UI->LoopS(newValue);
|
||||
if(UI->GetLastReturnCode() != 0)
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Command aborted (" << UI->GetLastReturnCode() << ")";
|
||||
command->CommandFailed(UI->GetLastReturnCode(),ed);
|
||||
}
|
||||
}
|
||||
if(command==foreachCommand)
|
||||
{
|
||||
command->ResetFailure();
|
||||
UI->ForeachS(newValue);
|
||||
if(UI->GetLastReturnCode() != 0)
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Command aborted (" << UI->GetLastReturnCode() << ")";
|
||||
command->CommandFailed(UI->GetLastReturnCode(),ed);
|
||||
}
|
||||
}
|
||||
if(command==HTMLCommand)
|
||||
{
|
||||
|
||||
@@ -90,7 +90,7 @@ G4UImanager::G4UImanager()
|
||||
UImessenger(0), UnitsMessenger(0), CoutMessenger(0),
|
||||
isMaster(false),bridges(0),
|
||||
ignoreCmdNotFound(false), stackCommandsForBroadcast(false),
|
||||
threadID(-1), threadCout(0)
|
||||
threadID(-1), threadCout(0), lastRC(0)
|
||||
{
|
||||
savedCommand = 0;
|
||||
treeTop = new G4UIcommandTree("/");
|
||||
@@ -312,7 +312,9 @@ void G4UImanager::ExecuteMacroFile(const char * fileName)
|
||||
{
|
||||
G4UIsession* batchSession = new G4UIbatch(fileName,session);
|
||||
session = batchSession;
|
||||
lastRC = 0;
|
||||
G4UIsession* previousSession = session->SessionStart();
|
||||
lastRC = session->GetLastReturnCode();
|
||||
delete session;
|
||||
session = previousSession;
|
||||
}
|
||||
@@ -403,6 +405,14 @@ void G4UImanager::Foreach(const char * macroFile,const char * variableName,
|
||||
vl += cd;
|
||||
SetAlias(vl);
|
||||
ExecuteMacroFile(FindMacroPath(macroFile));
|
||||
if(lastRC!=0)
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Loop aborted due to a command execution error - "
|
||||
<< "error code " << lastRC;
|
||||
G4Exception("G4UImanager::Foreach","UIMAN0201",JustWarning,ed);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,12 +31,12 @@
|
||||
#include "G4UIsession.hh"
|
||||
|
||||
G4int G4UIsession::inSession = 0;
|
||||
G4UIsession::G4UIsession() : ifBatch(0)
|
||||
G4UIsession::G4UIsession() : ifBatch(0) , lastRC(0)
|
||||
{
|
||||
inSession++;
|
||||
}
|
||||
|
||||
G4UIsession::G4UIsession(G4int iBatch) : ifBatch(iBatch)
|
||||
G4UIsession::G4UIsession(G4int iBatch) : ifBatch(iBatch) , lastRC(0)
|
||||
{;}
|
||||
|
||||
G4UIsession::~G4UIsession()
|
||||
|
||||
Reference in New Issue
Block a user