Import Geant4 1.0.0 source tree
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIWin32.cc,v 1.4 1999/05/06 15:21:00 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4UIWin32.cc,v 1.5.4.1 1999/12/07 20:49:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
// G.Barrand
|
||||
|
||||
@@ -131,9 +131,6 @@ static G4bool ConvertStringToInt(const char*,int&);
|
||||
|
||||
static int actionIdentifier = 0;
|
||||
|
||||
static unsigned CommandsHashFun(const int& identifier) {
|
||||
return (unsigned)identifier;
|
||||
}
|
||||
/***************************************************************************/
|
||||
G4UIWin32::G4UIWin32 (
|
||||
HINSTANCE a_hInstance
|
||||
@@ -145,7 +142,6 @@ G4UIWin32::G4UIWin32 (
|
||||
,textWindow(NULL)
|
||||
,editWindow(NULL)
|
||||
,menuBar(NULL)
|
||||
,commands(CommandsHashFun)
|
||||
,textBuffer(NULL)
|
||||
,textCols(80)
|
||||
,textRows(12)
|
||||
@@ -575,7 +571,7 @@ LRESULT CALLBACK G4UIWin32::EditWindowProc (
|
||||
exitHelp = true;
|
||||
This->fHelp = ConvertStringToInt(command.data(),This->fHelpChoice);
|
||||
} else {
|
||||
This->fHistory.insert(command);
|
||||
This->fHistory.push_back(command);
|
||||
This->fHistoryPos = -1;
|
||||
This->ApplyShellCommand (command,exitSession,exitPause);
|
||||
}
|
||||
@@ -605,8 +601,8 @@ LRESULT CALLBACK G4UIWin32::EditWindowProc (
|
||||
GetParent(a_window),GWL_USERDATA);
|
||||
if(This!=NULL) {
|
||||
int pos = This->fHistoryPos== -1 ?
|
||||
This->fHistory.entries()-1 : This->fHistoryPos-1;
|
||||
if((pos>=0)&&(pos<This->fHistory.entries())) {
|
||||
This->fHistory.size()-1 : This->fHistoryPos-1;
|
||||
if((pos>=0)&&(pos<This->fHistory.size())) {
|
||||
G4String command = This->fHistory[pos];
|
||||
const char* d = command.data();
|
||||
int l = strlen(d);
|
||||
@@ -622,7 +618,7 @@ LRESULT CALLBACK G4UIWin32::EditWindowProc (
|
||||
GetParent(a_window),GWL_USERDATA);
|
||||
if(This!=NULL) {
|
||||
int pos = This->fHistoryPos + 1;
|
||||
if((pos>=0)&&(pos<This->fHistory.entries())) {
|
||||
if((pos>=0)&&(pos<This->fHistory.size())) {
|
||||
G4String command = This->fHistory[pos];
|
||||
const char* d = command.data();
|
||||
int l = strlen(d);
|
||||
@@ -630,7 +626,7 @@ LRESULT CALLBACK G4UIWin32::EditWindowProc (
|
||||
Edit_SetSel(a_window,l,l);
|
||||
//
|
||||
This->fHistoryPos = pos;
|
||||
} else if(pos>=This->fHistory.entries()) {
|
||||
} else if(pos>=This->fHistory.size()) {
|
||||
Edit_SetText(a_window,"");
|
||||
Edit_SetSel(a_window,0,0);
|
||||
//
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIXaw.cc,v 1.2 1999/04/13 01:26:27 yhajime Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4UIXaw.cc,v 1.2.8.1 1999/12/07 20:49:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
// G.Barrand
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIXm.cc,v 1.4 1999/05/11 13:26:31 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4UIXm.cc,v 1.5.4.1 1999/12/07 20:49:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
// G.Barrand
|
||||
|
||||
@@ -52,10 +52,6 @@ static void ExecuteChangeSizeFunction(Widget);
|
||||
static G4bool exitSession = true;
|
||||
static G4bool exitPause = true;
|
||||
static G4bool exitHelp = true;
|
||||
static unsigned CommandsHashFun (const Widget& interactor) {
|
||||
// Is it correct to return a pointer ?
|
||||
return (unsigned)(unsigned long)interactor;
|
||||
}
|
||||
/***************************************************************************/
|
||||
G4UIXm::G4UIXm (
|
||||
int argc
|
||||
@@ -65,7 +61,6 @@ G4UIXm::G4UIXm (
|
||||
,command(NULL)
|
||||
,menuBar(NULL)
|
||||
,text(NULL)
|
||||
,commands(CommandsHashFun)
|
||||
,fHelp(false)
|
||||
,fHelpChoice(0)
|
||||
/***************************************************************************/
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// This code implementation is the intellectual property of
|
||||
// the RD44 GEANT4 collaboration.
|
||||
// the GEANT4 collaboration.
|
||||
//
|
||||
// By copying, distributing or modifying the Program (or any work
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4UIterminal.cc,v 1.2 1999/04/13 01:26:28 yhajime Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4UIterminal.cc,v 1.4.4.1.2.1 1999/12/07 20:49:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#include "G4UIterminal.hh"
|
||||
@@ -86,7 +86,9 @@ G4int G4UIterminal::ReceiveG4cerr(G4String cerrString)
|
||||
|
||||
void G4UIterminal::ExecuteCommand(G4String aCommand)
|
||||
{
|
||||
|
||||
if(aCommand.length()<2) return;
|
||||
|
||||
int commandStatus = UI->ApplyCommand(aCommand);
|
||||
switch(commandStatus)
|
||||
{
|
||||
@@ -94,7 +96,7 @@ void G4UIterminal::ExecuteCommand(G4String aCommand)
|
||||
break;
|
||||
case fCommandNotFound:
|
||||
G4cerr << "command <" << aCommand << "> not found" << endl;
|
||||
if ( aCommand.index("@@") != RW_NPOS) {
|
||||
if ( aCommand.index("@@") != G4std::string::npos) {
|
||||
G4cout << "@@G4UIterminal" << endl;
|
||||
}
|
||||
break;
|
||||
@@ -116,8 +118,11 @@ G4String G4UIterminal::GetCommand()
|
||||
{
|
||||
G4cout << promptCharacter;
|
||||
G4cout.flush();
|
||||
newCommand.readLine( cin );
|
||||
newCommand.readLine( cin, FALSE );
|
||||
if (!cin.good()) { cin.clear(); newCommand = nullString; iExit=false; break; }
|
||||
newCommand = newCommand.strip(G4String::leading);
|
||||
if( newCommand.length() < 1 ) { break; }
|
||||
|
||||
while( newCommand(newCommand.length()-1) == '_' )
|
||||
{
|
||||
G4String newLine;
|
||||
@@ -128,72 +133,76 @@ G4String G4UIterminal::GetCommand()
|
||||
}
|
||||
|
||||
G4String nC = newCommand.strip(G4String::leading);
|
||||
|
||||
|
||||
// -------------------- nC.toUpper();
|
||||
if( nC.length() < 1 ){ break; }
|
||||
if( nC(0) == '#' )
|
||||
{ G4cout << nC << endl; }
|
||||
{ G4cout << nC << endl; }
|
||||
else if( nC == "ls" || nC(0,3) == "ls " )
|
||||
{ ListDirectory( nC ); }
|
||||
{ ListDirectory( nC ); }
|
||||
else if( nC == "pwd" )
|
||||
{
|
||||
G4cout << "Current Working Directory : "
|
||||
<< GetCurrentWorkingDirectory() << endl;
|
||||
}
|
||||
{
|
||||
G4cout << "Current Working Directory : "
|
||||
<< GetCurrentWorkingDirectory() << endl;
|
||||
}
|
||||
else if( nC == "cd" || nC(0,3) == "cd " )
|
||||
{ ChangeDirectoryCommand( nC ); }
|
||||
{ ChangeDirectoryCommand( nC ); }
|
||||
else if( nC == "help" || nC(0,5) == "help " )
|
||||
{ TerminalHelp( nC ); }
|
||||
{ TerminalHelp( nC ); }
|
||||
else if( nC(0) == '?' )
|
||||
{ ShowCurrent( nC ); }
|
||||
{ ShowCurrent( nC ); }
|
||||
else if( nC == "hist" || nC == "history" )
|
||||
{
|
||||
G4int nh = UI->GetNumberOfHistory();
|
||||
for(int i=0;i<nh;i++)
|
||||
{ G4cout << i << ": " << UI->GetPreviousCommand(i) << endl; }
|
||||
}
|
||||
{
|
||||
G4int nh = UI->GetNumberOfHistory();
|
||||
for(int i=0;i<nh;i++)
|
||||
{ G4cout << i << ": " << UI->GetPreviousCommand(i) << endl; }
|
||||
}
|
||||
else if( nC(0) == '!' )
|
||||
{
|
||||
G4String ss = nC(1,nC.length()-1);
|
||||
G4int vl;
|
||||
const char* tt = ss;
|
||||
istrstream is((char*)tt);
|
||||
is >> vl;
|
||||
G4int nh = UI->GetNumberOfHistory();
|
||||
if(vl>=0 && vl<nh)
|
||||
{
|
||||
newCommand = UI->GetPreviousCommand(vl);
|
||||
G4cout << newCommand << endl;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{ G4cerr << "history " << vl << " is not found." << endl; }
|
||||
}
|
||||
{
|
||||
G4String ss = nC(1,nC.length()-1);
|
||||
G4int vl;
|
||||
const char* tt = ss;
|
||||
istrstream is((char*)tt);
|
||||
is >> vl;
|
||||
G4int nh = UI->GetNumberOfHistory();
|
||||
if(vl>=0 && vl<nh)
|
||||
{
|
||||
newCommand = UI->GetPreviousCommand(vl);
|
||||
G4cout << newCommand << endl;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{ G4cerr << "history " << vl << " is not found." << endl; }
|
||||
}
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
iExit = false;
|
||||
newCommand = nullString;
|
||||
break;
|
||||
}
|
||||
}
|
||||
{
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
iExit = false;
|
||||
newCommand = nullString;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( nC == "cont" || nC == "continue" )
|
||||
{
|
||||
iCont = false;
|
||||
newCommand = nullString;
|
||||
break;
|
||||
}
|
||||
{
|
||||
iCont = false;
|
||||
newCommand = nullString;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{ break; }
|
||||
{ break; }
|
||||
}
|
||||
return ModifyToFullPathCommand(newCommand);
|
||||
}
|
||||
|
||||
G4bool G4UIterminal::GetHelpChoice(G4int& aInt){
|
||||
cin >> aInt;
|
||||
if(!cin.good()){
|
||||
|
||||
Reference in New Issue
Block a user