Import Geant4 9.1.0 source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
$Id: History,v 1.67 2006/11/14 08:35:40 gcosmo Exp $
|
||||
$Id: History,v 1.70 2007/08/10 09:47:43 kmura Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,6 +17,20 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
August 10, 2007 K.Murakami (intercoms-V09-00-01)
|
||||
- G4UIbatch.cc : fixed the problem on 32bit-Linux.
|
||||
|
||||
July 16, 2007 K.Murakami (intercoms-V09-00-00)
|
||||
- G4UImanager.cc : a bug fixed. (invalid returned object)
|
||||
- G4UIbatch.cc : completely revised.
|
||||
* bug fixed for the treatment of the last line
|
||||
* add support for continued line by \, _
|
||||
* string after '#' is treated as comment
|
||||
* white spaces at the head of a line are allowed.
|
||||
|
||||
June 6, 2007, M.Asai
|
||||
- Introducing /control/getEnv and /control/echo commands.
|
||||
|
||||
November 3, 2006, M.Verderi (intercoms-V08-01-01)
|
||||
- Added missing forward declaration of G4VPhysicalVolume in
|
||||
G4VFlavoredParallelWorld header.
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIaliasList.hh,v 1.6 2006/06/29 19:07:42 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
|
||||
#ifndef G4UIaliasList_h
|
||||
|
||||
@@ -23,56 +23,55 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4UIbatch.hh,v 1.10 2007/07/16 10:15:12 kmura Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// $Id: G4UIbatch.hh,v 1.9 2006/06/29 19:07:44 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// ====================================================================
|
||||
// G4UIbatch.hh
|
||||
//
|
||||
// $id$
|
||||
// This is a concrete class of G4UIsession.
|
||||
//
|
||||
// This class object is instantiated by G4UImanager at every time
|
||||
// when "/control/execute macro_file" command is executed.
|
||||
// Also in the case of pure batch mode with a macro file,
|
||||
// this class can be used as other ordinary G4UIsession
|
||||
// concrete classes, i.e. SessionStart() is invoked in main().
|
||||
// ====================================================================
|
||||
#ifndef G4UI_BATCH_H
|
||||
#define G4UI_BATCH_H 1
|
||||
|
||||
#ifndef G4UIbatch_h
|
||||
#define G4UIbatch_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4UIsession.hh"
|
||||
#include <fstream>
|
||||
|
||||
class G4UImanager;
|
||||
// ====================================================================
|
||||
//
|
||||
// class definition
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
// class description
|
||||
// This is a concrete class of G4UIsession.
|
||||
// This class is constructed by G4UImanager when the user
|
||||
// applies "/control/execute macro_file" command.
|
||||
// If the user's application runs in pure batch mode with
|
||||
// only one fixed-name macro file, he/she can construct this
|
||||
// class object with giving the file name and use it as other
|
||||
// ordinary G4UIsession concrete class, i.e. invoke SessionStart()
|
||||
// from his/her main().
|
||||
class G4UIbatch : public G4UIsession {
|
||||
private:
|
||||
G4UIsession* previousSession;
|
||||
|
||||
class G4UIbatch : public G4UIsession
|
||||
{
|
||||
public: // with description
|
||||
G4UIbatch(const char* fileName,G4UIsession* prevSession=NULL);
|
||||
// Constructor.
|
||||
// "prevSession" must be NULL if this class is constructed
|
||||
// from main().
|
||||
public:
|
||||
~G4UIbatch();
|
||||
std::ifstream macroStream;
|
||||
G4bool isOpened;
|
||||
|
||||
G4UIsession * SessionStart();
|
||||
void PauseSessionStart(G4String Prompt);
|
||||
//static G4bool commandFailed;
|
||||
|
||||
// get command from a batch script file
|
||||
G4String ReadCommand();
|
||||
G4int ExecCommand(const G4String& command);
|
||||
|
||||
public:
|
||||
G4UIbatch(const char* fileName, G4UIsession* prevSession=0);
|
||||
// "prevSession" must be 0 if this class is constructed
|
||||
// from main().
|
||||
|
||||
~G4UIbatch();
|
||||
|
||||
private:
|
||||
G4UImanager * UImanager;
|
||||
G4UIsession * previousSession;
|
||||
std::ifstream macroFile;
|
||||
G4String macroFileName;
|
||||
G4bool openFailed;
|
||||
virtual G4UIsession* SessionStart();
|
||||
virtual void PauseSessionStart(G4String Prompt);
|
||||
|
||||
private:
|
||||
static G4bool commandFailed;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcmdWith3Vector.hh,v 1.7 2006/06/29 19:07:47 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcmdWith3VectorAndUnit.hh,v 1.8 2006/06/29 19:07:49 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcmdWithABool.hh,v 1.7 2006/06/29 19:07:51 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcmdWithADouble.hh,v 1.7 2006/06/29 19:07:54 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcmdWithADoubleAndUnit.hh,v 1.8 2006/06/29 19:07:57 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcmdWithAString.hh,v 1.5 2006/06/29 19:07:59 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcmdWithAnInteger.hh,v 1.7 2006/06/29 19:08:01 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcmdWithoutParameter.hh,v 1.5 2006/06/29 19:08:03 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcommand.hh,v 1.15 2006/06/29 19:08:05 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcommandStatus.hh,v 1.5 2006/06/29 19:08:08 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
|
||||
#ifndef G4UIcommandStatus_h
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcommandTree.hh,v 1.15 2006/06/29 19:08:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
|
||||
#ifndef G4UIcommandTree_h
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcontrolMessenger.hh,v 1.11 2006/06/29 19:08:13 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// $Id: G4UIcontrolMessenger.hh,v 1.12 2007/06/06 15:14:51 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
|
||||
#ifndef G4UIcontrolMessenger_h
|
||||
@@ -54,6 +54,8 @@ class G4UIcommand;
|
||||
// /control/alias
|
||||
// /control/unalias
|
||||
// /control/listAlias
|
||||
// /control/getEnv
|
||||
// /control/echo
|
||||
// /control/shell
|
||||
// /control/manual
|
||||
// /control/createHTML
|
||||
@@ -77,6 +79,8 @@ class G4UIcontrolMessenger : public G4UImessenger
|
||||
G4UIcommand * aliasCommand;
|
||||
G4UIcmdWithAString * unaliasCommand;
|
||||
G4UIcmdWithoutParameter * listAliasCommand;
|
||||
G4UIcmdWithAString * getEnvCmd;
|
||||
G4UIcmdWithAString * echoCmd;
|
||||
G4UIcmdWithAString * shellCommand;
|
||||
G4UIcommand * loopCommand;
|
||||
G4UIcommand * foreachCommand;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIdirectory.hh,v 1.5 2006/06/29 19:08:15 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UImanager.hh,v 1.21 2006/06/29 19:08:17 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
|
||||
#ifndef G4UImanager_h
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UImessenger.hh,v 1.9 2006/06/29 19:08:19 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
|
||||
#ifndef G4UImessenger_h
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIparameter.hh,v 1.9 2006/06/29 19:08:21 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIsession.hh,v 1.5 2006/06/29 19:08:23 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// $id$
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UItokenNum.hh,v 1.8 2006/06/29 19:08:25 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// G4UItokenNum.hh
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UnitsMessenger.hh,v 1.5 2006/06/29 19:08:27 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// class description
|
||||
//
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VFlavoredParallelWorld.hh,v 1.5 2006/11/03 17:44:40 mverderi Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// Abstract interface for GEANT4 Flavored Parallel World.
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VGlobalFastSimulationManager.hh,v 1.5 2006/06/29 19:08:31 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// Abstract interface for GEANT4 Global Fast Simulation Manager.
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIaliasList.cc,v 1.6 2006/06/29 19:08:33 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
|
||||
#include "G4UIaliasList.hh"
|
||||
|
||||
@@ -23,105 +23,208 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4UIbatch.cc,v 1.16 2007/08/10 09:46:10 kmura Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
// $Id: G4UIbatch.cc,v 1.14 2006/06/29 19:08:35 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// ====================================================================
|
||||
// G4UIbatch.cc
|
||||
//
|
||||
|
||||
// ====================================================================
|
||||
#include "G4UIbatch.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4ios.hh"
|
||||
#include <vector>
|
||||
|
||||
G4bool G4UIbatch::commandFailed = false;
|
||||
|
||||
G4UIbatch::G4UIbatch(const char* fileName,G4UIsession* prevSession)
|
||||
: previousSession(prevSession), macroFileName(fileName),
|
||||
openFailed(false)
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
static void Tokenize(const G4String& str, std::vector<G4String>& tokens)
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
UImanager = G4UImanager::GetUIpointer();
|
||||
UImanager->SetSession(this);
|
||||
macroFile.open((char*)fileName);
|
||||
if(macroFile.fail())
|
||||
{
|
||||
G4cerr << "macro file <" << fileName << "> could not open."
|
||||
<< G4endl;
|
||||
openFailed = true;
|
||||
commandFailed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
commandFailed = false;
|
||||
const char* delimiter= " ";
|
||||
|
||||
str_size pos0= str.find_first_not_of(delimiter);
|
||||
str_size pos = str.find_first_of(delimiter, pos0);
|
||||
|
||||
while (pos != G4String::npos || pos0 != G4String::npos) {
|
||||
tokens.push_back(str.substr(pos0, pos-pos0));
|
||||
|
||||
pos0 = str.find_first_not_of(delimiter, pos);
|
||||
pos = str.find_first_of(delimiter, pos0);
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// class description
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
G4UIbatch::G4UIbatch(const char* fileName, G4UIsession* prevSession)
|
||||
: previousSession(prevSession), isOpened(false)
|
||||
////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
macroStream.open(fileName, std::ios::in);
|
||||
if(macroStream.fail()) {
|
||||
G4cerr << "***** Can not open a macro file <"
|
||||
<< fileName << ">"
|
||||
<< G4endl;
|
||||
} else {
|
||||
isOpened= true;
|
||||
}
|
||||
|
||||
G4UImanager::GetUIpointer()-> SetSession(this);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////
|
||||
G4UIbatch::~G4UIbatch()
|
||||
///////////////////////
|
||||
{
|
||||
if(!openFailed) macroFile.close();
|
||||
if(isOpened) macroStream.close();
|
||||
}
|
||||
|
||||
G4UIsession * G4UIbatch::SessionStart()
|
||||
{
|
||||
if(!openFailed)
|
||||
{
|
||||
char commandLine[256];
|
||||
G4int lineLength = 255;
|
||||
|
||||
while(1)
|
||||
{
|
||||
macroFile.getline( commandLine, lineLength );
|
||||
if( macroFile.bad() )
|
||||
{
|
||||
G4cout << "Cannot read " << macroFileName << "." << G4endl;
|
||||
commandFailed = true;
|
||||
break;
|
||||
}
|
||||
if( macroFile.eof() ) break;
|
||||
commandLine[lineLength] = '\0';
|
||||
G4String commandString = commandLine;
|
||||
G4String nC= commandString.strip(G4String::both);
|
||||
if( commandLine[0] == '#')
|
||||
{ if(G4UImanager::GetUIpointer()->GetVerboseLevel()==2)
|
||||
{ G4cout << commandLine << G4endl; }
|
||||
}
|
||||
else if( nC.length() == 0 )
|
||||
{ continue; }
|
||||
else if(nC == "exit")
|
||||
{ break; }
|
||||
else
|
||||
{
|
||||
G4int rc = UImanager->ApplyCommand(commandLine);
|
||||
if(rc)
|
||||
{
|
||||
switch(rc)
|
||||
{
|
||||
case fCommandNotFound:
|
||||
G4cerr << "***** COMMAND NOT FOUND <"
|
||||
<< commandLine << "> *****" << G4endl;
|
||||
break;
|
||||
case fIllegalApplicationState:
|
||||
G4cerr << "***** Illegal application state <"
|
||||
<< commandLine << "> *****" << G4endl;
|
||||
break;
|
||||
default:
|
||||
G4int pn = rc%100;
|
||||
G4cerr << "***** Illegal parameter (" << pn << ") <"
|
||||
<< commandLine << "> *****" << G4endl;
|
||||
}
|
||||
G4cerr << "***** Command ignored *****" << G4endl;
|
||||
commandFailed = true;
|
||||
/////////////////////////////////
|
||||
G4String G4UIbatch::ReadCommand()
|
||||
/////////////////////////////////
|
||||
{
|
||||
enum { BUFSIZE= 4096 };
|
||||
static char linebuf[BUFSIZE];
|
||||
|
||||
G4String cmdtotal= "";
|
||||
G4bool qcontinued= false;
|
||||
while(macroStream.good()) {
|
||||
macroStream.getline(linebuf, BUFSIZE);
|
||||
|
||||
G4String cmdline(linebuf);
|
||||
|
||||
// TAB-> ' ' conversion
|
||||
str_size nb=0;
|
||||
while ((nb= cmdline.find('\t',nb)) != G4String::npos) {
|
||||
cmdline.replace(nb, 1, " ");
|
||||
}
|
||||
|
||||
// strip
|
||||
cmdline= cmdline.strip(G4String::both);
|
||||
|
||||
// skip null line if single line
|
||||
if(!qcontinued && cmdline.size()==0) continue;
|
||||
|
||||
// tokenize...
|
||||
std::vector<G4String> tokens;
|
||||
Tokenize(cmdline, tokens);
|
||||
qcontinued= false;
|
||||
for (G4int i=0; i< G4int(tokens.size()); i++) {
|
||||
// '\' or '_' is treated as continued line.
|
||||
if(tokens[i] == '\\' || tokens[i] == '_' ) {
|
||||
qcontinued= true;
|
||||
// check nothing after line continuation character
|
||||
if( i != G4int(tokens.size())-1) {
|
||||
G4Exception("unexpected character after "
|
||||
"line continuation character");
|
||||
}
|
||||
if(commandFailed) break;
|
||||
break; // stop parsing
|
||||
}
|
||||
cmdtotal+= tokens[i];
|
||||
cmdtotal+= " ";
|
||||
}
|
||||
|
||||
if(qcontinued) continue; // read` the next line
|
||||
|
||||
if(cmdtotal.size() != 0) break;
|
||||
if(macroStream.eof()) break;
|
||||
}
|
||||
|
||||
// strip again
|
||||
cmdtotal= cmdtotal.strip(G4String::both);
|
||||
|
||||
// '#' is treated as echoing something
|
||||
if(cmdtotal[(size_t)0]=='#') return cmdtotal;
|
||||
|
||||
// normally something after # is treated just as comment and ignored
|
||||
str_size ic= cmdtotal.find_first_of('#');
|
||||
if(ic != G4String::npos) {
|
||||
cmdtotal= cmdtotal(0, ic);
|
||||
}
|
||||
|
||||
// finally,
|
||||
if(macroStream.eof() && cmdtotal.size()==0) {
|
||||
return "exit";
|
||||
}
|
||||
|
||||
return cmdtotal;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
G4int G4UIbatch::ExecCommand(const G4String& command)
|
||||
/////////////////////////////////////////////////////
|
||||
{
|
||||
G4UImanager* UI= G4UImanager::GetUIpointer();
|
||||
G4int rc= UI-> ApplyCommand(command);
|
||||
|
||||
switch(rc) {
|
||||
case fCommandSucceeded:
|
||||
break;
|
||||
case fCommandNotFound:
|
||||
G4cerr << "***** COMMAND NOT FOUND <"
|
||||
<< command << "> *****" << G4endl;
|
||||
break;
|
||||
case fIllegalApplicationState:
|
||||
G4cerr << "***** Illegal application state <"
|
||||
<< command << "> *****" << G4endl;
|
||||
break;
|
||||
default:
|
||||
G4int pn= rc%100;
|
||||
G4cerr << "***** Illegal parameter (" << pn << ") <"
|
||||
<< command << "> *****" << G4endl;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
G4UIsession * G4UIbatch::SessionStart()
|
||||
///////////////////////////////////////
|
||||
{
|
||||
if(!isOpened) return previousSession;
|
||||
|
||||
while(1) {
|
||||
G4String newCommand = ReadCommand();
|
||||
|
||||
if(newCommand == "exit") {
|
||||
break;
|
||||
}
|
||||
|
||||
// just echo something
|
||||
if( newCommand[(size_t)0] == '#') {
|
||||
if(G4UImanager::GetUIpointer()-> GetVerboseLevel()==2) {
|
||||
G4cout << newCommand << G4endl;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// execute command
|
||||
G4int rc= ExecCommand(newCommand);
|
||||
if(rc != fCommandSucceeded) {
|
||||
G4cerr << G4endl << "***** Batch is interupted!! *****" << G4endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return previousSession;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
void G4UIbatch::PauseSessionStart(G4String Prompt)
|
||||
//////////////////////////////////////////////////
|
||||
{
|
||||
G4cout << "Pause session <" << Prompt << "> start." << G4endl;
|
||||
|
||||
SessionStart();
|
||||
|
||||
G4cout << "Pause session <" << Prompt << "> Terminate." << G4endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcmdWith3Vector.cc,v 1.8 2006/06/29 19:08:38 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcmdWith3VectorAndUnit.cc,v 1.9 2006/06/29 19:08:41 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcmdWithABool.cc,v 1.8 2006/06/29 19:08:43 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcmdWithADouble.cc,v 1.8 2006/06/29 19:08:45 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcmdWithADoubleAndUnit.cc,v 1.9 2006/06/29 19:08:48 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcmdWithAString.cc,v 1.6 2006/06/29 19:08:50 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcmdWithAnInteger.cc,v 1.8 2006/06/29 19:08:52 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcmdWithoutParameter.cc,v 1.4 2006/06/29 19:08:54 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcommand.cc,v 1.25 2006/06/29 19:08:56 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcommandTree.cc,v 1.13 2006/06/29 19:08:58 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
|
||||
#include "G4UIcommandTree.hh"
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UIcontrolMessenger.cc,v 1.10 2006/06/29 19:09:00 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// $Id: G4UIcontrolMessenger.cc,v 1.11 2007/06/06 15:14:51 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -126,6 +126,12 @@ G4UIcontrolMessenger::G4UIcontrolMessenger()
|
||||
listAliasCommand = new G4UIcmdWithoutParameter("/control/listAlias",this);
|
||||
listAliasCommand->SetGuidance("List aliases.");
|
||||
|
||||
getEnvCmd = new G4UIcmdWithAString("/control/getEnv",this);
|
||||
getEnvCmd->SetGuidance("Get a shell environment variable and define it as an alias.");
|
||||
|
||||
echoCmd = new G4UIcmdWithAString("/control/echo",this);
|
||||
echoCmd->SetGuidance("Display the aliased value.");
|
||||
|
||||
shellCommand = new G4UIcmdWithAString("/control/shell",this);
|
||||
shellCommand->SetGuidance("Execute a (Unix) SHELL command.");
|
||||
|
||||
@@ -158,6 +164,8 @@ G4UIcontrolMessenger::~G4UIcontrolMessenger()
|
||||
delete aliasCommand;
|
||||
delete unaliasCommand;
|
||||
delete listAliasCommand;
|
||||
delete getEnvCmd;
|
||||
delete echoCmd;
|
||||
delete shellCommand;
|
||||
delete loopCommand;
|
||||
delete foreachCommand;
|
||||
@@ -206,6 +214,21 @@ void G4UIcontrolMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
|
||||
{
|
||||
UI->ListAlias();
|
||||
}
|
||||
if(command==getEnvCmd)
|
||||
{
|
||||
if(getenv(newValue))
|
||||
{
|
||||
G4String st = "/control/alias ";
|
||||
st += newValue;
|
||||
st += " ";
|
||||
st += getenv(newValue);
|
||||
UI->ApplyCommand(st);
|
||||
}
|
||||
else
|
||||
{ G4cerr << "<" << newValue << "> is not defined as a shell variable. Command ignored." << G4endl; }
|
||||
}
|
||||
if(command==echoCmd)
|
||||
{ G4cout << UI->SolveAlias(newValue) << G4endl; }
|
||||
if(command==shellCommand)
|
||||
{
|
||||
system(newValue);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIdirectory.cc,v 1.4 2006/06/29 19:09:02 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4UImanager.cc,v 1.32 2006/10/17 16:32:49 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// $Id: G4UImanager.cc,v 1.33 2007/07/16 10:14:36 kmura Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
@@ -318,7 +318,8 @@ G4String G4UImanager::SolveAlias(const char* aCmd)
|
||||
for(G4int iz=0;iz<ia;iz++) G4cerr << " ";
|
||||
G4cerr << "^" << G4endl;
|
||||
G4cerr << "Unmatched alias parenthis -- command ignored" << G4endl;
|
||||
return fAliasNotFound;
|
||||
G4String nullStr;
|
||||
return nullStr;
|
||||
}
|
||||
G4String ps = aCommand(ia+1,aCommand.length()-(ia+1));
|
||||
G4int ic = ps.index("{");
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UImessenger.cc,v 1.7 2006/06/29 19:09:06 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIparameter.cc,v 1.14 2006/06/29 19:09:09 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
|
||||
#include "G4UIparameter.hh"
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UIsession.cc,v 1.7 2006/06/29 19:09:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UnitsMessenger.cc,v 1.7 2006/06/29 19:09:13 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VGlobalFastSimulationManager.cc,v 1.5 2006/06/29 19:09:15 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-00 $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
//
|
||||
//
|
||||
// Abstract interface for GEANT4 Global Fast Simulation Manager.
|
||||
|
||||
Reference in New Issue
Block a user