Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/interfaces/core/src/G4UIterminal.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /interfaces/core/src/G4UIterminal.cc (Version 11.3.0) and /interfaces/core/src/G4UIterminal.cc (Version 11.2.1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
 27 //                                                 27 //
 28 // ===========================================     28 // ====================================================================
 29 //   G4UIterminal.cc                               29 //   G4UIterminal.cc
 30 //                                                 30 //
 31 // ===========================================     31 // ====================================================================
 32 #include "G4UIterminal.hh"                         32 #include "G4UIterminal.hh"
 33                                                    33 
 34 #include "G4StateManager.hh"                       34 #include "G4StateManager.hh"
 35 #include "G4Types.hh"                              35 #include "G4Types.hh"
 36 #include "G4UIcommand.hh"                          36 #include "G4UIcommand.hh"
 37 #include "G4UIcommandStatus.hh"                    37 #include "G4UIcommandStatus.hh"
 38 #include "G4UIcommandTree.hh"                      38 #include "G4UIcommandTree.hh"
 39 #include "G4UIcsh.hh"                              39 #include "G4UIcsh.hh"
 40                                                    40 
 41 #include <sstream>                                 41 #include <sstream>
 42                                                    42 
 43 #ifndef WIN32                                      43 #ifndef WIN32
 44 #  include <csignal>                               44 #  include <csignal>
 45 #endif                                             45 #endif
 46                                                    46 
 47 // ===========================================     47 // ====================================================================
 48 // signal handler for soft-abort                   48 // signal handler for soft-abort
 49 // ===========================================     49 // ====================================================================
 50                                                    50 
 51 static G4ThreadLocal G4VUIshell* theshell = nu     51 static G4ThreadLocal G4VUIshell* theshell = nullptr;
 52                                                    52 
 53 #ifndef WIN32                                      53 #ifndef WIN32
 54                                                    54 
 55 extern "C"                                         55 extern "C"
 56 {                                                  56 {
 57   ////////////////////////////////                 57   ////////////////////////////////
 58   static void SignalHandler(G4int)                 58   static void SignalHandler(G4int)
 59   ////////////////////////////////                 59   ////////////////////////////////
 60   {                                                60   {
 61     G4StateManager* stateManager = G4StateMana     61     G4StateManager* stateManager = G4StateManager::GetStateManager();
 62     G4ApplicationState state = stateManager->G     62     G4ApplicationState state = stateManager->GetCurrentState();
 63                                                    63 
 64     if (state == G4State_GeomClosed || state =     64     if (state == G4State_GeomClosed || state == G4State_EventProc) {
 65       G4cout << "aborting Run ...";                65       G4cout << "aborting Run ...";
 66       G4UImanager::GetUIpointer()->ApplyComman     66       G4UImanager::GetUIpointer()->ApplyCommand("/run/abort");
 67       G4cout << G4endl;                            67       G4cout << G4endl;
 68     }                                              68     }
 69     else {                                         69     else {
 70       G4cout << G4endl << "Session terminated.     70       G4cout << G4endl << "Session terminated." << G4endl;
 71       theshell->ResetTerminal();                   71       theshell->ResetTerminal();
 72       G4Exception(                                 72       G4Exception(
 73         "G4UIterminal::SignalHandler()", "UI00     73         "G4UIterminal::SignalHandler()", "UI0001", FatalException, "KeyboardInterrput with Ctrl-C");
 74     }                                              74     }
 75                                                    75 
 76     // for original Unix / System V                76     // for original Unix / System V
 77     signal(SIGINT, SignalHandler);                 77     signal(SIGINT, SignalHandler);
 78   }                                                78   }
 79 }                                                  79 }
 80 #endif                                             80 #endif
 81                                                    81 
 82 // ===========================================     82 // ====================================================================
 83 //                                                 83 //
 84 // class description                               84 // class description
 85 //                                                 85 //
 86 // ===========================================     86 // ====================================================================
 87                                                    87 
 88 //////////////////////////////////////////////     88 ///////////////////////////////////////////////////////////
 89 G4UIterminal::G4UIterminal(G4VUIshell* aShell,     89 G4UIterminal::G4UIterminal(G4VUIshell* aShell, G4bool qsig)
 90 //////////////////////////////////////////////     90 ///////////////////////////////////////////////////////////
 91 {                                                  91 {
 92   UI = G4UImanager::GetUIpointer();                92   UI = G4UImanager::GetUIpointer();
 93   UI->SetSession(this);                            93   UI->SetSession(this);
 94   UI->SetCoutDestination(this);                    94   UI->SetCoutDestination(this);
 95                                                    95 
 96   iExit = false;                                   96   iExit = false;
 97   iCont = false;                                   97   iCont = false;
 98                                                    98 
 99   if (aShell != nullptr)                           99   if (aShell != nullptr)
100     shell = aShell;                               100     shell = aShell;
101   else                                            101   else
102     shell = new G4UIcsh;                          102     shell = new G4UIcsh;
103   theshell = shell;  // locally stored for the    103   theshell = shell;  // locally stored for the signal handler
104                                                   104 
105   // add signal handler                           105   // add signal handler
106   if (qsig) {                                     106   if (qsig) {
107 #ifndef WIN32                                     107 #ifndef WIN32
108     signal(SIGINT, SignalHandler);                108     signal(SIGINT, SignalHandler);
109 #endif                                            109 #endif
110   }                                               110   }
111 }                                                 111 }
112                                                   112 
113 /////////////////////////////                     113 /////////////////////////////
114 G4UIterminal::~G4UIterminal()                     114 G4UIterminal::~G4UIterminal()
115 /////////////////////////////                     115 /////////////////////////////
116 {                                                 116 {
117   delete shell;                                   117   delete shell;
118                                                   118 
119   if (G4UImanager::GetUIpointer() != nullptr)     119   if (G4UImanager::GetUIpointer() != nullptr) {
120     UI->SetSession(nullptr);                      120     UI->SetSession(nullptr);
121     UI->SetCoutDestination(nullptr);              121     UI->SetCoutDestination(nullptr);
122   }                                               122   }
123 }                                                 123 }
124                                                   124 
125 //////////////////////////////////////////////    125 ////////////////////////////////////////////////////
126 void G4UIterminal::SetPrompt(const G4String& p    126 void G4UIterminal::SetPrompt(const G4String& prompt)
127 //////////////////////////////////////////////    127 ////////////////////////////////////////////////////
128 {                                                 128 {
129   shell->SetPrompt(prompt);                       129   shell->SetPrompt(prompt);
130 }                                                 130 }
131                                                   131 
132 /////////////////////////////////////////         132 /////////////////////////////////////////
133 G4UIsession* G4UIterminal::SessionStart()         133 G4UIsession* G4UIterminal::SessionStart()
134 /////////////////////////////////////////         134 /////////////////////////////////////////
135 {                                                 135 {
136   iExit = true;                                   136   iExit = true;
137                                                   137 
138   G4String newCommand = GetCommand();             138   G4String newCommand = GetCommand();
139   while (iExit) {                                 139   while (iExit) {
140     ExecuteCommand(newCommand);                   140     ExecuteCommand(newCommand);
141     newCommand = GetCommand();                    141     newCommand = GetCommand();
142   }                                               142   }
143   return nullptr;                                 143   return nullptr;
144 }                                                 144 }
145                                                   145 
146 //////////////////////////////////////////////    146 /////////////////////////////////////////////////////////
147 void G4UIterminal::PauseSessionStart(const G4S    147 void G4UIterminal::PauseSessionStart(const G4String& msg)
148 //////////////////////////////////////////////    148 /////////////////////////////////////////////////////////
149 {                                                 149 {
150   iCont = true;                                   150   iCont = true;
151                                                   151 
152   G4String newCommand = GetCommand(msg);          152   G4String newCommand = GetCommand(msg);
153   while (iCont) {                                 153   while (iCont) {
154     ExecuteCommand(newCommand);                   154     ExecuteCommand(newCommand);
155     newCommand = GetCommand(msg);                 155     newCommand = GetCommand(msg);
156   }                                               156   }
157 }                                                 157 }
158                                                   158 
159 //////////////////////////////////////////////    159 ///////////////////////////////////////////////////////////
160 void G4UIterminal::ExecuteCommand(const G4Stri    160 void G4UIterminal::ExecuteCommand(const G4String& aCommand)
161 //////////////////////////////////////////////    161 ///////////////////////////////////////////////////////////
162 {                                                 162 {
163   if (aCommand.length() < 2) return;              163   if (aCommand.length() < 2) return;
164                                                   164 
165   G4int returnVal = UI->ApplyCommand(aCommand)    165   G4int returnVal = UI->ApplyCommand(aCommand);
166                                                   166 
167   G4int paramIndex = returnVal % 100;             167   G4int paramIndex = returnVal % 100;
168   // 0 - 98 : paramIndex-th parameter is inval    168   // 0 - 98 : paramIndex-th parameter is invalid
169   // 99     : convination of parameters is inv    169   // 99     : convination of parameters is invalid
170   G4int commandStatus = returnVal - paramIndex    170   G4int commandStatus = returnVal - paramIndex;
171                                                   171 
172   G4UIcommand* cmd = nullptr;                     172   G4UIcommand* cmd = nullptr;
173   if (commandStatus != fCommandSucceeded) {       173   if (commandStatus != fCommandSucceeded) {
174     cmd = FindCommand(aCommand);                  174     cmd = FindCommand(aCommand);
175   }                                               175   }
176                                                   176 
177   switch (commandStatus) {                        177   switch (commandStatus) {
178     case fCommandSucceeded:                       178     case fCommandSucceeded:
179       break;                                      179       break;
180     case fCommandNotFound:                        180     case fCommandNotFound:
181       G4cerr << "command <" << UI->SolveAlias(    181       G4cerr << "command <" << UI->SolveAlias(aCommand) << "> not found" << G4endl;
182       if (aCommand.find("@@") != G4String::npo    182       if (aCommand.find("@@") != G4String::npos) {
183         G4cout << "@@G4UIterminal" << G4endl;     183         G4cout << "@@G4UIterminal" << G4endl;
184       }                                           184       }
185       break;                                      185       break;
186     case fIllegalApplicationState:                186     case fIllegalApplicationState:
187       G4cerr << "illegal application state --     187       G4cerr << "illegal application state -- command refused" << G4endl;
188       break;                                      188       break;
189     case fParameterOutOfRange:                    189     case fParameterOutOfRange:
190       // if(paramIndex<99) {                      190       // if(paramIndex<99) {
191       //   G4cerr << "Parameter is out of rang    191       //   G4cerr << "Parameter is out of range (index " << paramIndex << ")" << G4endl;
192       //   G4cerr << "Allowed range : " << cmd    192       //   G4cerr << "Allowed range : " << cmd->GetParameter(paramIndex)->GetParameterRange() <<
193       //   G4endl;                                193       //   G4endl;
194       // } else {                                 194       // } else {
195       //   G4cerr << "Parameter is out of rang    195       //   G4cerr << "Parameter is out of range" << G4endl;
196       //   G4cerr << "Allowed range : " << cmd    196       //   G4cerr << "Allowed range : " << cmd->GetRange() << G4endl;
197       // }                                        197       // }
198       break;                                      198       break;
199     case fParameterOutOfCandidates:               199     case fParameterOutOfCandidates:
200       G4cerr << "Parameter is out of candidate    200       G4cerr << "Parameter is out of candidate list (index " << paramIndex << ")" << G4endl;
201       G4cerr << "Candidates : " << cmd->GetPar    201       G4cerr << "Candidates : " << cmd->GetParameter(paramIndex)->GetParameterCandidates()
202              << G4endl;                           202              << G4endl;
203       break;                                      203       break;
204     case fParameterUnreadable:                    204     case fParameterUnreadable:
205       G4cerr << "Parameter is wrong type and/o    205       G4cerr << "Parameter is wrong type and/or is not omittable (index " << paramIndex << ")"
206              << G4endl;                           206              << G4endl;
207       break;                                      207       break;
208     case fAliasNotFound:                          208     case fAliasNotFound:
209     default:                                      209     default:
210       G4cerr << "command refused (" << command    210       G4cerr << "command refused (" << commandStatus << ")" << G4endl;
211   }                                               211   }
212 }                                                 212 }
213                                                   213 
214 //////////////////////////////////////////////    214 //////////////////////////////////////////////////
215 G4String G4UIterminal::GetCommand(const char*     215 G4String G4UIterminal::GetCommand(const char* msg)
216 //////////////////////////////////////////////    216 //////////////////////////////////////////////////
217 {                                                 217 {
218   G4String newCommand = shell->GetCommandLineS    218   G4String newCommand = shell->GetCommandLineString(msg);
219   const G4String& nullString = "";             << 219   G4String nullString = "";
220                                                   220 
221   G4String nC = G4StrUtil::lstrip_copy(newComm    221   G4String nC = G4StrUtil::lstrip_copy(newCommand);
222                                                   222 
223   if (nC.length() == 0) {                         223   if (nC.length() == 0) {
224     newCommand = nullString;                      224     newCommand = nullString;
225   }                                               225   }
226   else if (nC[0] == '#') {                        226   else if (nC[0] == '#') {
227     G4cout << nC << G4endl;                       227     G4cout << nC << G4endl;
228     newCommand = nullString;                      228     newCommand = nullString;
229   }                                               229   }
230   else if (nC == "ls" || nC.substr(0, 3) == "l    230   else if (nC == "ls" || nC.substr(0, 3) == "ls ") {  // list commands
231     ListDirectory(nC);                            231     ListDirectory(nC);
232     newCommand = nullString;                      232     newCommand = nullString;
233   }                                               233   }
234   else if (nC == "lc" || nC.substr(0, 3) == "l    234   else if (nC == "lc" || nC.substr(0, 3) == "lc ") {  // ... by shell
235     shell->ListCommand(nC.erase(0, 2));           235     shell->ListCommand(nC.erase(0, 2));
236     newCommand = nullString;                      236     newCommand = nullString;
237   }                                               237   }
238   else if (nC == "pwd") {  // show current dir    238   else if (nC == "pwd") {  // show current directory
239     G4cout << "Current Command Directory : " <    239     G4cout << "Current Command Directory : " << GetCurrentWorkingDirectory() << G4endl;
240     newCommand = nullString;                      240     newCommand = nullString;
241   }                                               241   }
242   else if (nC == "cwd") {  // ... by shell        242   else if (nC == "cwd") {  // ... by shell
243     shell->ShowCurrentDirectory();                243     shell->ShowCurrentDirectory();
244     newCommand = nullString;                      244     newCommand = nullString;
245   }                                               245   }
246   else if (nC == "cd" || nC.substr(0, 3) == "c    246   else if (nC == "cd" || nC.substr(0, 3) == "cd ") {  // "cd"
247     ChangeDirectoryCommand(nC);                   247     ChangeDirectoryCommand(nC);
248     shell->SetCurrentDirectory(GetCurrentWorki    248     shell->SetCurrentDirectory(GetCurrentWorkingDirectory());
249     newCommand = nullString;                      249     newCommand = nullString;
250   }                                               250   }
251   else if (nC == "help" || nC.substr(0, 5) ==     251   else if (nC == "help" || nC.substr(0, 5) == "help ") {  // "help"
252     TerminalHelp(nC);                             252     TerminalHelp(nC);
253     newCommand = nullString;                      253     newCommand = nullString;
254   }                                               254   }
255   else if (nC[0] == '?') {  // "show current v    255   else if (nC[0] == '?') {  // "show current value of a parameter"
256     ShowCurrent(nC);                              256     ShowCurrent(nC);
257     newCommand = nullString;                      257     newCommand = nullString;
258   }                                               258   }
259   else if (nC == "hist" || nC == "history") {     259   else if (nC == "hist" || nC == "history") {  // "hist/history"
260     G4int nh = UI->GetNumberOfHistory();          260     G4int nh = UI->GetNumberOfHistory();
261     for (G4int i = 0; i < nh; i++) {              261     for (G4int i = 0; i < nh; i++) {
262       G4cout << i << ": " << UI->GetPreviousCo    262       G4cout << i << ": " << UI->GetPreviousCommand(i) << G4endl;
263     }                                             263     }
264     newCommand = nullString;                      264     newCommand = nullString;
265   }                                               265   }
266   else if (nC[0] == '!') {  // "!"                266   else if (nC[0] == '!') {  // "!"
267     G4String ss = nC.substr(1, nC.length() - 1    267     G4String ss = nC.substr(1, nC.length() - 1);
268     G4int vl;                                     268     G4int vl;
269     const char* tt = ss;                          269     const char* tt = ss;
270     std::istringstream is(tt);                    270     std::istringstream is(tt);
271     is >> vl;                                     271     is >> vl;
272     G4int nh = UI->GetNumberOfHistory();          272     G4int nh = UI->GetNumberOfHistory();
273     if (vl >= 0 && vl < nh) {                     273     if (vl >= 0 && vl < nh) {
274       newCommand = UI->GetPreviousCommand(vl);    274       newCommand = UI->GetPreviousCommand(vl);
275       G4cout << newCommand << G4endl;             275       G4cout << newCommand << G4endl;
276     }                                             276     }
277     else {                                        277     else {
278       G4cerr << "history " << vl << " is not f    278       G4cerr << "history " << vl << " is not found." << G4endl;
279       newCommand = nullString;                    279       newCommand = nullString;
280     }                                             280     }
281   }                                               281   }
282   else if (nC == "exit") {  // "exit"             282   else if (nC == "exit") {  // "exit"
283     if (iCont) {                                  283     if (iCont) {
284       G4cout << "You are now processing RUN."     284       G4cout << "You are now processing RUN." << G4endl;
285       G4cout << "Please abort it using \"/run/    285       G4cout << "Please abort it using \"/run/abort\" command first" << G4endl;
286       G4cout << " and use \"continue\" command    286       G4cout << " and use \"continue\" command until the application" << G4endl;
287       G4cout << " becomes to Idle." << G4endl;    287       G4cout << " becomes to Idle." << G4endl;
288     }                                             288     }
289     else {                                        289     else {
290       iExit = false;                              290       iExit = false;
291       newCommand = nullString;                    291       newCommand = nullString;
292     }                                             292     }
293   }                                               293   }
294   else if (nC == "cont" || nC == "continue") {    294   else if (nC == "cont" || nC == "continue") {  // "cont/continu"
295     iCont = false;                                295     iCont = false;
296     newCommand = nullString;                      296     newCommand = nullString;
297   }                                               297   }
298   else if (nC.empty()) {  // NULL command         298   else if (nC.empty()) {  // NULL command
299     newCommand = nullString;                      299     newCommand = nullString;
300   }                                               300   }
301   else {                                          301   else {
302   }                                               302   }
303                                                   303 
304   return ModifyToFullPathCommand(newCommand);     304   return ModifyToFullPathCommand(newCommand);
305 }                                                 305 }
306                                                   306 
307 //////////////////////////////////////////////    307 /////////////////////////////////////////////////////////////
308 G4int G4UIterminal::ReceiveG4debug(const G4Str    308 G4int G4UIterminal::ReceiveG4debug(const G4String& debugString)
309 //////////////////////////////////////////////    309 /////////////////////////////////////////////////////////////
310 {                                                 310 {
311   std::cout << debugString << std::flush;         311   std::cout << debugString << std::flush;
312   return 0;                                       312   return 0;
313 }                                                 313 }
314                                                   314 
315 //////////////////////////////////////////////    315 /////////////////////////////////////////////////////////////
316 G4int G4UIterminal::ReceiveG4cout(const G4Stri    316 G4int G4UIterminal::ReceiveG4cout(const G4String& coutString)
317 //////////////////////////////////////////////    317 /////////////////////////////////////////////////////////////
318 {                                                 318 {
319   std::cout << coutString << std::flush;          319   std::cout << coutString << std::flush;
320   return 0;                                       320   return 0;
321 }                                                 321 }
322                                                   322 
323 //////////////////////////////////////////////    323 /////////////////////////////////////////////////////////////
324 G4int G4UIterminal::ReceiveG4cerr(const G4Stri    324 G4int G4UIterminal::ReceiveG4cerr(const G4String& cerrString)
325 //////////////////////////////////////////////    325 /////////////////////////////////////////////////////////////
326 {                                                 326 {
327   std::cerr << cerrString << std::flush;          327   std::cerr << cerrString << std::flush;
328   return 0;                                       328   return 0;
329 }                                                 329 }
330                                                   330 
331 //////////////////////////////////////////////    331 ///////////////////////////////////////////////
332 G4bool G4UIterminal::GetHelpChoice(G4int& aInt    332 G4bool G4UIterminal::GetHelpChoice(G4int& aInt)
333 //////////////////////////////////////////////    333 ///////////////////////////////////////////////
334 {                                                 334 {
335   G4cin >> aInt;                                  335   G4cin >> aInt;
336   if (! G4cin.good()) {                           336   if (! G4cin.good()) {
337     G4cin.clear();                                337     G4cin.clear();
338     G4cin.ignore(30, '\n');                       338     G4cin.ignore(30, '\n');
339     return false;                                 339     return false;
340   }                                               340   }
341   return true;                                    341   return true;
342 }                                                 342 }
343                                                   343 
344 ///////////////////////////////////               344 ///////////////////////////////////
345 void G4UIterminal::ExitHelp() const               345 void G4UIterminal::ExitHelp() const
346 ///////////////////////////////////               346 ///////////////////////////////////
347 {                                                 347 {
348   char temp[100];                                 348   char temp[100];
349   G4cin.getline(temp, 100);                       349   G4cin.getline(temp, 100);
350 }                                                 350 }
351                                                   351