Import Geant4 1.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:28:20 +02:00
parent aaa409b6ee
commit ca1c8cb059
2995 changed files with 106830 additions and 299600 deletions
+32 -13
View File
@@ -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: G4UIGAG.hh,v 1.2 1999/04/13 01:26:18 yhajime Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4UIGAG.hh,v 1.3.4.1 1999/12/07 20:49:05 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// G4UIGAG.hh
// GAG(Geant4 adaptive GUI) interface class
@@ -21,24 +21,43 @@
#include "G4UIsession.hh"
#include "G4UImanager.hh"
#include <fstream.h>
#include <g4std/vector>
enum UImode { terminal_mode , java_mode, tcl_mode };
enum ChangeOfTree { notChanged=0, added, deleted, addedAndDeleted };
// class description:
//
// This class inherits the class G4UIsession.
// This is the class which is the front-end to GAG (Geant4 Adaptive GUI).
// Its usage is quite similar to G4UIterminal.
class G4UIGAG : public G4UIsession
{
public:
public: // with description
G4UIGAG();
~G4UIGAG();
G4UIsession * SessionStart();
// A GAG session "gagSession" is instantiated.
// G4cout stream is redirected by default to the constructed instance.
// Usage: G4UIsession * gagSession = new G4UIGAG;
// "gagSession" is started.
// Usage: gagSession->SessionStart();
// "gagSession" is deleted.
// Usage: delete gagSession;
//
void PauseSessionStart(G4String);
void Prompt(G4String);
G4String GetCommand();
G4int ReceiveG4cout(G4String);
G4int ReceiveG4cerr(G4String);
// These methods are implementation of the virtual methods of
// G4UIsession class.
//
void SessionTerminate();
void Prompt(G4String);
G4String GetCommand();
// These methods are not for users.
private:
G4String prefix;
G4UImanager * UI;
@@ -82,12 +101,12 @@ class G4UIGAG : public G4UIsession
void GetNewTreeStructure( G4UIcommandTree*,int recursiveLevel);
void GetNewTreeValues( G4UIcommandTree*,int recursiveLevel);
RWTValOrderedVector<G4String> previousTreeCommands;
RWTValOrderedVector<G4String> newTreeCommands;
RWTValOrderedVector<G4String> previousTreeParams;
RWTValOrderedVector<G4String> newTreeParams;
RWTValOrderedVector<G4UIcommand*> previousTreePCP;
RWTValOrderedVector<G4UIcommand*> newTreePCP;
G4std::vector<G4String> previousTreeCommands;
G4std::vector<G4String> newTreeCommands;
G4std::vector<G4String> previousTreeParams;
G4std::vector<G4String> newTreeParams;
G4std::vector<G4UIcommand*> previousTreePCP;
G4std::vector<G4UIcommand*> newTreePCP;
};
+23 -17
View File
@@ -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: G4UIGAG.cc,v 1.3 1999/04/15 17:41:44 johna Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4UIGAG.cc,v 1.6.2.1.2.1 1999/12/07 20:49:05 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// G4UIGAG.cc
// 18.Feb.98 M.Nagamatu and T.Kodama created G4UIGAG from G4UIterminal
@@ -174,8 +174,12 @@ G4String G4UIGAG::GetCommand()
}else{
G4cout << "@@Ready" << endl;
}
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;
@@ -186,6 +190,8 @@ G4String G4UIGAG::GetCommand()
}
G4String nC = newCommand.strip(G4String::leading);
if( nC.length() < 1) { break; }
// -------------------- nC.toUpper();
if( nC == "@@GAGmodeJAVA" ) {
uiMode = java_mode;
@@ -380,7 +386,7 @@ void G4UIGAG::TerminalHelp(G4String newCommand)
{
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);
@@ -796,12 +802,12 @@ void G4UIGAG::UpdateState(void)
int G4UIGAG::CommandUpdated(void)
{
int added=0, deleted=0;
int pEntry= previousTreeCommands.entries();
int nEntry= newTreeCommands.entries();
int pEntry= previousTreeCommands.size();
int nEntry= newTreeCommands.size();
int i,j;
for( i=0; i<pEntry; i++) { // check deleted command(s)
for( j=0; j<nEntry; j++) {
if( previousTreeCommands(i) == newTreeCommands(j)) break;
if( previousTreeCommands[i] == newTreeCommands[j]) break;
}
if( j==nEntry ) {
deleted = 1;
@@ -810,7 +816,7 @@ int G4UIGAG::CommandUpdated(void)
}
for( i=0; i<nEntry; i++) { // check added command(s)
for( j=0; j<pEntry; j++) {
if( newTreeCommands(i) == previousTreeCommands(j)) break;
if( newTreeCommands[i] == previousTreeCommands[j]) break;
}
if( j==pEntry ) {
added = 1;
@@ -836,7 +842,7 @@ void G4UIGAG::GetNewTreeStructure(G4UIcommandTree * tree, int level)
for(int com=0; com<commandEntry; com++){
commandPath = tree->GetCommand(com+1)->GetCommandPath();
title = tree->GetCommand(com+1)->GetTitle();
newTreeCommands.insert( commandPath + " " + title );
newTreeCommands.push_back( commandPath + " " + title );
}
if(treeEntry == 0) return; //end recursion
@@ -845,7 +851,7 @@ void G4UIGAG::GetNewTreeStructure(G4UIcommandTree * tree, int level)
t = tree->GetTree(i+1);
pathName = t->GetPathName();
title = t->GetTitle();
newTreeCommands.insert( pathName + " " + title );
newTreeCommands.push_back( pathName + " " + title );
GetNewTreeStructure(t, level+1);
}
}
@@ -855,14 +861,14 @@ void G4UIGAG::UpdateParamVal(void)
// call NotifyParameterUpdate() if the value of each
// command/parameter is updated.
// assuming the command structure is not changed.
int pEntry= previousTreeParams.entries();
int nEntry= newTreeParams.entries();
int pEntry= previousTreeParams.size();
int nEntry= newTreeParams.size();
int i;
G4UIcommand* Comp;
if (pEntry != nEntry) return;
for( i=0; i<nEntry; i++) {
if( previousTreeParams(i) != newTreeParams(i)){
Comp = newTreePCP(i);
if( previousTreeParams[i] != newTreeParams[i]){
Comp = newTreePCP[i];
G4cout << Comp->GetCommandPath()
<< " command is updated." <<endl;
NotifyParameterUpdate(Comp);
@@ -929,8 +935,8 @@ void G4UIGAG::GetNewTreeValues( G4UIcommandTree * tree, int level) // recursive
param += prp->GetParameterRange() +" ";
param += prp->GetParameterCandidates();
}
newTreeParams.insert( param + "\n");
newTreePCP.insert( Comp );
newTreeParams.push_back( param + "\n");
newTreePCP.push_back( Comp );
}
if( treeEntry == 0 ) return; // end recursion
for( int i=0; i< treeEntry; i++) {
+41 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.9 1999/05/31 20:48:28 barrand Exp $
$Id: History,v 1.20 1999/11/10 16:12:19 johna Exp $
-------------------------------------------------------------------
=========================================================
@@ -16,6 +16,46 @@ committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
10 Nov 1999 Hajime Yoshida (interfaces-V00-01-03)
- Added less<G4String> argument (Guy).
- G4UIWin32.hh, G4UIXm.hh : usage of G4std::less in G4std::map.
- G4VInteractorManager.cc : G4std::find, G4std::remove.
08 Nov 1999 Hajime Yoshida
- tag interfaces--V00-01-02 for STT
08 Nov 1999 Hajime Yoshida
- GAG/src/G4UIGAG.cc RWT => STL vector
- basic/include/G4UIterminal.hh, GAG/include/G4UIGAG.hh => documentation
02 Nov 1999 Guy Barrand
- doc comments for G4UIWin32.hh, G4UIXm.hh, G4UIXaw.hh, G4Xt.hh, G4Win32.hh, G4VInterativeSession.hh, G4VInteractorManager.hh.
02 Nov 1999 Guy Barrand
- basic/G4UIWin32, G4UIXm : RW -> STL.
- common/G4VBasicShell, G4VInteractiveSession, G4VInteractorManager : RW -> STL.
29 Oct. 1999 Hajime Yoshida
- tag interfaces-V00-01-01
27 Oct. 1999 Guy Barrand
- interfaces/common/src/G4Xt.cc : protect XtAppInit against
shell zero widthxheight. Give a default to geometry resource.
21 Oct. 1999 John Allison
- Made XtAppContext appContext static in G4Xt.cc. Speeds OGLSXm but
OGLIXm is still slow - why?
12 Oct. 1999 John Allison for Hajime Yoshida (tag interfaces-V00-01-00a)
- Protection for zero length strings for Sun in G4UIterminal and G4UIGAG.
02 Sep. 1999 Hajime Yoshida
to geant4-00-01-ref-01 (Revision 1.9)
a new tag is interfaces-01-00-04
after which a tag interfaces-V00-01-00 was added identical to
interfaces-01-00-04 except for this History file.
- G4UIterminal.cc and G4UIGAG.cc now shows prompt characters
to an input of return (or null command line).
head 31 Mai 1999 Guy Barrand
- G4VInteractorManager::SecondaryLoop : add a message to indicate
+3 -3
View File
@@ -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: G4UIWo.hh,v 1.2 1999/04/13 01:26:20 yhajime Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4UIWo.hh,v 1.2.8.1 1999/12/07 20:49:05 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#ifndef G4UIWo_h
#define G4UIWo_h
@@ -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: G4WoMessenger.hh,v 1.2 1999/04/13 01:26:20 yhajime Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4WoMessenger.hh,v 1.2.8.1 1999/12/07 20:49:05 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#ifndef G4WoMessenger_h
#define G4WoMessenger_h 1
+3 -3
View File
@@ -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: G4oCommon.hh,v 1.2 1999/04/13 01:26:21 yhajime Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4oCommon.hh,v 1.2.8.1 1999/12/07 20:49:06 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
/*
Included by G4o.h.
@@ -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: G4oCommon.icc,v 1.2 1999/04/13 01:26:21 yhajime Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4oCommon.icc,v 1.2.8.1 1999/12/07 20:49:06 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
/*
Included by G4o.cc.
+3 -3
View File
@@ -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: G4UIWo.cc,v 1.2 1999/04/13 01:26:22 yhajime Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4UIWo.cc,v 1.2.8.1 1999/12/07 20:49:06 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//G4UIWo.cc -- copied from G4UIterminal.cc
+3 -3
View File
@@ -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: G4WoMessenger.cc,v 1.2 1999/04/13 01:26:23 yhajime Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4WoMessenger.cc,v 1.2.8.1 1999/12/07 20:49:06 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#ifdef G4UI_BUILD_WO_SESSION
+3 -3
View File
@@ -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: G4UIxvt.hh,v 1.2 1999/04/13 01:24:58 yhajime Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4UIxvt.hh,v 1.2.8.1 1999/12/07 20:49:06 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
////////////////////////////////////////////////////////////////////////
// XVT driver class header //
@@ -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: G4UIxvtMessenger.hh,v 1.2 1999/04/13 01:25:01 yhajime Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4UIxvtMessenger.hh,v 1.2.8.1 1999/12/07 20:49:06 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
//////////////////////////////////////////////////////////////////////////////
// //
+3 -3
View File
@@ -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: G4UIxvt.cc,v 1.2 1999/04/13 01:25:02 yhajime Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4UIxvt.cc,v 1.2.8.1 1999/12/07 20:49:06 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#ifdef G4UI_BUILD_XVT_SESSION
@@ -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: G4UIxvtMessenger.cc,v 1.2 1999/04/13 01:25:03 yhajime Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4UIxvtMessenger.cc,v 1.2.8.1 1999/12/07 20:49:07 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#ifdef G4UI_BUILD_XVT_SESSION
+44 -12
View File
@@ -1,19 +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: G4UIWin32.hh,v 1.3 1999/05/06 15:20:37 barrand Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4UIWin32.hh,v 1.7.4.1 1999/12/07 20:49:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#ifndef G4UIWin32_h
#define G4UIWin32_h
#if defined(G4UI_BUILD_WIN32_SESSION) || defined(G4UI_USE_WIN32)
#include <rw/tvhdict.h>
#include "g4std/map"
#include "g4std/vector"
#include "G4VBasicShell.hh"
#include "G4VInteractiveSession.hh"
@@ -22,19 +23,50 @@
class G4VInteractorManager;
class G4UIWin32 : public G4VBasicShell, public G4VInteractiveSession {
public:
G4UIWin32 (HINSTANCE,HINSTANCE,LPSTR,int);
~G4UIWin32 ();
// Class description :
//
// G4UIWin32 : class to handle a Windows interactive session.
// G4UIWin32 is the Windows version of G4UIterminal.
//
// A command box is at disposal for entering/recalling Geant4 commands.
// A menubar could be customized through the AddMenu, AddButton methods.
// Note that there are corresponding Geant4 commands to add a
// menus in the menubar and add buttons in a menu.
// Ex :
// /interactor/addMenu test Test
// /interactor/addButton test Init /run/initialize
// /interactor/addButton test "Set gun" "/control/execute gun.g4m"
// /interactor/addButton test "Run one event" "/run/beamOn 1"
//
// Command completion, by typing "tab" key, is available on the
// command line.
//
// Class description - end :
class G4UIWin32 : public G4VBasicShell, public G4VInteractiveSession {
public: // With description
G4UIWin32 (HINSTANCE,HINSTANCE,LPSTR,int);
// The WinMain arguments have to be given.
G4UIsession* SessionStart ();
// To enter interactive Win32 loop ; waiting/executing command,...
void AddMenu (const char*,const char*);
// To add a pulldown menu in the menu bar.
// First argument is the name of the menu.
// Second argument is the label of the cascade button.
// Ex : AddMenu("my_menu","My menu")
void AddButton (const char*,const char*,const char*);
// To add a push button in a pulldown menu.
// First argument is the name of the menu.
// Second argument is the label of the button.
// Third argument is the Geant4 command executed when the button is fired.
// Ex : AddButton("my_menu","Run","/run/beamOn 1");
public:
~G4UIWin32 ();
void Prompt (G4String);
void SessionTerminate ();
void PauseSessionStart (G4String);
G4int ReceiveG4cout(G4String);
G4int ReceiveG4cerr(G4String);
void AddMenu (const char*,const char*);
void AddButton (const char*,const char*,const char*);
G4String GetCommand (int);
void TextAppendString(char*);
private:
@@ -46,7 +78,7 @@ private:
HWND mainWindow;
HWND textWindow,editWindow;
HMENU menuBar,defaultMenu;
RWTValHashDictionary<int,G4String> commands;
G4std::map<int,G4String, G4std::less<int> > commands;
void* textBuffer;
int textRows,textCols;
static LRESULT CALLBACK MainWindowProc(HWND,UINT,WPARAM,LPARAM);
@@ -54,7 +86,7 @@ private:
static LRESULT CALLBACK EditWindowProc(HWND,UINT,WPARAM,LPARAM);
G4bool fHelp;
G4int fHelpChoice;
RWTValOrderedVector<G4String> fHistory;
G4std::vector<G4String> fHistory;
int fHistoryPos;
};
+16 -3
View File
@@ -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.hh,v 1.2 1999/04/13 01:26:24 yhajime Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4UIXaw.hh,v 1.3.4.1 1999/12/07 20:49:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#ifndef G4UIXaw_h
#define G4UIXaw_h
@@ -20,6 +20,19 @@
class G4UIsession;
class G4UImanager;
// Class description :
//
// G4UIXaw : class to handle an interactive session.
// G4UIXaw is the "Athena" version of G4UIterminal.
// It has been provided at a time where no free Motif
// where available. Now that some exists (lesstif),
// G4UIXm should be prefered. The look and feel of
// G4UIXaw is hugly...
//
// No command completion is available.
//
// Class description - end :
class G4UIXaw : public G4VBasicShell {
public:
G4UIXaw(int,char**);
+41 -9
View File
@@ -1,19 +1,19 @@
// 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.hh,v 1.4 1999/05/11 13:26:29 barrand Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4UIXm.hh,v 1.8.4.1 1999/12/07 20:49:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#ifndef G4UIXm_h
#define G4UIXm_h
#if defined(G4UI_BUILD_XM_SESSION) || defined(G4UI_USE_XM)
#include <rw/tvhdict.h>
#include "g4std/map"
#include <X11/Intrinsic.h>
@@ -22,18 +22,50 @@
class G4UIsession;
// Class description :
//
// G4UIXm : class to handle a Motif interactive session.
// G4UIXm is the Motif version of G4UIterminal.
//
// A command box is at disposal for entering/recalling Geant4 commands.
// A menubar could be customized through the AddMenu, AddButton methods.
// Note that there are corresponding Geant4 commands to add a
// menus in the menubar and add buttons in a menu.
// Ex :
// /interactor/addMenu test Test
// /interactor/addButton test Init /run/initialize
// /interactor/addButton test "Set gun" "/control/execute gun.g4m"
// /interactor/addButton test "Run one event" "/run/beamOn 1"
//
// Command completion, by typing "tab" key, is available on the
// command line.
//
// Class description - end :
class G4UIXm : public G4VBasicShell, public G4VInteractiveSession {
public:
public: // With description
G4UIXm(int,char**);
~G4UIXm();
// (argv, argc) or (0, NULL) had to be given.
G4UIsession* SessionStart();
// To enter interactive X loop ; waiting/executing command,...
void AddMenu(const char*,const char*);
// To add a pulldown menu in the menu bar.
// First argument is the name of the menu.
// Second argument is the label of the cascade button.
// Ex : AddMenu("my_menu","My menu")
void AddButton(const char*,const char*,const char*);
// To add a push button in a pulldown menu.
// First argument is the name of the menu.
// Second argument is the label of the button.
// Third argument is the Geant4 command executed when the button is fired.
// Ex : AddButton("my_menu","Run","/run/beamOn 1");
public:
~G4UIXm();
void Prompt(G4String);
void SessionTerminate();
void PauseSessionStart(G4String);
G4int ReceiveG4cout(G4String);
G4int ReceiveG4cerr(G4String);
void AddMenu(const char*,const char*);
void AddButton(const char*,const char*,const char*);
G4String GetCommand(Widget);
private:
void SecondaryLoop(G4String);
@@ -41,7 +73,7 @@ private:
void ExitHelp();
private:
Widget form,shell,command,menuBar,text;
RWTValHashDictionary<Widget,G4String> commands;
G4std::map<Widget,G4String, G4std::less<Widget> > commands;
static void commandEnteredCallback(Widget,XtPointer,XtPointer);
static void keyHandler(Widget,XtPointer,XEvent*,Boolean*);
G4bool fHelp;
@@ -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.hh,v 1.2 1999/04/13 01:26:25 yhajime Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4UIterminal.hh,v 1.3.4.1 1999/12/07 20:49:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#ifndef G4UIterminal_h
@@ -16,17 +16,31 @@
#include "G4UImanager.hh"
#include <fstream.h>
// class description:
//
// This class inherits the class G4UIsession.
// This is the class to use a character-terminal sesion.
class G4UIterminal : public G4VBasicShell
{
public:
public: // with description
G4UIterminal();
~G4UIterminal();
G4UIsession * SessionStart();
// A character-terminal session "terminalSession" is instantiated.
// G4cout stream is redirected by default to the constructed instance.
// Usage: G4UIsession * terminalSession = new G4UIterminal;
// "terminalSession" is started.
// Usage: terminalSession->SessionStart();
// "terminalSession" is deleted.
// Usage: delete terminalSession;
//
void PauseSessionStart(G4String);
G4int ReceiveG4cout(G4String coutString);
G4int ReceiveG4cerr(G4String cerrString);
// These methods are implementation of corresponding virtual methods
// of G4UIsession class.
private:
G4UImanager * UI;
G4String promptCharacter;
+8 -12
View File
@@ -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);
//
+3 -3
View File
@@ -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
+3 -8
View File
@@ -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)
/***************************************************************************/
+65 -56
View File
@@ -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()){
@@ -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,
@@ -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: G4VBasicShell.hh,v 1.3 1999/04/16 10:06:05 barrand Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VBasicShell.hh,v 1.4.4.1 1999/12/07 20:49:09 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
#ifndef G4VBasicShell_H
@@ -18,6 +18,19 @@ class G4UIcommand;
#include "G4UIsession.hh"
#include "globals.hh"
// Class description :
//
// G4VBasicShell : a base class to extract common things to various
// sessions.
//
// It handles "seek" completion logic, help logic.
// VBasicShell handles also commands like "cd, ls, pwd"
// without passing by a Geant4 "intercom" command. This feature,
// which is similar to a UNIX shell one, had given.
// its name to the class.
//
// Class description - end :
class G4VBasicShell : public G4UIsession
{
public:
@@ -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,
@@ -9,12 +9,22 @@
#ifndef G4VInteractiveSession_H
#define G4VInteractiveSession_H 1
#include <rw/tvhdict.h>
#include "g4std/map"
#include "G4VInteractorManager.hh"
class G4UImessenger;
// Class description :
//
// G4VInteractiveSession : a base class to isolate common things
// to various graphical "basic" G4UI sessions ; AddMenu, AddButton,
// a dictionnary for widgets.
// The word "interactor" is for "piece of user interface" or
// "widget" (which means nothing).
//
// Class description - end :
class G4VInteractiveSession {
public:
G4VInteractiveSession();
@@ -25,7 +35,8 @@ public:
G4Interactor GetInteractor(G4String);
private:
G4UImessenger* messenger;
RWTValHashDictionary<G4String,G4Interactor> interactors;
typedef G4std::map<G4String,G4Interactor, G4std::less<G4String> > G4interactor_map;
G4interactor_map interactors;
};
#endif
@@ -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: G4VInteractorManager.hh,v 1.3 1999/04/16 10:06:06 barrand Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4VInteractorManager.hh,v 1.5.4.1 1999/12/07 20:49:10 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// G.Barrand
@@ -14,12 +14,22 @@
#define G4VINTERACTORMANAGER_HH
#include "globals.hh"
#include <rw/tvordvec.h>
#include "g4std/vector"
typedef void* G4Interactor;
typedef G4bool (*G4DispatchFunction)(void*);
typedef void (*G4SecondaryLoopAction)();
// Class description :
//
// G4VInteractorManager : a base class to isolate common things
// to various GUI "toolkits" like WIndows, Xt.
// The word "interactor" is for "piece of user interface" or
// "widget" (which means nothing). Then a GUI "toolkit" could be
// defined as a manager of interactors.
//
// Class description - end :
class G4VInteractorManager {
public:
G4VInteractorManager ();
@@ -56,10 +66,10 @@ private:
int argc;
char** argv;
G4Interactor mainInteractor;
RWTValOrderedVector<G4DispatchFunction> dispatchers;
RWTValOrderedVector<G4SecondaryLoopAction> preActions;
RWTValOrderedVector<G4SecondaryLoopAction> postActions;
RWTValOrderedVector<G4Interactor> shells;
G4std::vector<G4DispatchFunction> dispatchers;
G4std::vector<G4SecondaryLoopAction> preActions;
G4std::vector<G4SecondaryLoopAction> postActions;
G4std::vector<G4Interactor> shells;
G4bool secondaryLoopEnabled;
G4bool alreadyInSecondaryLoop;
int exitSecondaryLoop;
+11 -3
View File
@@ -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.hh,v 1.3 1999/05/07 10:34:11 barrand Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4Win32.hh,v 1.4.4.1 1999/12/07 20:49:10 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// To unify Windows message treatment between
// G4/interfaces Windows sessions and G4/visualizations Windows drivers.
@@ -22,6 +22,14 @@
#include "G4VInteractorManager.hh"
// Class description :
//
// G4Win32 : a singleton to handle GUI sessions and visualization
// drivers built over Windows. It permits to have one Windows main
// loop for the whole application.
//
// Class description - end :
class G4Win32 : public G4VInteractorManager {
public:
static G4Win32* getInstance ();
+19 -10
View File
@@ -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.hh,v 1.2 1999/04/13 01:26:31 yhajime Exp $
// GEANT4 tag $Name: geant4-00-01 $
// $Id: G4Xt.hh,v 1.3.4.1 1999/12/07 20:49:10 gunter Exp $
// GEANT4 tag $Name: geant4-01-00 $
//
// To unify X11 event treatment between
// G4/interfaces Xt sessions and G4/visualizations Xt drivers.
@@ -21,15 +21,24 @@
#include "G4VInteractorManager.hh"
// Class description :
//
// G4Xt : a singleton to handle GUI sessions and visualization
// drivers built over Xt. It permits to have one Xt main loop for
// the whole application. The Xt toolkit is inited in the
// constructor. It is done once for the whole application.
//
// Class description - end :
class G4Xt : public G4VInteractorManager {
public:
static G4Xt* getInstance ();
static G4Xt* getInstance (int,char**,char*);
void PutStringInResourceDatabase (char*);
G4bool Inited ();
void* GetEvent ();
void FlushAndWaitExecution ();
virtual ~G4Xt ();
static G4Xt* getInstance();
static G4Xt* getInstance(int,char**,char*);
void PutStringInResourceDatabase(char*);
G4bool Inited();
void* GetEvent();
void FlushAndWaitExecution();
virtual ~G4Xt();
private:
G4Xt (int,char**,char*);
static G4Xt* instance; // Pointer to single instance.
@@ -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;
}
+17 -15
View File
@@ -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 (
+3 -3
View File
@@ -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
+12 -6
View File
@@ -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;
}