Import Geant4 2.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:42:07 +02:00
parent 103bda00c8
commit e7d7193284
3106 changed files with 171117 additions and 90550 deletions
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIGAG.hh,v 1.3.4.1.2.2 1999/12/14 07:07:55 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UIGAG.hh,v 1.4 1999/12/15 14:50:43 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// G4UIGAG.hh
// GAG(Geant4 adaptive GUI) interface class
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIGAG.cc,v 1.6.2.1.2.1.2.7 1999/12/17 12:04:58 johna Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UIGAG.cc,v 1.9 1999/12/17 12:09:50 johna Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// G4UIGAG.cc
// 18.Feb.98 M.Nagamatu and T.Kodama created G4UIGAG from G4UIterminal
+30 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.20 1999/11/10 16:12:19 johna Exp $
$Id: History,v 1.31 2000/06/23 08:46:48 stesting Exp $
-------------------------------------------------------------------
=========================================================
@@ -16,6 +16,35 @@ committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
23 June 2000 John Allison (interfaces-V01-01-06)
- Protected G4UIterminal, G4Ui[t]csh against access by index to null strings.
21 June 2000 John Allison (interfaces-V01-01-05)
- Added include $(G4INSTALL)/config/G4VIS_BUILD.gmk to common/GNUmakefile.
15 June 2000 John Allison (interfaces-V01-01-04)
- More ISO compliance for G4UIterminal class.
14 June 2000 Makoto Asai (interfaces-V01-01-03)
- ISO compliance for G4UItcsh classes
26 May 2000 Guy Barrand (interfaces-V01-01-02)
- G4UIXm.hh, G4UIWin32.hh : change comments about /gui for the doc.
23 May 2000 John Allison (interfaces-V01-01-01-without-tcsh)
- Tag without G4UIterminal(G4UItcsh) in case it is not needed in the release.
20 May 2000 Guy Barrand (interfaces-V01-01-01)
- common/G4InteractorMessenger : change command name "interactor" to "gui".
19 May 2000 John Allison (interfaces-V01-01-00)
- G4UIterminal displays a candidate list in case a given parameter is
wrong (Makoto Asai).
26 Mar 2000 Makoto Asai
- Introducing a new G4UIterminal with UNIX-like shell.
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.
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIWo.hh,v 1.2.8.1 1999/12/07 20:49:05 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UIWo.hh,v 1.3 1999/12/15 14:50:44 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef G4UIWo_h
#define G4UIWo_h
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4WoMessenger.hh,v 1.2.8.1 1999/12/07 20:49:05 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4WoMessenger.hh,v 1.3 1999/12/15 14:50:44 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef G4WoMessenger_h
#define G4WoMessenger_h 1
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4oCommon.hh,v 1.2.8.1 1999/12/07 20:49:06 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4oCommon.hh,v 1.3 1999/12/15 14:50:44 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
/*
Included by G4o.h.
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4oCommon.icc,v 1.2.8.1 1999/12/07 20:49:06 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4oCommon.icc,v 1.3 1999/12/15 14:50:44 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
/*
Included by G4o.cc.
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIWo.cc,v 1.2.8.1.2.1 1999/12/08 17:34:02 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UIWo.cc,v 1.3 1999/12/15 14:50:46 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//G4UIWo.cc -- copied from G4UIterminal.cc
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4WoMessenger.cc,v 1.2.8.1 1999/12/07 20:49:06 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4WoMessenger.cc,v 1.3 1999/12/15 14:50:46 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifdef G4UI_BUILD_WO_SESSION
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIxvt.hh,v 1.2.8.1.2.2 1999/12/14 07:07:56 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UIxvt.hh,v 1.3 1999/12/15 14:50:46 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
////////////////////////////////////////////////////////////////////////
// XVT driver class header //
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIxvtMessenger.hh,v 1.2.8.1 1999/12/07 20:49:06 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UIxvtMessenger.hh,v 1.3 1999/12/15 14:50:46 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//////////////////////////////////////////////////////////////////////////////
// //
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIxvt.cc,v 1.2.8.1.2.1 1999/12/08 17:34:03 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UIxvt.cc,v 1.3 1999/12/15 14:50:46 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifdef G4UI_BUILD_XVT_SESSION
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIxvtMessenger.cc,v 1.2.8.1.2.1 1999/12/08 17:34:03 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UIxvtMessenger.cc,v 1.3 1999/12/15 14:50:46 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifdef G4UI_BUILD_XVT_SESSION
@@ -0,0 +1,45 @@
// This code implementation is the intellectual property of
// 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: G4UIArrayString.hh,v 1.1 2000/03/26 23:02:33 asaim Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef G4UIArrayString_h
#define G4UIArrayString_h
#include "globals.hh"
//
// Description:
// This class is a utility class for listing commands like
// UNIX "ls" command.
//
class G4UIArrayString {
private:
G4String* stringArray;
G4int nElement;
G4int nColumn;
G4String* GetElement(G4int icol, G4int irow) const;
// #rows in a column
G4int GetNRow(G4int icol) const;
// max field width of a column
G4int GetNField(G4int icol) const;
// calculate total column width
G4int CalculateColumnWidth() const;
public:
G4UIArrayString(const G4String& stream);
~G4UIArrayString();
void Show(G4int ncol);
};
#endif
+6 -6
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIWin32.hh,v 1.7.4.1 1999/12/07 20:49:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UIWin32.hh,v 1.9 2000/05/26 14:58:29 barrand Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef G4UIWin32_h
#define G4UIWin32_h
@@ -33,10 +33,10 @@ class G4VInteractorManager;
// 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"
// /gui/addMenu test Test
// /gui/addButton test Init /run/initialize
// /gui/addButton test "Set gun" "/control/execute gun.g4m"
// /gui/addButton test "Run one event" "/run/beamOn 1"
//
// Command completion, by typing "tab" key, is available on the
// command line.
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIXaw.hh,v 1.3.4.1 1999/12/07 20:49:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UIXaw.hh,v 1.4 1999/12/15 14:50:46 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef G4UIXaw_h
#define G4UIXaw_h
+6 -6
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIXm.hh,v 1.8.4.1 1999/12/07 20:49:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UIXm.hh,v 1.10 2000/05/26 14:58:30 barrand Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef G4UIXm_h
#define G4UIXm_h
@@ -32,10 +32,10 @@ class G4UIsession;
// 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"
// /gui/addMenu test Test
// /gui/addButton test Init /run/initialize
// /gui/addButton test "Set gun" "/control/execute gun.g4m"
// /gui/addButton test "Run one event" "/run/beamOn 1"
//
// Command completion, by typing "tab" key, is available on the
// command line.
@@ -0,0 +1,34 @@
// This code implementation is the intellectual property of
// 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: G4UIcsh.hh,v 1.1 2000/03/26 23:03:46 asaim Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef G4UIcsh_h
#define G4UIcsh_h
#include "G4VUIshell.hh"
//
// Description:
// This class gives csh-like shell. (same as dumb terminal)
//
class G4UIcsh : public G4VUIshell {
protected:
public:
G4UIcsh(const G4String& prompt="%s> ");
~G4UIcsh();
virtual G4String GetCommandLine();
};
#endif
+126
View File
@@ -0,0 +1,126 @@
// This code implementation is the intellectual property of
// 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: G4UItcsh.hh,v 1.1 2000/03/26 23:03:47 asaim Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef G4UItcsh_h
#define G4UItcsh_h 1
#ifndef WIN32
#include <termios.h>
#include "g4std/vector"
#include "G4VUIshell.hh"
#include "G4UIcommand.hh"
#include "G4UIcommandTree.hh"
//
// Description:
// This class gives tcsh-like shell.
//
// If your terminal supports color code, colored strings are available
// in ListCommand(). For activating color support,
// e.g.
// tcsh-> SetLsColor(GREEN, CYAN); // (dir, command) color
//
// [key binding]
// ^A ... move cursor to the top
// ^B ... backward cursor ([LEFT])
// ^D ... delete/exit/show matched list
// ^E ... move cursor to the end
// ^F ... forward cursor ([RIGHT])
// ^K ... clear after the cursor
// ^L ... clear screen (not implemented)
// ^N ... next command ([DOWN])
// ^P ... previous command ([UP])
// TAB... command completion
// DEL... backspace
// BS ... backspace
//
// [prompt string substitution]
// %s ... current application status
// %/ ... current working directory
// %h ... history# (different from G4 history#)
//
class G4UItcsh : public G4VUIshell {
protected:
virtual void MakePrompt();
G4int cursorPosition; // cursor position
G4String commandLine; // command line string;
G4String commandLineBuf; // temp. command line;
G4bool IsCursorLast() const;
// Is cursor position at the last of command line ?
void InitializeCommandLine();
G4String ReadLine();
void InsertCharacter(char cc); // insert character
void BackspaceCharacter(); // backspace character
void DeleteCharacter(); // delete character
void ClearLine(); // clear command line
void ClearAfterCursor(); // clear after the cursor
void ClearScreen(); // clear screen
void ForwardCursor(); // move cursor forward
void BackwardCursor(); // move cursor backward
void MoveCursorTop(); // move cursor to the top
void MoveCursorEnd(); // move cursor to the end
void NextCommand(); // next command
void PreviousCommand(); // previous command
void ListMatchedCommand(); // list matched commands
void CompleteCommand(); // complete command
// utilities...
G4String GetFirstMatchedString(const G4String& str1,
const G4String& str2) const;
// history functionality (history# is managed in itself)
G4std::vector<G4String> commandHistory;
G4int maxHistory; // max# of histories stored
G4int currentHistoryNo; // global
G4int relativeHistoryIndex; // local index relative to current history#
void StoreHistory(G4String aCommand);
G4String RestoreHistory(G4int index); // index is global history#
// (re)set termios
termios tios; // terminal mode (prestatus)
G4String clearString; // "clear code (^L)"
void SetTermToInputMode();
void RestoreTerm();
public:
G4UItcsh(const G4String& prompt="%s> ", G4int maxhist=100);
~G4UItcsh();
void SetLsColor(TermColorIndex dirColor, TermColorIndex cmdColor);
virtual G4String GetCommandLine();
};
inline G4bool G4UItcsh::IsCursorLast() const
{
if(cursorPosition == commandLine.length()+1) return TRUE;
else return FALSE;
}
inline void G4UItcsh::SetLsColor(TermColorIndex dirColor,
TermColorIndex cmdColor)
{
lsColorFlag= TRUE;
directoryColor= dirColor;
commandColor= cmdColor;
}
#endif
#endif
+65 -39
View File
@@ -5,57 +5,83 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIterminal.hh,v 1.3.4.1.2.2 1999/12/14 07:07:56 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UIterminal.hh,v 1.5 2000/03/26 23:03:48 asaim Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef G4UIterminal_h
#define G4UIterminal_h 1
#include "G4VBasicShell.hh"
#include "G4UImanager.hh"
#include "g4std/fstream"
#include "G4UImanager.hh"
#include "G4VBasicShell.hh"
#include "G4VUIshell.hh"
// class description:
//
// This class inherits the class G4UIsession.
// This is the class to use a character-terminal sesion.
// Description:
//
// This class inherits the class G4UIsession.
// This is the class to use a character-terminal sesion.
//
// Usage:
// G4UIsession* terminalSession = new G4UIterminal;
// or G4UIsession* terminalSession = new G4UIterminal(new your-shell);
//
// A character-terminal session "terminalSession" is instantiated.
// G4cout stream is redirected by default to the constructed instance.
//
// terminalSession-> SessionStart(); // "terminalSession" is started.
// delete terminalSession; // "terminalSession" is deleted.
//
//
// In default(no arguments are given), csh-like shell is instantiated.
// If you want to use another shell (e.g. tcsh-like), you can give
// your favorite shell in an argument of the constructor.
//
// Which shell? / How to define your own shell?
// Currently two kinds of shells,
// G4UIcsh / G4UItcsh
// , are presented.
// They inherit the abstract base class, G4VUIshell.
// In order to define your own shell,
// - Define your own shell class derived from G4VUIshell.
// - Implement GetCommandLine() method (pure virtual).
// - Add more functionality, if need.
//
// For more detail, see source codes.
//
class G4UIterminal : public G4VBasicShell
{
public: // with description
G4UIterminal();
~G4UIterminal();
class G4UIterminal : public G4VBasicShell {
private:
G4UImanager* UI;
// shell
G4VUIshell* shell;
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;
G4bool iExit;
G4bool iCont;
// program states
G4bool iExit;
G4bool iCont;
public:
G4UIterminal(G4VUIshell* aShell=0);
~G4UIterminal();
void SetPrompt(const G4String& prompt);
private:
void ExecuteCommand(G4String aCommand);
G4String GetCommand();
G4bool GetHelpChoice(G4int& aInt);
void ExitHelp();
public:
// These methods are implementation of corresponding virtual methods
// of G4UIsession class.
virtual G4UIsession* SessionStart();
virtual void PauseSessionStart(G4String msg);
virtual G4int ReceiveG4cout(G4String coutString);
virtual G4int ReceiveG4cerr(G4String cerrString);
private:
void ExecuteCommand(G4String);
G4String GetCommand();
G4bool GetHelpChoice(G4int&);
void ExitHelp();
};
#endif
@@ -0,0 +1,102 @@
// This code implementation is the intellectual property of
// 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: G4VUIshell.hh,v 1.1 2000/03/26 23:03:48 asaim Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef G4VUIshell_h
#define G4VUIshell_h 1
#include "globals.hh"
//
// Description:
// This class is the abstract base class for various UI shells.
//
// GetCommadLine() (virtual) returns a command string input from
// a commad line.
//
// Two pre-inplemented shell commands(still virtual) are also included,
// (somewhat differnt flavor from ones provided by G4VBasicShell)
// ShowCurrentDirectory() ... show current directory
// ListCommand() ... list commands
//
// [prompt string substitution] (default)
// %s ... current application status
// %/ ... current working directory
//
// terminal color index
enum TermColorIndex{ BLACK=0, RED, GREEN, YELLOW,
BLUE, PURPLE, CYAN, WHITE};
class G4UIcommandTree;
class G4VUIshell {
protected:
G4String promptString;
G4String promptSetting; // including %-directive
virtual void MakePrompt(); // make prompt string
G4int nColumn; // column size of terminal (default=80)
// color code support (effective if your terminal supports color code.)
// default setting is off.
G4bool lsColorFlag; // color flag for list command
TermColorIndex directoryColor;
TermColorIndex commandColor;
// for treating G4 command tree...
G4String currentCommandDir; // current command directory (absolute path)
// get tree node
G4UIcommandTree* GetCommandTree(const G4String& dir) const;
// absolute path name (ignore command)
G4String GetAbsCommandDirPath(const G4String& apath) const;
// tail of path ( xxx/xxx/zzz -> zzz, trancated //// -> /)
G4String GetCommandPathTail(const G4String& apath) const;
public:
G4VUIshell(const G4String& prompt="> ");
~G4VUIshell();
void SetNColumn(G4int ncol);
void SetPrompt(const G4String& prompt);
void SetCurrentDirectory(const G4String& ccd);
// shell commands
virtual void ShowCurrentDirectory() const;
virtual void ListCommand(const G4String& input,
const G4String& candidate="") const;
// "candidate" is specified with full path.
// get command string from a command line
virtual G4String GetCommandLine()= 0;
};
// inlines...
inline void G4VUIshell::SetNColumn(G4int ncol)
{
nColumn= ncol;
}
inline void G4VUIshell::SetPrompt(const G4String& prompt)
{
promptSetting= prompt;
}
inline void G4VUIshell::SetCurrentDirectory(const G4String& dir)
{
currentCommandDir= dir;
}
inline void G4VUIshell::ShowCurrentDirectory() const
{
G4cout << currentCommandDir << G4endl;
}
#endif
@@ -0,0 +1,174 @@
// This code implementation is the intellectual property of
// 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: G4UIArrayString.cc,v 1.2 2000/06/14 03:18:59 asaim Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "g4std/iomanip"
#include "G4UIArrayString.hh"
static const char strESC= '\033';
////////////////////////////////////////////////////////
G4UIArrayString::G4UIArrayString(const G4String& stream)
////////////////////////////////////////////////////////
{
nElement=0;
nColumn=5; // temporal assignment
G4String tmpstr= stream; // G4String::strip() CONST !!
G4String astream= tmpstr.strip(G4String::both);
// tokenize...
G4int indx=0;
while(1) {
G4int jc= astream.index(" ", indx);
nElement++;
if(jc == G4String::npos) break;
for(G4int i=1; jc+i< astream.length(); i++ ) { // skip continuing spaces
if(astream[jc+i]==' ') jc++;
else break;
}
indx= jc+1;
}
// allocate string array
stringArray= new G4String[nElement];
// push...
indx=0;
for(G4int i=0; i<nElement; i++){
G4int jc= astream.index(" ", indx);
if(jc != G4String::npos)
stringArray[i]= astream(indx, jc-indx);
else { // last token
jc= astream.length()+1;
stringArray[i]= astream(indx, jc-indx);
}
for(G4int j=1; jc+j< astream.length(); j++ ) { // skip continuing spaces
if(astream(jc+j)==' ') jc++;
else break;
}
indx= jc+1;
}
}
///////////////////////////////////
G4UIArrayString::~G4UIArrayString()
///////////////////////////////////
{
delete [] stringArray;
}
///////////////////////////////////////////////////////////////////
G4String* G4UIArrayString::GetElement(G4int icol, G4int irow) const
///////////////////////////////////////////////////////////////////
{
if( !(icol>=1 && irow>=1)) // offset of column/row is "1".
G4cerr << "G4UIArrayString: overrange" << G4endl;
if(icol>nColumn) G4cerr << "G4UIArrayString: overrange" << G4endl;
G4int jq= (irow-1)*nColumn + icol;
if(jq> nElement) G4cerr << "G4UIArrayString: overrange" << G4endl;
jq--;
return &stringArray[jq];
}
////////////////////////////////////////////
G4int G4UIArrayString::GetNRow(int icol) const
////////////////////////////////////////////
{
G4int ni;
if(nElement%nColumn ==0) ni= nElement/nColumn;
else ni= nElement/nColumn + 1;
G4int nn= nElement%nColumn;
if(nn==0) nn= nColumn;
if(icol<= nn) return ni;
else return ni-1;
}
////////////////////////////////////////////////
G4int G4UIArrayString::GetNField(int icol) const
////////////////////////////////////////////////
{
G4int maxWidth=0;
for (G4int iy=1; iy<= GetNRow(icol); iy++) {
G4int ilen= GetElement(icol,iy)-> length();
// care for color code
// if(GetElement(icol,iy)-> index(strESC,0) != G4String::npos) {
// if(strESC == (*GetElement(icol,iy))[0] ) {
const char tgt = (*GetElement(icol,iy))[0];
if(strESC == tgt) {
ilen-= 5;
if(ilen<0) G4cout << "length(c) cal. error." << G4endl;
}
if(ilen> maxWidth) maxWidth= ilen;
}
return maxWidth;
}
/////////////////////////////////////////////////
int G4UIArrayString::CalculateColumnWidth() const
/////////////////////////////////////////////////
{
G4int totalWidth= 0;
for(G4int ix=1; ix<= nColumn; ix++) {
totalWidth+= GetNField(ix);
}
const G4int nwSpace= 2;
totalWidth+= (nColumn-1)*nwSpace; // for space
return totalWidth;
}
//////////////////////////////////////
void G4UIArrayString::Show(G4int ncol)
//////////////////////////////////////
{
// calculate #colums in need...
while( CalculateColumnWidth()< ncol ) {
nColumn++;
}
while( CalculateColumnWidth()> ncol && nColumn>1 ) {
nColumn--;
}
for(G4int iy=1; iy<= GetNRow(1); iy++) {
G4int nc= nColumn;
if(iy == GetNRow(1)) { // last row
nc= nElement%nColumn;
if(nc==0) nc= nColumn;
}
for(G4int ix=1; ix<=nc; ix++) {
G4String word= GetElement(ix,iy)-> data();
// care for color code
G4String colorWord;
//if(word.index(strESC,0) != G4String::npos) {
//if(strESC == word[0]) {
const char tgt = word[0];
if(strESC == tgt) {
colorWord= word(0,5);
word.erase(0,5);
}
if(!colorWord.empty()) G4cout << colorWord << G4std::flush;
G4cout << G4std::setiosflags(G4std::ios::left) << G4std::setw(GetNField(ix))
<< word << G4std::flush;
if(ix != nc) G4cout << " " << G4std::flush;
else G4cout << G4endl;
}
}
}
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIWin32.cc,v 1.5.4.1.2.2 1999/12/14 07:07:56 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UIWin32.cc,v 1.6 1999/12/15 14:50:47 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// G.Barrand
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIXaw.cc,v 1.2.8.1 1999/12/07 20:49:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UIXaw.cc,v 1.3 1999/12/15 14:50:47 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// G.Barrand
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIXm.cc,v 1.5.4.1.2.4 1999/12/14 09:16:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UIXm.cc,v 1.6 1999/12/15 14:50:47 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// G.Barrand
+59
View File
@@ -0,0 +1,59 @@
// This code implementation is the intellectual property of
// 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: G4UIcsh.cc,v 1.3 2000/06/23 08:46:49 stesting Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4UIcsh.hh"
////////////////////////////////////////
G4UIcsh::G4UIcsh(const G4String& prompt)
: G4VUIshell(prompt)
////////////////////////////////////////
{
}
///////////////////
G4UIcsh::~G4UIcsh()
///////////////////
{
}
//////////////////////////////////
G4String G4UIcsh::GetCommandLine()
//////////////////////////////////
{
MakePrompt();
G4cout << promptString << G4std::flush;
G4String newCommand;
newCommand.readLine(G4cin, FALSE);
if (!G4cin.good()) {
G4cin.clear();
newCommand= "exit";
return newCommand;
}
// multi-line
while( (newCommand.length() > 0) &&
(newCommand[newCommand.length()-1] == '_') ) {
G4String newLine;
newCommand.remove(newCommand.length()-1);
newLine.readLine(G4cin, FALSE);
if (!G4cin.good()) {
G4cin.clear();
newCommand= "exit";
return newCommand;
}
newCommand.append(newLine);
}
return newCommand;
}
+684
View File
@@ -0,0 +1,684 @@
// This code implementation is the intellectual property of
// 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: G4UItcsh.cc,v 1.3 2000/06/23 08:46:49 stesting Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef WIN32
#include <ctype.h>
#include "g4std/strstream"
#include "G4StateManager.hh"
#include "G4UIcommandStatus.hh"
#include "G4UItcsh.hh"
// ASCII character code
static const char AsciiCtrA = '\001';
static const char AsciiCtrB = '\002';
static const char AsciiCtrC = '\003';
static const char AsciiCtrD = '\004';
static const char AsciiCtrE = '\005';
static const char AsciiCtrF = '\006';
static const char AsciiCtrK = '\013';
static const char AsciiCtrL = '\014';
static const char AsciiCtrN = '\016';
static const char AsciiCtrP = '\020';
static const char AsciiCtrQ = '\021';
static const char AsciiCtrS = '\023';
static const char AsciiCtrZ = '\032';
static const char AsciiTAB = '\011';
static const char AsciiBS = '\010';
static const char AsciiDEL = '\177';
static const char AsciiESC = '\033';
static const int AsciiPrintableMin = 32;
/////////////////////////////////////////////////////////
G4UItcsh::G4UItcsh(const G4String& prompt, G4int maxhist)
: G4VUIshell(prompt),
commandLine(""), cursorPosition(1),
commandHistory(maxhist), maxHistory(maxhist),
currentHistoryNo(1), relativeHistoryIndex(0)
/////////////////////////////////////////////////////////
{
// get current terminal mode
tcgetattr(0, &tios);
}
/////////////////////
G4UItcsh::~G4UItcsh()
/////////////////////
{
}
///////////////////////////
void G4UItcsh::MakePrompt()
///////////////////////////
{
if(promptSetting.length()<=1) {
promptString= promptSetting;
return;
}
promptString="";
G4int i;
for(i=0; i<promptSetting.length()-1; i++){
if(promptSetting[i]=='%'){
switch (promptSetting[i+1]) {
case 's': // current application status
{
G4StateManager* statM= G4StateManager::GetStateManager();
G4String stateStr= statM-> GetStateString(statM->GetCurrentState());
promptString.append(stateStr);
i++;
}
break;
case '/': // current working directory
promptString.append(currentCommandDir);
i++;
break;
case 'h': // history#
{
char st[20];
G4std::ostrstream os(st,20);
os << currentHistoryNo << '\0';
promptString.append(st);
i++;
}
break;
default:
break;
}
} else {
promptString.append(G4String(promptSetting[i]));
}
}
// append last chaacter
if(i == promptSetting.length()-1)
promptString.append(G4String(promptSetting[i]));
}
// --------------------------------------------------------------------
// commad line operations
// --------------------------------------------------------------------
//////////////////////////////////////
void G4UItcsh::InitializeCommandLine()
//////////////////////////////////////
{
commandLine= "";
cursorPosition= 1;
}
///////////////////////////////////////
void G4UItcsh::InsertCharacter(char cc)
///////////////////////////////////////
{
if( ! (cc >= AsciiPrintableMin && isprint(cc)) ) return;
// display...
G4cout << cc;
G4int i;
for(i=cursorPosition-1; i<commandLine.length() ;i++)
G4cout << commandLine[i];
for(i=cursorPosition-1; i<commandLine.length() ;i++)
G4cout << AsciiBS;
G4cout << G4std::flush;
// command line string...
if(IsCursorLast()) { // add
commandLine+= cc;
} else { // insert
commandLine.insert(cursorPosition-1, G4String(cc));
}
cursorPosition++;
}
///////////////////////////////////
void G4UItcsh::BackspaceCharacter()
///////////////////////////////////
{
if(cursorPosition==1) return;
// display...
if(IsCursorLast()) {
G4cout << AsciiBS << ' ' << AsciiBS << G4std::flush;
} else {
G4cout << AsciiBS;
G4int i;
for(i=cursorPosition-2; i< commandLine.length()-1 ;i++){
G4cout << commandLine[i+1];
}
G4cout << ' ';
for(i=cursorPosition-2; i< commandLine.length() ;i++){
G4cout << AsciiBS;
}
G4cout << G4std::flush;
}
// command line string...
commandLine.erase(cursorPosition-2, 1);
cursorPosition--;
}
////////////////////////////////
void G4UItcsh::DeleteCharacter()
////////////////////////////////
{
if(IsCursorLast()) return;
// display...
G4int i;
for(i=cursorPosition-1; i< commandLine.length()-1 ;i++){
G4cout << commandLine[i+1];
}
G4cout << ' ';
for(i=cursorPosition-1; i< commandLine.length() ;i++){
G4cout << AsciiBS;
}
G4cout << G4std::flush;
// command lin string...
commandLine.erase(cursorPosition-1, 1);
}
//////////////////////////
void G4UItcsh::ClearLine()
//////////////////////////
{
// display...
G4int i;
for(i= cursorPosition; i>=2; i--) G4cout << AsciiBS;
for(i=1; i<=commandLine.length(); i++) G4cout << ' ';
for(i=1; i<=commandLine.length(); i++) G4cout << AsciiBS;
G4cout << G4std::flush;
// command line string...
commandLine.erase();
cursorPosition= 1;
}
/////////////////////////////////
void G4UItcsh::ClearAfterCursor()
/////////////////////////////////
{
if(IsCursorLast()) return;
// display...
G4int i;
for(i=cursorPosition; i<=commandLine.length(); i++) G4cout << ' ';
for(i=commandLine.length(); i>=cursorPosition; i--) G4cout << AsciiBS;
G4cout << G4std::flush;
// command line string...
commandLine.erase(cursorPosition-1,
commandLine.length()-cursorPosition+1);
}
////////////////////////////
void G4UItcsh::ClearScreen()
////////////////////////////
{
if(! clearString.empty() ) {
G4cout << clearString;
G4cout << promptString << commandLine << G4std::flush;
// reset cursur position
for(G4int i=commandLine.length()+1; i>=cursorPosition+1; i--)
G4cout << AsciiBS << G4std::flush;
}
}
//////////////////////////////
void G4UItcsh::ForwardCursor()
//////////////////////////////
{
if(IsCursorLast()) return;
G4cout << commandLine[cursorPosition-1] << G4std::flush;
cursorPosition++;
}
///////////////////////////////
void G4UItcsh::BackwardCursor()
///////////////////////////////
{
if(cursorPosition==1) return;
cursorPosition--;
G4cout << AsciiBS << G4std::flush;
}
//////////////////////////////
void G4UItcsh::MoveCursorTop()
//////////////////////////////
{
for(G4int i=cursorPosition; i>1; i--){
G4cout << AsciiBS;
}
G4cout << G4std::flush;
cursorPosition=1;
}
//////////////////////////////
void G4UItcsh::MoveCursorEnd()
//////////////////////////////
{
for(G4int i=cursorPosition-1; i<commandLine.length(); i++){
G4cout << commandLine[i];
}
G4cout << G4std::flush;
cursorPosition=commandLine.length()+1;
}
////////////////////////////////
void G4UItcsh::PreviousCommand()
////////////////////////////////
{
G4int nhmax= currentHistoryNo-1 >= maxHistory ?
maxHistory : currentHistoryNo-1;
// retain current input
if(relativeHistoryIndex==0) commandLineBuf= commandLine;
if(relativeHistoryIndex>=-nhmax+1 && relativeHistoryIndex<=0) {
ClearLine();
relativeHistoryIndex--;
commandLine= RestoreHistory(currentHistoryNo+relativeHistoryIndex);
G4cout << commandLine << G4std::flush;
cursorPosition= commandLine.length()+1;
}
}
////////////////////////////
void G4UItcsh::NextCommand()
////////////////////////////
{
G4int nhmax= currentHistoryNo-1 >= maxHistory ?
maxHistory : currentHistoryNo-1;
if(relativeHistoryIndex>=-nhmax && relativeHistoryIndex<=-1) {
ClearLine();
relativeHistoryIndex++;
if(relativeHistoryIndex==0) commandLine= commandLineBuf;
else commandLine= RestoreHistory(currentHistoryNo+relativeHistoryIndex);
G4cout << commandLine << G4std::flush;
cursorPosition= commandLine.length()+1;
}
}
///////////////////////////////////
void G4UItcsh::ListMatchedCommand()
///////////////////////////////////
{
G4cout << G4endl;
// input string
G4String input= G4String(commandLine).strip(G4String::leading);
// target token is last token
G4int jhead= input.last(' ');
if(jhead != G4String::npos) {
input.remove(0, jhead);
input= input.strip(G4String::leading);
}
// command tree of "user specified directory"
G4String vpath= currentCommandDir;
G4String vcmd;
if( !input.empty() ) {
G4int len= input.length();
G4int indx=-1;
for(G4int i=len-1; i>=0; i--) {
if(input[i]=='/') {
indx= i;
break;
}
}
// get abs. path
if(indx != -1) vpath= GetAbsCommandDirPath(input(0,indx+1));
if(!(indx==0 && len==1)) vcmd= input(indx+1,len-indx-1); // care for "/"
}
// list matched dirs/commands
ListCommand(vpath, vpath+vcmd);
G4cout << promptString << commandLine << G4std::flush;
}
////////////////////////////////
void G4UItcsh::CompleteCommand()
////////////////////////////////
{
// inputting string
G4String input= G4String(commandLine).strip(G4String::leading);
// target token is last token
G4int jhead= input.last(' ');
if(jhead != G4String::npos) {
input.remove(0, jhead);
input= input.strip(G4String::leading);
}
// command tree of "user specified directory"
G4String vpath= currentCommandDir;
G4String vcmd;
G4int len= input.length();
if(!input.empty()) {
G4int indx= -1;
for(G4int i=len-1; i>=0; i--) {
if(input(i)=='/') {
indx= i;
break;
}
}
// get abs. path
if(indx != -1) vpath= GetAbsCommandDirPath(input(0,indx+1));
if(!(indx==0 && len==1)) vcmd= input(indx+1,len-indx-1); // care for "/"
}
G4UIcommandTree* atree= GetCommandTree(vpath); // get command tree
if(atree == NULL) return;
// list matched directories/commands
G4String stream, strtmp;
G4String inputpath= vpath+vcmd;
G4int nMatch= 0;
int Ndir= atree-> GetTreeEntry();
int Ncmd= atree-> GetCommandEntry();
// directory ...
for(G4int idir=1; idir<=Ndir; idir++) {
G4String fpdir= atree-> GetTree(idir)-> GetPathName();
// matching test
if( fpdir.index(inputpath, 0) == 0) {
if(nMatch==0) {
stream= GetCommandPathTail(fpdir);
} else {
strtmp= GetCommandPathTail(fpdir);
stream= GetFirstMatchedString(stream, strtmp);
}
nMatch++;
}
}
// command ...
for(G4int icmd=1; icmd<=Ncmd; icmd++){
G4String fpcmd= atree-> GetPathName() +
atree-> GetCommand(icmd) -> GetCommandName();
// matching test
if( fpcmd.index(inputpath, 0) ==0) {
if(nMatch==0) {
stream= GetCommandPathTail(fpcmd) + " ";
} else {
strtmp= GetCommandPathTail(fpcmd) + " ";
stream= GetFirstMatchedString(stream, strtmp);
}
nMatch++;
}
}
if(nMatch==0) return; // no matched
// display...
input= commandLine;
// target token is last token
jhead= input.last(' ');
if(jhead == G4String::npos) jhead=0;
else jhead++;
G4int jt= input.find_last_of('/');
if(jt<jhead) jt=G4String::npos;
if(jt==G4String::npos) jt= jhead;
else jt++;
G4String dspstr;
G4int i;
for(i=jt; i<=input.length()-1; i++) dspstr+= G4String(AsciiBS); // cleanup
for(i=jt; i<=input.length()-1; i++) dspstr+= G4String(' ');
for(i=jt; i<=input.length()-1; i++) dspstr+= G4String(AsciiBS);
dspstr+= stream;
G4cout << dspstr << G4std::flush;
// command line string
input.remove(jt);
input+= stream;
commandLine= input;
cursorPosition= commandLine.length()+1;
}
// --------------------------------------------------------------------
// commad line
// --------------------------------------------------------------------
/////////////////////////////
G4String G4UItcsh::ReadLine()
/////////////////////////////
{
InitializeCommandLine();
char cc;
do{ // input loop
G4cin.get(cc);
// treatment for special character
switch(cc){
case AsciiCtrA: // ... move cursor to the top
MoveCursorTop();
break;
case AsciiCtrB: // ... backward cursor
BackwardCursor();
break;
case AsciiCtrD: // ... delete/exit/show matched list
if(commandLine.length()!=0 && IsCursorLast()) ListMatchedCommand();
else if (commandLine.empty()) {
G4cout << G4endl;
exit(0);
} else DeleteCharacter();
break;
case AsciiCtrE: // ... move cursor to the end
MoveCursorEnd();
break;
case AsciiCtrF: // ... forward cursor
ForwardCursor();
break;
case AsciiCtrK: // ... clear after the cursor
ClearAfterCursor();
break;
case AsciiCtrL: // ... clear screen
// ClearScreen();
break;
case AsciiCtrN: // ... next command
NextCommand();
break;
case AsciiCtrP: // ... previous command
PreviousCommand();
break;
case AsciiTAB: // ... command completion
if( (!commandLine.empty()) && IsCursorLast()) CompleteCommand();
break;
case AsciiDEL: // ... backspace
BackspaceCharacter();
break;
case AsciiBS: // ... backspace
BackspaceCharacter();
break;
case AsciiCtrC: // ... kill prompt
break;
case AsciiCtrQ: // ... restarts suspeded output
break;
case AsciiCtrS: // ... suspend output
break;
case AsciiCtrZ: // ... suspend
break;
default:
break;
}
// treatment for ESC. character
if( cc == AsciiESC) { // ESC
G4cin.get(cc);
if (cc == '[') {
G4cin.get(cc);
switch(cc) {
case 'A': // [UP]
cc = 'P' - '@';
PreviousCommand(); // ... show previous commad
break;
case 'B': // [DOWN]
cc = 'N' - '@';
NextCommand(); // ... show next commad
break;
case 'C': // [RIGHT]
cc = 'F' - '@';
ForwardCursor(); // ... forward cursor
break;
case 'D': // [LEFT]
cc = 'B' - '@';
BackwardCursor(); // ... backward cursor
break;
default: // who knows !?
cc = 0;
break;
}
}
}
// insert character to command line and display
InsertCharacter(cc);
} while( cc != '\n');
return commandLine;
}
///////////////////////////////////
G4String G4UItcsh::GetCommandLine()
///////////////////////////////////
{
SetTermToInputMode();
MakePrompt(); // update
relativeHistoryIndex= 0;
G4cout << promptString << G4std::flush;
G4String newCommand= ReadLine(); // read line...
// multi-line
while( (newCommand.length() > 0) &&
( newCommand[newCommand.length()-1] == '_') ) {
newCommand.remove(newCommand.length()-1);
G4cout << G4endl;
promptString= "? ";
G4cout << promptString << G4std::flush;
G4String newLine= ReadLine();
newCommand.append(newLine);
}
// update history...
G4bool isMeaningfull= FALSE; // check NULL command
for (int i=0; i<newCommand.length(); i++) {
if(newCommand[i] != ' ') {
isMeaningfull= TRUE;
break;
}
}
if( !newCommand.empty() && isMeaningfull) StoreHistory(newCommand);
// reset terminal
RestoreTerm();
G4cout << G4endl;
return newCommand;
}
////////////////////////////////////////////////////////////////////
G4String G4UItcsh::GetFirstMatchedString(const G4String& str1,
const G4String& str2) const
////////////////////////////////////////////////////////////////////
{
int nlen1= str1.length();
int nlen2= str2.length();
int nmin = nlen1<nlen2 ? nlen1 : nlen2;
G4String strMatched;
for(int i=0; i<nmin; i++){
if(str1[i]==str2[i]) {
strMatched+= str1[i];
} else {
break;
}
}
return strMatched;
}
// --------------------------------------------------------------------
// history
// --------------------------------------------------------------------
//////////////////////////////////////////////
void G4UItcsh::StoreHistory(G4String aCommand)
//////////////////////////////////////////////
{
G4int i= currentHistoryNo%maxHistory;
if(i==0) i=maxHistory;
commandHistory[i-1]= aCommand; // 0-offset
currentHistoryNo++;
}
///////////////////////////////////////////////
G4String G4UItcsh::RestoreHistory(G4int histNo)
///////////////////////////////////////////////
{
if(histNo>= currentHistoryNo) return "";
G4int index= histNo%maxHistory;
if(index==0) index= maxHistory;
return commandHistory[index-1]; // 0-offset
}
// --------------------------------------------------------------------
// terminal mode
// --------------------------------------------------------------------
///////////////////////////////////
void G4UItcsh::SetTermToInputMode()
///////////////////////////////////
{
termios tiosbuf= tios;
tiosbuf.c_iflag &= ~(BRKINT | ISTRIP);
tiosbuf.c_iflag |= (IGNBRK | IGNPAR);
tiosbuf.c_lflag &= ~(ICANON | IEXTEN | ECHO);
tiosbuf.c_cc[VMIN] = 1;
tiosbuf.c_cc[VTIME] = 0;
tcsetattr(0, TCSAFLUSH, &tiosbuf);
}
////////////////////////////
void G4UItcsh::RestoreTerm()
////////////////////////////
{
tcsetattr(0, TCSAFLUSH, &tios);
}
#endif
+210 -164
View File
@@ -5,215 +5,261 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4UIterminal.cc,v 1.4.4.1.2.1.2.7 1999/12/14 09:16:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4UIterminal.cc,v 1.13 2000/06/23 08:46:50 stesting Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4UIterminal.hh"
#include "g4std/strstream"
#include "G4StateManager.hh"
#include "G4UIcommandTree.hh"
#include "G4UIcommand.hh"
#include "G4UIcommandStatus.hh"
#include "G4ios.hh"
#include "g4std/strstream"
#include "G4UIterminal.hh"
#include "G4UIcsh.hh"
G4UIterminal::G4UIterminal()
//////////////////////////////////////////////
G4UIterminal::G4UIterminal(G4VUIshell* aShell)
//////////////////////////////////////////////
{
UI = G4UImanager::GetUIpointer();
UI->SetSession(this);
UI->SetCoutDestination(this);
G4StateManager * statM = G4StateManager::GetStateManager();
promptCharacter = statM->GetStateString(statM->GetCurrentState())
+ G4String("> ");
iExit = false;
iCont = false;
UI= G4UImanager::GetUIpointer();
UI-> SetSession(this);
UI-> SetCoutDestination(this);
G4StateManager* statM= G4StateManager::GetStateManager();
iExit= FALSE;
iCont= FALSE;
if(aShell) shell= aShell;
else shell= new G4UIcsh;
}
/////////////////////////////
G4UIterminal::~G4UIterminal()
/////////////////////////////
{
if( G4UImanager::GetUIpointer() != 0)
{
UI->SetSession(NULL);
UI->SetCoutDestination(NULL);
// G4cout << "Terminal session deleted" << G4endl;
if(shell) delete shell;
if(G4UImanager::GetUIpointer()) {
UI-> SetSession(NULL);
UI-> SetCoutDestination(NULL);
}
}
G4UIsession * G4UIterminal::SessionStart()
////////////////////////////////////////////////////
void G4UIterminal::SetPrompt(const G4String& prompt)
////////////////////////////////////////////////////
{
iExit = true;
G4StateManager * statM = G4StateManager::GetStateManager();
promptCharacter = statM->GetStateString(statM->GetCurrentState())
+ G4String("> ");
G4String newCommand = GetCommand();
while( iExit )
{
shell-> SetPrompt(prompt);
}
/////////////////////////////////////////
G4UIsession* G4UIterminal::SessionStart()
/////////////////////////////////////////
{
iExit= TRUE;
G4StateManager* statM= G4StateManager::GetStateManager();
G4String newCommand= GetCommand();
while(iExit){
ExecuteCommand(newCommand);
promptCharacter = statM->GetStateString(statM->GetCurrentState())
+ G4String("> ");
newCommand = GetCommand();
newCommand= GetCommand();
}
return NULL;
}
//////////////////////////////////////////////////
void G4UIterminal::PauseSessionStart(G4String msg)
//////////////////////////////////////////////////
{
promptCharacter = msg;
iCont = true;
G4String newCommand = GetCommand();
while( iCont )
{
iCont= TRUE;
G4String newCommand= GetCommand();
while(iCont){
ExecuteCommand(newCommand);
newCommand = GetCommand();
newCommand= GetCommand();
}
}
////////////////////////////////////////////////////
void G4UIterminal::ExecuteCommand(G4String aCommand)
////////////////////////////////////////////////////
{
if(aCommand.length()<2) return;
G4int returnVal = UI-> ApplyCommand(aCommand);
G4int paramIndex = returnVal % 100;
// 0 - 98 : paramIndex-th parameter is invalid
// 99 : convination of parameters is invalid
G4int commandStatus = returnVal - paramIndex;
G4UIcommand* cmd = 0;
if(commandStatus!=fCommandSucceeded)
{ cmd = FindCommand(aCommand); }
switch(commandStatus) {
case fCommandSucceeded:
break;
case fCommandNotFound:
G4cerr << "command <" << aCommand << "> not found" << G4endl;
if( aCommand.index("@@") != G4String::npos) {
G4cout << "@@G4UIterminal" << G4endl;
}
break;
case fIllegalApplicationState:
G4cerr << "illegal application state -- command refused" << G4endl;
break;
case fParameterOutOfRange:
// if(paramIndex<99) {
// G4cerr << "Parameter is out of range (index " << paramIndex << ")" << G4endl;
// G4cerr << "Allowed range : " << cmd->GetParameter(paramIndex)->GetParameterRange() << G4endl;
// } else {
// G4cerr << "Parameter is out of range" << G4endl;
// G4cerr << "Allowed range : " << cmd->GetRange() << G4endl;
// }
break;
case fParameterOutOfCandidates:
G4cerr << "Parameter is out of candidate list (index " << paramIndex << ")" << G4endl;
G4cerr << "Candidates : " << cmd->GetParameter(paramIndex)->GetParameterCandidates() << G4endl;
break;
case fParameterUnreadable:
G4cerr << "Parameter is wrong type and/or is not omittable (index " << paramIndex << ")" << G4endl;
break;
default:
G4cerr << "command refused (" << commandStatus << ")" << G4endl;
}
}
///////////////////////////////////
G4String G4UIterminal::GetCommand()
///////////////////////////////////
{
G4String newCommand;
G4String nullString;
newCommand= shell-> GetCommandLine();
G4String nC= newCommand.strip(G4String::leading);
if( nC.length() == 0 ) {
newCommand= nullString;
} else if( nC(0) == '#' ) {
G4cout << nC << G4endl;
newCommand= nullString;
} else if(nC=="ls" || nC(0,3)=="ls " ) { // list commands
ListDirectory(nC);
newCommand= nullString;
} else if(nC=="lc" || nC(0,3)=="lc " ) { // ... by shell
shell-> ListCommand(nC.remove(0,2));
newCommand= nullString;
} else if(nC == "pwd") { // show current directory
G4cout << "Current Command Directory : "
<< GetCurrentWorkingDirectory() << G4endl;
newCommand= nullString;
} else if(nC == "cwd") { // ... by shell
shell-> ShowCurrentDirectory();
newCommand= nullString;
} else if(nC == "cd" || nC(0,3) == "cd ") { // "cd"
ChangeDirectoryCommand(nC);
shell-> SetCurrentDirectory(GetCurrentWorkingDirectory());
newCommand= nullString;
} else if(nC == "help" || nC(0,5) == "help ") { // "help"
TerminalHelp(nC);
newCommand= nullString;
} else if(nC(0) == '?') { // "show current value of a parameter"
ShowCurrent(nC);
newCommand= nullString;
} else if(nC == "hist" || nC == "history") { // "hist/history"
G4int nh= UI-> GetNumberOfHistory();
for (G4int i=0; i<nh; i++) {
G4cout << i << ": " << UI->GetPreviousCommand(i) << G4endl;
}
newCommand= nullString;
} else if(nC(0) == '!') { // "!"
G4String ss= nC(1, nC.length()-1);
G4int vl;
const char* tt= ss;
G4std::istrstream is((char*)tt);
is >> vl;
G4int nh= UI-> GetNumberOfHistory();
if(vl>=0 && vl<nh) {
newCommand= UI-> GetPreviousCommand(vl);
G4cout << newCommand << G4endl;
} else {
G4cerr << "history " << vl << " is not found." << G4endl;
newCommand= nullString;
}
} else if(nC == "exit") { // "exit"
if(iCont) {
G4cout << "You are now processing RUN." << G4endl;
G4cout << "Please abort it using \"/run/abort\" command first" << G4endl;
G4cout << " and use \"continue\" command until the application"
<< G4endl;
G4cout << " becomes to Idle." << G4endl;
} else {
iExit= FALSE;
newCommand= nullString;
}
} else if( nC == "cont" || nC == "continue"){ // "cont/continu"
iCont= FALSE;
newCommand= nullString;
} else if( nC.empty() ){ // NULL command
newCommand= nullString;
} else {
}
return ModifyToFullPathCommand(newCommand);
}
//////////////////////////////////////////////////////
G4int G4UIterminal::ReceiveG4cout(G4String coutString)
//////////////////////////////////////////////////////
{
G4std::cout << coutString << G4std::flush;
return 0;
}
//////////////////////////////////////////////////////
G4int G4UIterminal::ReceiveG4cerr(G4String cerrString)
//////////////////////////////////////////////////////
{
G4std::cerr << cerrString << G4std::flush;
return 0;
}
void G4UIterminal::ExecuteCommand(G4String aCommand)
///////////////////////////////////////////////
G4bool G4UIterminal::GetHelpChoice(G4int& aInt)
///////////////////////////////////////////////
{
if(aCommand.length()<2) return;
int commandStatus = UI->ApplyCommand(aCommand);
switch(commandStatus)
{
case fCommandSucceeded:
break;
case fCommandNotFound:
G4cerr << "command <" << aCommand << "> not found" << G4endl;
if ( aCommand.index("@@") != G4std::string::npos) {
G4cout << "@@G4UIterminal" << G4endl;
}
break;
case fIllegalApplicationState:
G4cerr << "illegal application state -- command refused" << G4endl;
break;
case fParameterOutOfRange:
case fParameterUnreadable:
case fParameterOutOfCandidates:
default:
G4cerr << "command refused (" << commandStatus << ")" << G4endl;
}
}
G4String G4UIterminal::GetCommand()
{
G4String newCommand;
G4String nullString;
while( 1 )
{
G4cout << promptCharacter;
G4cout.flush();
newCommand.readLine( G4cin, FALSE );
if (!G4cin.good()) { G4cin.clear(); newCommand = nullString; iExit=false; break; }
newCommand = newCommand.strip(G4String::leading);
if( newCommand.length() < 1 ) { break; }
while( newCommand(newCommand.length()-1) == '_' )
{
G4String newLine;
newCommand.remove(newCommand.length()-1);
newLine.readLine( G4cin );
if (!G4cin.good()) { G4cin.clear(); newCommand = nullString; iExit=false; break; }
newCommand.append(newLine);
}
G4String nC = newCommand.strip(G4String::leading);
// -------------------- nC.toUpper();
if( nC.length() < 1 ){ break; }
if( nC(0) == '#' )
{ G4cout << nC << G4endl; }
else if( nC == "ls" || nC(0,3) == "ls " )
{ ListDirectory( nC ); }
else if( nC == "pwd" )
{
G4cout << "Current Working Directory : "
<< GetCurrentWorkingDirectory() << G4endl;
}
else if( nC == "cd" || nC(0,3) == "cd " )
{ ChangeDirectoryCommand( nC ); }
else if( nC == "help" || nC(0,5) == "help " )
{ TerminalHelp( nC ); }
else if( nC(0) == '?' )
{ ShowCurrent( nC ); }
else if( nC == "hist" || nC == "history" )
{
G4int nh = UI->GetNumberOfHistory();
for(int i=0;i<nh;i++)
{ G4cout << i << ": " << UI->GetPreviousCommand(i) << G4endl; }
}
else if( nC(0) == '!' )
{
G4String ss = nC(1,nC.length()-1);
G4int vl;
const char* tt = ss;
G4std::istrstream is((char*)tt);
is >> vl;
G4int nh = UI->GetNumberOfHistory();
if(vl>=0 && vl<nh)
{
newCommand = UI->GetPreviousCommand(vl);
G4cout << newCommand << G4endl;
break;
}
else
{ G4cerr << "history " << vl << " is not found." << G4endl; }
}
else if( nC == "exit" )
{
if( iCont )
{
G4cout << "You are now processing RUN." << G4endl;
G4cout << "Please abort it using \"/run/abort\" command first" << G4endl;
G4cout << " and use \"continue\" command until the application" << G4endl;
G4cout << " becomes to Idle." << G4endl;
}
else
{
iExit = false;
newCommand = nullString;
break;
}
}
else if( nC == "cont" || nC == "continue" )
{
iCont = false;
newCommand = nullString;
break;
}
else
{ break; }
}
return ModifyToFullPathCommand(newCommand);
}
G4bool G4UIterminal::GetHelpChoice(G4int& aInt){
G4cin >> aInt;
if(!G4cin.good()){
G4cin.clear();
G4cin.ignore(30,'\n');
return false;
}
return true;
return FALSE;
}
return TRUE;
}
void G4UIterminal::ExitHelp(){
// G4cin.flush();
/////////////////////////////
void G4UIterminal::ExitHelp()
/////////////////////////////
{
char temp[100];
G4cin.getline( temp, 100 );
G4cin.getline(temp, 100);
}
+284
View File
@@ -0,0 +1,284 @@
// This code implementation is the intellectual property of
// 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: G4VUIshell.cc,v 1.2 2000/06/14 03:19:00 asaim Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "G4UImanager.hh"
#include "G4UIcommand.hh"
#include "G4UIcommandTree.hh"
#include "G4StateManager.hh"
#include "G4UIcommandStatus.hh"
#include "G4VUIshell.hh"
#include "G4UIArrayString.hh"
// terminal color string
static const G4String strESC= '\033';
static const G4String TermColorString[8] ={
strESC+"[30m", strESC+"[31m", strESC+"[32m", strESC+"[33m",
strESC+"[34m", strESC+"[35m", strESC+"[36m", strESC+"[37m"
};
///////////////////////////////////////////////////////////////////
G4VUIshell::G4VUIshell(const G4String& prompt)
: promptSetting(prompt), promptString(""), nColumn(80),
lsColorFlag(FALSE), directoryColor(BLACK), commandColor(BLACK),
currentCommandDir("/")
///////////////////////////////////////////////////////////////////
{
}
/////////////////////////
G4VUIshell::~G4VUIshell()
/////////////////////////
{
}
/////////////////////////////
void G4VUIshell::MakePrompt()
/////////////////////////////
{
if(promptSetting.length()<=1) {
promptString= promptSetting;
return;
}
promptString="";
G4int i;
for(i=0; i<promptSetting.length()-1; i++){
if(promptSetting[i]=='%'){
switch (promptSetting[i+1]) {
case 's': // current application status
{
G4StateManager* statM= G4StateManager::GetStateManager();
G4String stateStr= statM-> GetStateString(statM->GetCurrentState());
promptString.append(stateStr);
i++;
}
break;
case '/': // current working directory
promptString.append(currentCommandDir);
i++;
break;
default:
promptString.append(G4String(promptSetting[i]));
break;
}
} else {
promptString.append(G4String(promptSetting[i]));
}
}
// append last chaacter
if(i == promptSetting.length()-1)
promptString.append(G4String(promptSetting[i]));
}
// --------------------------------------------------------------------
// G4command operations
// --------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////
G4UIcommandTree* G4VUIshell::GetCommandTree(const G4String& input) const
////////////////////////////////////////////////////////////////////////
{
G4UImanager* UI= G4UImanager::GetUIpointer();
G4UIcommandTree* cmdTree= UI-> GetTree(); // root tree
G4String absPath= input; // G4String::strip() CONST !!
absPath= GetAbsCommandDirPath(absPath.strip(G4String::both));
// parsing absolute path ...
if(absPath.length()==0) return NULL;
if(absPath[absPath.length()-1] != '/') return NULL; // error??
if(absPath=="/") return cmdTree;
for(G4int indx=1; indx<absPath.length()-1; ) {
G4int jslash= absPath.index("/", indx); // search index begin with "/"
if(jslash != G4String::npos) {
if(cmdTree != NULL)
cmdTree= cmdTree-> GetTree(absPath(0,jslash+1));
}
indx= jslash+1;
}
if(cmdTree == NULL) return NULL;
else return cmdTree;
}
//////////////////////////////////////////////////////////////////////
G4String G4VUIshell::GetAbsCommandDirPath(const G4String& apath) const
//////////////////////////////////////////////////////////////////////
{
if(apath.empty()) return apath; // null string
// if "apath" does not start with "/",
// then it is treared as relative path
G4String bpath= apath;
if(apath[0] != '/') bpath= currentCommandDir + apath;
// parsing...
G4String absPath= "/";
for(G4int indx=1; indx<=bpath.length()-1; ) {
G4int jslash= bpath.index("/", indx); // search index begin with "/"
if(jslash != G4String::npos) {
if(bpath(indx,jslash-indx) == ".."){ // directory up
if(absPath.length() >=1) {
absPath.remove(absPath.length()-1); // remove last "/"
G4int jpre= absPath.last('/');
if(jpre != G4String::npos) absPath.remove(jpre+1);
}
} else if(bpath(indx,jslash-indx) == "."){ // nothing to do
} else { // add
if( !(jslash==indx && bpath(indx)=='/') ) // truncate "////"
absPath+= bpath(indx, jslash-indx+1);
// better to be check directory existence. (it costs!)
}
} else { // directory ONLY (ignore non-"/" terminated string)
}
indx= jslash+1;
}
return absPath;
}
////////////////////////////////////////////////////////////////////
G4String G4VUIshell::GetCommandPathTail(const G4String& apath) const
////////////////////////////////////////////////////////////////////
{ // xxx/xxx/zzz -> zzz, trancate /// -> /
if(apath.empty()) return apath;
G4int lstr= apath.length();
// for trancating "/"
G4bool Qsla= FALSE;
if(apath[lstr-1]=='/') Qsla= TRUE;
// searching last '/' from tail
G4int indx= -1;
for(G4int i=lstr-1; i>=0; i--) {
if(Qsla && apath[i]!='/') Qsla= FALSE; // break "/" flag!!
if(apath[i]=='/' && !Qsla) {
indx= i;
break;
}
}
if(indx==-1) return apath; // not found
if(indx==0 && lstr==1) { // "/"
G4String nullStr;
return nullStr;
} else {
//G4String newPath= apath(indx+1,lstr-indx-1);
G4String newPath= apath;
newPath= newPath(indx+1,lstr-indx-1);
return newPath;
}
}
// --------------------------------------------------------------------
// shell commands
// --------------------------------------------------------------------
/////////////////////////////////////////////////////////////
void G4VUIshell::ListCommand(const G4String& dir,
const G4String& candidate) const
/////////////////////////////////////////////////////////////
{
// specified directpry
G4String input= dir; // ...
input= input.strip(G4String::both);
// command tree of "user specified directory"
G4String vpath= currentCommandDir;
G4String vcmd;
G4int len= input.length();
if(! input.empty()) {
G4int indx= -1;
for(G4int i=len-1; i>=0; i--) { // search last '/'
if(input[i]=='/') {
indx= i;
break;
}
}
// get abs. path
if(indx != -1) vpath= GetAbsCommandDirPath(input(0,indx+1));
if(!(indx==0 && len==1)) vcmd= input(indx+1,len-indx-1); // care for "/"
}
// check "vcmd" is directory?
G4String inputpath= vpath+vcmd;
if(! vcmd.empty()){
G4String tmpstr= inputpath + "/";
if(GetCommandTree(tmpstr) != NULL) {
vpath= tmpstr;
vcmd= "";
}
}
// check "vpath" directory exists?
G4UIcommandTree* atree= GetCommandTree(vpath);
if(atree == NULL) {
G4cout << "<" << input << ">: No such directory" << G4endl;
return;
}
// list matched directories/commands
G4String stream;
G4bool isMatch= FALSE;
G4int Ndir= atree-> GetTreeEntry();
G4int Ncmd= atree-> GetCommandEntry();
if(Ndir==0 && Ncmd==0) return; // no contents
// directory ...
for(G4int idir=1; idir<=Ndir; idir++) {
if(idir==1 && lsColorFlag) stream+= TermColorString[directoryColor];
G4String fpdir= atree-> GetTree(idir)-> GetPathName();
// matching test
if(candidate.empty()) { // list all
if(vcmd=="" || fpdir==inputpath) {
stream+= GetCommandPathTail(fpdir); stream+= " ";
isMatch= TRUE;
}
} else { // list only matched with candidate
if( fpdir.index(candidate, 0) == 0) {
stream+= GetCommandPathTail(fpdir); stream+= " ";
}
}
}
// command ...
for(G4int icmd=1; icmd<=Ncmd; icmd++){
if(icmd==1 && lsColorFlag) stream+= TermColorString[commandColor];
G4String fpcmd= atree-> GetPathName() +
atree-> GetCommand(icmd) -> GetCommandName();
// matching test
if(candidate.empty()) { // list all
if(vcmd=="" || fpcmd==inputpath) {
stream+= GetCommandPathTail(fpcmd); stream+= "* ";
isMatch= TRUE;
}
} else { // list only matched with candidate
if( fpcmd.index(candidate, 0) == 0) {
stream+= GetCommandPathTail(fpcmd); stream+= "* ";
}
}
}
// waring : not matched
if(!isMatch && candidate.empty())
G4cout << "<" << input
<< ">: No such directory or command" << G4std::flush;
// display
G4UIArrayString arrayString(stream);
arrayString.Show(nColumn);
}
+2 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.1 1999/01/07 16:09:36 gunter Exp $
# $Id: GNUmakefile,v 1.2 2000/06/21 17:43:37 johna Exp $
# -------------------------------------------------------------
# GNUmakefile for interfaces/common library. John Allison, 6/7/98.
@@ -9,6 +9,7 @@ ifndef G4INSTALL
endif
include $(G4INSTALL)/config/architecture.gmk
include $(G4INSTALL)/config/G4VIS_BUILD.gmk
include $(G4INSTALL)/config/G4UI_BUILD.gmk
include $(G4INSTALL)/config/interactivity.gmk
@@ -26,6 +26,7 @@ private:
G4UIdirectory* interactorDirectory;
G4UIcommand* addMenu;
G4UIcommand* addButton;
G4UIcommand* sys;
};
#endif
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VBasicShell.hh,v 1.4.4.1 1999/12/07 20:49:09 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4VBasicShell.hh,v 1.5 1999/12/15 14:50:47 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#ifndef G4VBasicShell_H
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VInteractorManager.hh,v 1.5.4.1 1999/12/07 20:49:10 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4VInteractorManager.hh,v 1.6 1999/12/15 14:50:47 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// G.Barrand
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Win32.hh,v 1.4.4.1 1999/12/07 20:49:10 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4Win32.hh,v 1.5 1999/12/15 14:50:47 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// To unify Windows message treatment between
// G4/interfaces Windows sessions and G4/visualizations Windows drivers.
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Xt.hh,v 1.3.4.1 1999/12/07 20:49:10 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4Xt.hh,v 1.4 1999/12/15 14:50:47 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// To unify X11 event treatment between
// G4/interfaces Xt sessions and G4/visualizations Xt drivers.
@@ -28,11 +28,11 @@ G4InteractorMessenger::G4InteractorMessenger (
G4UIparameter* parameter;
interactorDirectory = new G4UIdirectory("/interactor/");
interactorDirectory = new G4UIdirectory("/gui/");
interactorDirectory->SetGuidance("UI interactors commands.");
// /interactor/addMenu :
addMenu = new G4UIcommand("/interactor/addMenu",this);
// /gui/addMenu :
addMenu = new G4UIcommand("/gui/addMenu",this);
addMenu->SetGuidance("Add a menu to menu bar.");
parameter = new G4UIparameter("Name",'s',false);
parameter->SetDefaultValue("dummy");
@@ -41,8 +41,8 @@ G4InteractorMessenger::G4InteractorMessenger (
parameter->SetDefaultValue("dummy");
addMenu->SetParameter (parameter);
// /interactor/addButton :
addButton = new G4UIcommand("/interactor/addButton",this);
// /gui/addButton :
addButton = new G4UIcommand("/gui/addButton",this);
addButton->SetGuidance("Add a button to menu.");
parameter = new G4UIparameter("Menu",'s',false);
parameter->SetDefaultValue("dummy");
@@ -54,6 +54,13 @@ G4InteractorMessenger::G4InteractorMessenger (
parameter->SetDefaultValue("");
addButton->SetParameter (parameter);
// /gui/system :
sys = new G4UIcommand("/gui/system",this);
sys->SetGuidance("Send a command to the system.");
parameter = new G4UIparameter("Command",'s',false);
parameter->SetDefaultValue("");
sys->SetParameter (parameter);
}
G4InteractorMessenger::~G4InteractorMessenger()
@@ -75,6 +82,8 @@ void G4InteractorMessenger::SetNewValue (
session->AddMenu((const char*)params[0],(const char*)params[1]);
} else if(command==addButton) {
session->AddButton((const char*)params[0],(const char*)params[1],(const char*)params[2]);
} else if(command==sys) {
system((const char*)params[0]);
}
}
delete [] params;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VBasicShell.cc,v 1.5.4.1.2.5 1999/12/14 09:16:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4VBasicShell.cc,v 1.6 1999/12/15 14:50:47 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
#include "g4std/vector"
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VInteractorManager.cc,v 1.7.4.1.2.3 1999/12/15 11:43:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4VInteractorManager.cc,v 1.8 1999/12/15 14:50:47 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// G.Barrand
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Win32.cc,v 1.4.8.1.2.1 1999/12/08 17:34:04 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4Win32.cc,v 1.5 1999/12/15 14:50:47 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// G.Barrand
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Xt.cc,v 1.4.6.1.2.1 1999/12/08 17:34:04 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4Xt.cc,v 1.5 1999/12/15 14:50:47 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// G.Barrand