Import Geant4 1.0.0 source tree
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
// 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.
|
||||
//
|
||||
|
||||
#include <rw/ctoken.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
@@ -14,6 +15,9 @@
|
||||
|
||||
#include "G4InteractorMessenger.hh"
|
||||
|
||||
#define STRDUP(str) ((str) != NULL ? (strcpy((char*)malloc((unsigned)strlen(str) + 1), str)) : (char*)NULL)
|
||||
#define STRDEL(str) {if((str)!=NULL) {free(str);str=NULL;}}
|
||||
|
||||
static G4bool GetValues (G4String,int,G4String*);
|
||||
|
||||
G4InteractorMessenger::G4InteractorMessenger (
|
||||
@@ -81,27 +85,36 @@ G4bool GetValues (
|
||||
,G4String* params
|
||||
)
|
||||
{
|
||||
RWCTokenizer newValueToken( newValue );
|
||||
G4String aToken;
|
||||
char* value = STRDUP(newValue.data());
|
||||
if(value==NULL) return false;
|
||||
char* tok = strtok(value," ");
|
||||
for( int i=0; i<paramn;i++ ) {
|
||||
aToken = (G4String)newValueToken();
|
||||
if( aToken(0)=='"' ) {
|
||||
while( aToken(aToken.length()-1) != '"' ) {
|
||||
G4String additionalToken = (G4String)newValueToken();
|
||||
if( additionalToken.isNull() ) {
|
||||
if(tok==NULL) {
|
||||
STRDEL(value);
|
||||
return false;
|
||||
}
|
||||
G4String token = tok;
|
||||
if( token(0)=='"' ) {
|
||||
while( token(token.length()-1) != '"' ) {
|
||||
tok = strtok(NULL," ");
|
||||
if( (tok==NULL) || (*tok=='\0')) {
|
||||
STRDEL(value);
|
||||
return false;
|
||||
}
|
||||
aToken += " ";
|
||||
aToken += additionalToken;
|
||||
token += " ";
|
||||
token += tok;
|
||||
}
|
||||
aToken = (G4String)aToken.strip(G4String::both,'"');
|
||||
token = (G4String)token.strip(G4String::both,'"');
|
||||
}
|
||||
if( aToken.isNull() ) {
|
||||
if( token.isNull() ) {
|
||||
STRDEL(value);
|
||||
return false;
|
||||
} else {
|
||||
params[i] = aToken;
|
||||
params[i] = token;
|
||||
}
|
||||
tok = strtok(NULL," ");
|
||||
}
|
||||
STRDEL(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
// 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: G4VBasicShell.cc,v 1.4 1999/05/19 17:40:56 stesting Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4VBasicShell.cc,v 1.5.4.1 1999/12/07 20:49:10 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
|
||||
#include "g4std/vector"
|
||||
|
||||
#include "G4VBasicShell.hh"
|
||||
#include "G4StateManager.hh"
|
||||
#include "G4UIcommandTree.hh"
|
||||
@@ -37,7 +39,7 @@ G4String G4VBasicShell::ModifyToFullPathCommand(const char* aCommandLine)
|
||||
G4String commandString;
|
||||
G4String parameterString;
|
||||
int i = commandLine.index(" ");
|
||||
if( i != RW_NPOS )
|
||||
if( i != G4std::string::npos )
|
||||
{
|
||||
commandString = (G4String)commandLine(0,i);
|
||||
parameterString = " ";
|
||||
@@ -97,7 +99,7 @@ G4UIcommand* G4VBasicShell::FindCommand(const char* commandName)
|
||||
G4String commandLine = (G4String)rawCommandLine.strip(G4String::both);
|
||||
G4String commandString;
|
||||
int i = commandLine.index(" ");
|
||||
if( i != RW_NPOS )
|
||||
if( i != G4std::string::npos )
|
||||
{ commandString = (G4String)commandLine(0,i); }
|
||||
else
|
||||
{ commandString = commandLine; }
|
||||
@@ -154,7 +156,7 @@ G4String G4VBasicShell::Complete(G4String commandName)
|
||||
G4String rawCommandLine = commandName;
|
||||
G4String commandLine = rawCommandLine.strip(G4String::both);
|
||||
int i = commandLine.index(" ");
|
||||
if( i != RW_NPOS ) return rawCommandLine; // Already entering parameters,
|
||||
if( i != G4std::string::npos ) return rawCommandLine; // Already entering parameters,
|
||||
// assume command path is correct.
|
||||
G4String commandString = commandLine;
|
||||
G4String targetCom = ModifyPath(commandString);
|
||||
@@ -172,21 +174,21 @@ G4String G4VBasicShell::FindMatchingPath(
|
||||
G4String empty = "";
|
||||
if(aTree==NULL) return empty;
|
||||
G4String pathName = aTree->GetPathName();
|
||||
if( aCommandPath.index( pathName ) == RW_NPOS ) return empty;
|
||||
if( aCommandPath.index( pathName ) == G4std::string::npos ) return empty;
|
||||
G4String remainingPath = aCommandPath;
|
||||
remainingPath.remove(0,pathName.length());
|
||||
int i = remainingPath.first('/');
|
||||
if( i == RW_NPOS ) {
|
||||
if( i == G4std::string::npos ) {
|
||||
// Look for number of matching commands :
|
||||
RWTPtrOrderedVector<G4UIcommand> commands;
|
||||
G4std::vector<G4UIcommand*> commands;
|
||||
int n_commandEntry = aTree->GetCommandEntry();
|
||||
for( int i_thCommand = 1; i_thCommand <= n_commandEntry; i_thCommand++ ) {
|
||||
G4UIcommand* cmd = aTree->GetCommand(i_thCommand);
|
||||
G4String ss = cmd->GetCommandName();
|
||||
ss.resize(remainingPath.length());
|
||||
if( remainingPath == ss ) commands.insert(cmd);
|
||||
if( remainingPath == ss ) commands.push_back(cmd);
|
||||
}
|
||||
n_commandEntry = commands.entries();
|
||||
n_commandEntry = commands.size();
|
||||
if(n_commandEntry==1) {
|
||||
return (pathName + commands[0]->GetCommandName());
|
||||
} else if (n_commandEntry>=2) {
|
||||
@@ -198,7 +200,7 @@ G4String G4VBasicShell::FindMatchingPath(
|
||||
return empty;
|
||||
}
|
||||
// Look for sub tree :
|
||||
RWTPtrOrderedVector<G4UIcommandTree> trees;
|
||||
G4std::vector<G4UIcommandTree*> trees;
|
||||
G4String nextPath = pathName;
|
||||
nextPath.append(remainingPath);
|
||||
int n_treeEntry = aTree->GetTreeEntry();
|
||||
@@ -206,9 +208,9 @@ G4String G4VBasicShell::FindMatchingPath(
|
||||
G4UIcommandTree* tree = aTree->GetTree(i_thTree);
|
||||
G4String ss = tree->GetPathName();
|
||||
ss.resize(nextPath.length());
|
||||
if( nextPath == ss ) trees.insert(tree);
|
||||
if( nextPath == ss ) trees.push_back(tree);
|
||||
}
|
||||
n_treeEntry = trees.entries();
|
||||
n_treeEntry = trees.size();
|
||||
if(n_treeEntry==1) {
|
||||
return trees[0]->GetPathName();
|
||||
} else if (n_treeEntry>=2) {
|
||||
@@ -394,7 +396,7 @@ void G4VBasicShell::TerminalHelp(G4String newCommand)
|
||||
if(UI==NULL) return;
|
||||
G4UIcommandTree * treeTop = UI->GetTree();
|
||||
int i = newCommand.index(" ");
|
||||
if( i != RW_NPOS )
|
||||
if( i != G4std::string::npos )
|
||||
{
|
||||
G4String newValue = newCommand(i+1,newCommand.length()-(i+1));
|
||||
newValue.strip(G4String::both);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 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,
|
||||
@@ -10,13 +10,9 @@
|
||||
|
||||
#include "G4VInteractiveSession.hh"
|
||||
|
||||
static unsigned InteractorsHashFun (const G4String& name) {
|
||||
return name.hash();
|
||||
}
|
||||
/***************************************************************************/
|
||||
G4VInteractiveSession::G4VInteractiveSession (
|
||||
)
|
||||
:interactors(InteractorsHashFun)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
@@ -65,9 +61,9 @@ G4Interactor G4VInteractiveSession::GetInteractor (
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
G4Interactor value;
|
||||
if(interactors.findValue(a_name,value)==false) return NULL;
|
||||
return value;
|
||||
G4interactor_map::iterator it;
|
||||
if((it=interactors.find(a_name))==interactors.end()) return NULL;
|
||||
return (*it).second;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
// 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: G4VInteractorManager.cc,v 1.5 1999/05/31 20:47:42 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4VInteractorManager.cc,v 1.7.4.1 1999/12/07 20:49:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
// G.Barrand
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "g4std/algorithm"
|
||||
|
||||
#include "G4VInteractorManager.hh"
|
||||
|
||||
#define NewString(str) \
|
||||
@@ -135,8 +137,8 @@ void G4VInteractorManager::AddDispatcher (
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
if(a_dispatcher==NULL) return;
|
||||
if(dispatchers.contains(a_dispatcher)==TRUE) return;
|
||||
dispatchers.insert(a_dispatcher);
|
||||
if(G4std::find(dispatchers.begin(),dispatchers.end(),a_dispatcher)!=dispatchers.end()) return;
|
||||
dispatchers.push_back(a_dispatcher);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4VInteractorManager::RemoveDispatcher (
|
||||
@@ -145,7 +147,7 @@ void G4VInteractorManager::RemoveDispatcher (
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
dispatchers.removeAll(a_dispatcher);
|
||||
G4std::remove(dispatchers.begin(),dispatchers.end(),a_dispatcher);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4VInteractorManager::DispatchEvent (
|
||||
@@ -154,7 +156,7 @@ void G4VInteractorManager::DispatchEvent (
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
int dispatchern = dispatchers.entries();
|
||||
int dispatchern = dispatchers.size();
|
||||
G4DispatchFunction func;
|
||||
G4bool status;
|
||||
for(int count=0;count<dispatchern;count++) {
|
||||
@@ -172,8 +174,8 @@ void G4VInteractorManager::AddSecondaryLoopPreAction (
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
if(a_preAction==NULL) return;
|
||||
if(preActions.contains(a_preAction)==TRUE) return;
|
||||
preActions.insert(a_preAction);
|
||||
if(G4std::find(preActions.begin(),preActions.end(),a_preAction)!=preActions.end()) return;
|
||||
preActions.push_back(a_preAction);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4VInteractorManager::SecondaryLoopPreActions (
|
||||
@@ -181,7 +183,7 @@ void G4VInteractorManager::SecondaryLoopPreActions (
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
int preActionn = preActions.entries();
|
||||
int preActionn = preActions.size();
|
||||
for(int count=0;count<preActionn;count++) {
|
||||
if(preActions[count]!=NULL) preActions[count]();
|
||||
}
|
||||
@@ -194,8 +196,8 @@ void G4VInteractorManager::AddSecondaryLoopPostAction (
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
if(a_postAction==NULL) return;
|
||||
if(postActions.contains(a_postAction)==TRUE) return;
|
||||
postActions.insert(a_postAction);
|
||||
if(G4std::find(postActions.begin(),postActions.end(),a_postAction)!=postActions.end()) return;
|
||||
postActions.push_back(a_postAction);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4VInteractorManager::SecondaryLoopPostActions (
|
||||
@@ -203,7 +205,7 @@ void G4VInteractorManager::SecondaryLoopPostActions (
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
int postActionn = postActions.entries();
|
||||
int postActionn = postActions.size();
|
||||
for(int count=0;count<postActionn;count++) {
|
||||
if(postActions[count]!=NULL) postActions[count]();
|
||||
}
|
||||
@@ -266,8 +268,8 @@ void G4VInteractorManager::AddShell (
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
if(a_shell==NULL) return;
|
||||
if(shells.contains(a_shell)==TRUE) return;
|
||||
shells.insert(a_shell);
|
||||
if(G4std::find(shells.begin(),shells.end(),a_shell)!=shells.end()) return;
|
||||
shells.push_back(a_shell);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4VInteractorManager::RemoveShell (
|
||||
@@ -275,8 +277,8 @@ void G4VInteractorManager::RemoveShell (
|
||||
)
|
||||
/***************************************************************************/
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
shells.removeAll(a_shell);
|
||||
{
|
||||
G4std::remove(shells.begin(),shells.end(),a_shell);
|
||||
}
|
||||
/***************************************************************************/
|
||||
void G4VInteractorManager::SetParentInteractor (
|
||||
|
||||
@@ -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: G4Win32.cc,v 1.4 1999/05/11 12:34:38 barrand Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4Win32.cc,v 1.4.8.1 1999/12/07 20:49:11 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: G4Xt.cc,v 1.2 1999/04/13 01:26:33 yhajime Exp $
|
||||
// GEANT4 tag $Name: geant4-00-01 $
|
||||
// $Id: G4Xt.cc,v 1.4.6.1 1999/12/07 20:49:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
//
|
||||
// G.Barrand
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <X11/Shell.h>
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "G4Xt.hh"
|
||||
@@ -30,6 +34,7 @@ G4Xt* G4Xt::instance = NULL;
|
||||
static G4bool XtInited = FALSE;
|
||||
static int argn = 0;
|
||||
static char** args = NULL;
|
||||
static XtAppContext appContext = NULL;
|
||||
static Widget topWidget = NULL;
|
||||
/***************************************************************************/
|
||||
G4Xt* G4Xt::getInstance (
|
||||
@@ -79,11 +84,12 @@ G4Xt::G4Xt (
|
||||
int argc;
|
||||
argc = a_argn;
|
||||
#endif
|
||||
XtAppContext appContext;
|
||||
Arg xargs[1];
|
||||
XtSetArg (xargs[0],XtNgeometry,"100x100");
|
||||
topWidget = XtAppInitialize (&appContext,a_class,
|
||||
NULL,(Cardinal)0,
|
||||
&argc,a_args,NULL,
|
||||
NULL,(Cardinal)0);
|
||||
xargs,1);
|
||||
if(topWidget==NULL) {
|
||||
G4cout << "G4Xt : Unable to init Xt." << endl;
|
||||
}
|
||||
@@ -130,8 +136,8 @@ void* G4Xt::GetEvent (
|
||||
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
{
|
||||
static XEvent event;
|
||||
if(appContext==NULL) return NULL;
|
||||
if(topWidget==NULL) return NULL;
|
||||
XtAppContext appContext = XtWidgetToApplicationContext(topWidget);
|
||||
XtAppNextEvent (appContext, &event);
|
||||
return &event;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user