Import Geant4 1.1.0 source tree
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIterminal.cc,v 1.4.4.1.2.1 1999/12/07 20:49:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
// $Id: G4UIterminal.cc,v 1.4.4.1.2.1.2.7 1999/12/14 09:16:47 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
//
|
||||
|
||||
#include "G4UIterminal.hh"
|
||||
@@ -15,11 +15,7 @@
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UIcommandStatus.hh"
|
||||
#include "G4ios.hh"
|
||||
#ifdef WIN32
|
||||
# include <Strstrea.h>
|
||||
#else
|
||||
# include <strstream.h>
|
||||
#endif
|
||||
#include "g4std/strstream"
|
||||
|
||||
G4UIterminal::G4UIterminal()
|
||||
{
|
||||
@@ -39,7 +35,7 @@ G4UIterminal::~G4UIterminal()
|
||||
{
|
||||
UI->SetSession(NULL);
|
||||
UI->SetCoutDestination(NULL);
|
||||
// G4cout << "Terminal session deleted" << endl;
|
||||
// G4cout << "Terminal session deleted" << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,13 +70,13 @@ void G4UIterminal::PauseSessionStart(G4String msg)
|
||||
|
||||
G4int G4UIterminal::ReceiveG4cout(G4String coutString)
|
||||
{
|
||||
cout << coutString << flush;
|
||||
G4std::cout << coutString << G4std::flush;
|
||||
return 0;
|
||||
}
|
||||
|
||||
G4int G4UIterminal::ReceiveG4cerr(G4String cerrString)
|
||||
{
|
||||
cerr << cerrString << flush;
|
||||
G4std::cerr << cerrString << G4std::flush;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -95,19 +91,19 @@ void G4UIterminal::ExecuteCommand(G4String aCommand)
|
||||
case fCommandSucceeded:
|
||||
break;
|
||||
case fCommandNotFound:
|
||||
G4cerr << "command <" << aCommand << "> not found" << endl;
|
||||
G4cerr << "command <" << aCommand << "> not found" << G4endl;
|
||||
if ( aCommand.index("@@") != G4std::string::npos) {
|
||||
G4cout << "@@G4UIterminal" << endl;
|
||||
G4cout << "@@G4UIterminal" << G4endl;
|
||||
}
|
||||
break;
|
||||
case fIllegalApplicationState:
|
||||
G4cerr << "illegal application state -- command refused" << endl;
|
||||
G4cerr << "illegal application state -- command refused" << G4endl;
|
||||
break;
|
||||
case fParameterOutOfRange:
|
||||
case fParameterUnreadable:
|
||||
case fParameterOutOfCandidates:
|
||||
default:
|
||||
G4cerr << "command refused (" << commandStatus << ")" << endl;
|
||||
G4cerr << "command refused (" << commandStatus << ")" << G4endl;
|
||||
}
|
||||
}
|
||||
G4String G4UIterminal::GetCommand()
|
||||
@@ -118,8 +114,8 @@ G4String G4UIterminal::GetCommand()
|
||||
{
|
||||
G4cout << promptCharacter;
|
||||
G4cout.flush();
|
||||
newCommand.readLine( cin, FALSE );
|
||||
if (!cin.good()) { cin.clear(); newCommand = nullString; iExit=false; break; }
|
||||
newCommand.readLine( G4cin, FALSE );
|
||||
if (!G4cin.good()) { G4cin.clear(); newCommand = nullString; iExit=false; break; }
|
||||
newCommand = newCommand.strip(G4String::leading);
|
||||
if( newCommand.length() < 1 ) { break; }
|
||||
|
||||
@@ -127,8 +123,8 @@ G4String G4UIterminal::GetCommand()
|
||||
{
|
||||
G4String newLine;
|
||||
newCommand.remove(newCommand.length()-1);
|
||||
newLine.readLine( cin );
|
||||
if (!cin.good()) { cin.clear(); newCommand = nullString; iExit=false; break; }
|
||||
newLine.readLine( G4cin );
|
||||
if (!G4cin.good()) { G4cin.clear(); newCommand = nullString; iExit=false; break; }
|
||||
newCommand.append(newLine);
|
||||
}
|
||||
|
||||
@@ -138,13 +134,13 @@ G4String G4UIterminal::GetCommand()
|
||||
// -------------------- nC.toUpper();
|
||||
if( nC.length() < 1 ){ break; }
|
||||
if( nC(0) == '#' )
|
||||
{ G4cout << nC << endl; }
|
||||
{ G4cout << nC << G4endl; }
|
||||
else if( nC == "ls" || nC(0,3) == "ls " )
|
||||
{ ListDirectory( nC ); }
|
||||
else if( nC == "pwd" )
|
||||
{
|
||||
G4cout << "Current Working Directory : "
|
||||
<< GetCurrentWorkingDirectory() << endl;
|
||||
<< GetCurrentWorkingDirectory() << G4endl;
|
||||
}
|
||||
else if( nC == "cd" || nC(0,3) == "cd " )
|
||||
{ ChangeDirectoryCommand( nC ); }
|
||||
@@ -156,33 +152,33 @@ G4String G4UIterminal::GetCommand()
|
||||
{
|
||||
G4int nh = UI->GetNumberOfHistory();
|
||||
for(int i=0;i<nh;i++)
|
||||
{ G4cout << i << ": " << UI->GetPreviousCommand(i) << endl; }
|
||||
{ G4cout << i << ": " << UI->GetPreviousCommand(i) << G4endl; }
|
||||
}
|
||||
else if( nC(0) == '!' )
|
||||
{
|
||||
G4String ss = nC(1,nC.length()-1);
|
||||
G4int vl;
|
||||
const char* tt = ss;
|
||||
istrstream is((char*)tt);
|
||||
G4std::istrstream is((char*)tt);
|
||||
is >> vl;
|
||||
G4int nh = UI->GetNumberOfHistory();
|
||||
if(vl>=0 && vl<nh)
|
||||
{
|
||||
newCommand = UI->GetPreviousCommand(vl);
|
||||
G4cout << newCommand << endl;
|
||||
G4cout << newCommand << G4endl;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{ G4cerr << "history " << vl << " is not found." << endl; }
|
||||
{ G4cerr << "history " << vl << " is not found." << G4endl; }
|
||||
}
|
||||
else if( nC == "exit" )
|
||||
{
|
||||
if( iCont )
|
||||
{
|
||||
G4cout << "You are now processing RUN." << endl;
|
||||
G4cout << "Please abort it using \"/run/abort\" command first" << endl;
|
||||
G4cout << " and use \"continue\" command until the application" << endl;
|
||||
G4cout << " becomes to Idle." << endl;
|
||||
G4cout << "You are now processing RUN." << G4endl;
|
||||
G4cout << "Please abort it using \"/run/abort\" command first" << G4endl;
|
||||
G4cout << " and use \"continue\" command until the application" << G4endl;
|
||||
G4cout << " becomes to Idle." << G4endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -204,18 +200,18 @@ G4String G4UIterminal::GetCommand()
|
||||
}
|
||||
|
||||
G4bool G4UIterminal::GetHelpChoice(G4int& aInt){
|
||||
cin >> aInt;
|
||||
if(!cin.good()){
|
||||
cin.clear();
|
||||
cin.ignore(30,'\n');
|
||||
G4cin >> aInt;
|
||||
if(!G4cin.good()){
|
||||
G4cin.clear();
|
||||
G4cin.ignore(30,'\n');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void G4UIterminal::ExitHelp(){
|
||||
// cin.flush();
|
||||
// G4cin.flush();
|
||||
char temp[100];
|
||||
cin.getline( temp, 100 );
|
||||
G4cin.getline( temp, 100 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user