46 const G4bool tcsh_build =
false;
55 ::UI-> SetSession(
this);
56 ::UI-> SetCoutDestination(
this);
78 ::UI-> SetCoutDestination(0);
95 G4String G4MPIsession::GetCommand(
const char* msg)
101 newCommand = shell_-> GetCommandLineString(msg);
104 if( nC.length() == 0 ) {
105 newCommand = nullString;
107 }
else if( nC(0) ==
'#' ) {
109 newCommand = nullString;
111 }
else if( nC ==
"ls" || nC(0,3) ==
"ls " ) {
113 newCommand = nullString;
115 }
else if( nC ==
"lc" || nC(0,3) ==
"lc " ) {
116 shell_-> ListCommand(nC.
remove(0,2));
117 newCommand = nullString;
119 }
else if( nC ==
"pwd" ) {
120 G4cout <<
"Current Command Directory : "
122 newCommand = nullString;
124 }
else if( nC ==
"cwd" ) {
125 shell_-> ShowCurrentDirectory();
126 newCommand = nullString;
128 }
else if(nC ==
"cd" || nC(0,3) ==
"cd " ) {
131 newCommand = nullString;
133 }
else if( nC ==
"help" || nC(0,5) ==
"help " ) {
135 newCommand = nullString;
137 }
else if( nC(0) ==
'?' ) {
139 newCommand = nullString;
141 }
else if( nC ==
"hist" || nC ==
"history" ) {
142 G4int nh= ::UI-> GetNumberOfHistory();
143 for(
G4int i = 0; i<nh; i++ ) {
144 G4cout << i <<
": " << ::UI-> GetPreviousCommand(i) <<
G4endl;
146 newCommand = nullString;
148 }
else if( nC(0) ==
'!' ) {
152 std::istringstream is(tt);
154 G4int nh = ::UI-> GetNumberOfHistory();
155 if( vl>=0 && vl<nh ) {
156 newCommand = ::UI-> GetPreviousCommand(vl);
159 G4cerr <<
"history " << vl <<
" is not found." <<
G4endl;
160 newCommand = nullString;
163 }
else if( nC.empty() ) {
164 newCommand = nullString;
166 }
else if( nC ==
"exit" ) {
181 if(
g4mpi_-> IsInitMacro() ) {
186 if(
g4mpi_-> IsBatchMode() ) {
197 scommand =
g4mpi_-> BcastCommand(newCommand);
198 if( scommand ==
"exit" ) {
199 G4bool qexit = TryForcedTerminate();
210 G4bool G4MPIsession::TryForcedTerminate()
212 if(!
g4mpi_-> CheckThreadStatus()) {
222 G4cout <<
"Run is still running. Do you abort a run? [y/N]:"
224 G4cin.getline(c,1024);
226 if(yesno ==
"y" || yesno ==
"Y" ||
227 yesno ==
"n" || yesno ==
"N" || yesno ==
"") {
231 if(c[0] ==
'y' || c[0] ==
'Y') {
233 xmessage =
g4mpi_-> BcastCommand(
"kill me");
235 xmessage =
g4mpi_-> BcastCommand(
"alive");
238 xmessage =
g4mpi_-> BcastCommand(
"");
241 if(xmessage ==
"kill me") {
243 runManager-> AbortRun(
true);
A basic shell for MPI session.
A terminal session for MPI application.
void ChangeDirectoryCommand(const G4String &)
void TerminalHelp(const G4String &)
G4String & remove(str_size)
const G4String & GetInitFileName() const
G4String strip(G4int strip_Type=trailing, char c=' ')
const G4String & GetMacroFileName() const
static G4UImanager * GetUIpointer()
void SetPrompt(const G4String &prompt)
G4GLOB_DLL std::ostream G4cout
G4String TruncateCommand(const G4String &command) const
void SetShell(G4VUIshell *ashell)
G4String ModifyToFullPathCommand(const char *aCommandLine) const
static G4RunManager * GetRunManager()
void ShowCurrent(const G4String &) const
virtual G4UIsession * SessionStart()
void ListDirectory(const G4String &) const
static const G4bool tcsh_build
G4MPIsession(G4VUIshell *ashell=0)
G4String GetCurrentWorkingDirectory() const
G4int ExecCommand(const G4String &acommand)
G4GLOB_DLL std::ostream G4cerr