Index: trunk/source/intercoms/GNUmakefile
===================================================================
--- trunk/source/intercoms/GNUmakefile	(revision 821)
+++ trunk/source/intercoms/GNUmakefile	(revision 821)
@@ -0,0 +1,25 @@
+# $Id: GNUmakefile,v 1.2 2004/06/01 15:36:48 gcosmo Exp $
+# -------------------------------------------------------------
+# GNUmakefile for intercoms library.  Gabriele Cosmo, 11/11/96.
+# -------------------------------------------------------------
+
+name := G4intercoms
+
+ifndef G4INSTALL
+  G4INSTALL = ../..
+endif
+
+GLOBLIBS = libG4global.lib
+
+include $(G4INSTALL)/config/architecture.gmk
+
+CPPFLAGS += -I$(G4BASE)/global/management/include \
+            -I$(G4BASE)/global/HEPRandom/include \
+            -I$(G4BASE)/global/HEPGeometry/include
+
+include $(G4INSTALL)/config/common.gmk
+
+.PHONY: global
+ 
+global: lib
+
Index: trunk/source/intercoms/History
===================================================================
--- trunk/source/intercoms/History	(revision 821)
+++ trunk/source/intercoms/History	(revision 821)
@@ -0,0 +1,383 @@
+$Id: History,v 1.70 2007/08/10 09:47:43 kmura Exp $
+-------------------------------------------------------------------
+
+     =========================================================
+     Geant4 - an Object-Oriented Toolkit for Simulation in HEP
+     =========================================================
+
+                      Category History file
+                      ---------------------
+This file should be used by G4 developers and category coordinators
+to briefly summarize all major modifications introduced in the code
+and keep track of all category-tags.
+It DOES NOT substitute the  CVS log-message one should put at every
+committal in the CVS repository !
+
+     ----------------------------------------------------------
+     * Reverse chronological order (last date on top), please *
+     ----------------------------------------------------------
+
+August 10, 2007 K.Murakami (intercoms-V09-00-01)
+- G4UIbatch.cc : fixed the problem on 32bit-Linux.
+
+July 16, 2007 K.Murakami (intercoms-V09-00-00)
+- G4UImanager.cc : a bug fixed. (invalid returned object)
+- G4UIbatch.cc : completely revised.
+  * bug fixed for the treatment of the last line
+  * add support for continued line by \, _
+  * string after '#' is treated as comment
+  * white spaces at the head of a line are allowed. 
+
+June 6, 2007, M.Asai
+- Introducing /control/getEnv and /control/echo commands.
+
+November 3, 2006, M.Verderi (intercoms-V08-01-01)
+- Added missing forward declaration of G4VPhysicalVolume in
+  G4VFlavoredParallelWorld header.
+
+October 17, 2006, J.Allison (intercoms-V08-01-00)
+- Extended G4UImanager::Loop to handle negative increments.
+
+November 9, 2005  Gabriele Cosmo (intercoms-V07-01-03)
+- Removed inclusion of <strstream> from G4UImessenger.hh.
+- The tag coworks with: run-V07-01-05, radioactive_decay-V07-01-00.
+
+October 26, 2005  Koichi Murakami (intercoms-V07-01-02)
+- Migration from strstream to sstream
+
+October 20, 2005, Joseph Perl (intercoms-V07-01-01)
+- Tag to co-work with vis-V07-01-05.
+
+October 17, 2005 Jane Tinslay
+- intercoms->graphics_reps migration for G4VGraphicsScene and G4VVisManager
+
+May 19, 2005, M.Asai (intercoms-V07-00-02)
+- G4UIbatch is modified so that it now aborts the execution of the macro file
+  (and any other parent macro files which issued this macro file) if a coomand
+  in the macro file cannot be executed, instead of ignoring this particular
+  command.
+
+May 3rd, 2005, J.Allison (intercoms-V07-00-01)
+- Completed migration to AddSolid.
+- G4VVisManager.hh: Improved description (introduced G4VisExecutive).
+- Made /units/list available in any G4 state.
+
+Jan 27, 2005, J.Allison (intercoms-V07-00-00, needed for vis-V07-00-01)
+- Interim tag for migration from AddThis to AddSolid and AddCompound.
+- G4VGraphicsScene: introduced new names.  Old methods call new methods
+  as interim solution.
+- G4VVisManager::Draw(const G4VHit&):
+  G4VVisManager::Draw(const G4VTrajectory&,...):
+  Removed argument: objectTransformation = G4Transform3D::Identity.
+
+Jun 7, 2004, G.Cosmo (intercoms-V06-01-02)
+- GNUmakefile: added definition of GLOBLIBS for DLLs support on Windows.
+
+May 16, 2004, M.Asai (intercoms-V06-01-01)
+- Introducing utility methods ConvertToStringWithBestUnit() and
+  ConvertToStringWithDefaultUnit() for command classes taking a unit parameter.
+
+May 16, 2004, M.Asai (intercoms-V06-01-00)
+- Introducing static methods in G4UIcommand class for conversion between
+  a string and a value. Some implementation of derived classes are modified
+  accordingly. 
+
+Jun 07, 2003, G.Cosmo (intercoms-V05-01-02)
+- G4UItokenNum.hh: corrected implementation of operator=().
+
+Jun 04, 2003, G.Cosmo (intercoms-V05-01-01)
+- G4UItokenNum.hh: fixed longstanding bug in the definition of the
+  struct "yystype": defined operator= and copy-constructor, defined
+  default constructor with default initialisation of members.
+  The fix makes happy Valgrind, concerning the usage of uninitialised
+  values.
+
+May 21, 2003, M.Asai (intercoms-V05-01-00)
+- Clean up unused variables appeared in arguments.
+
+Jan 20, 2003, J.Allison (intercoms-V05-00-00, co-works vis-V05-00-00)
+- Added G4VVisManager::Draw methods for hits and trajectories.
+
+Dec 4, 2002, M.Asai (intercoms-V04-01-04, intercoms-V04-01-05)
+- Migration to new G4ApplicationState.
+
+Nov 27, 2002, M.Asai (intercoms-V04-01-03)
+- Fix memory leak in G4UIcommand.hh.
+
+Nov 20, 2002, G.Cosmo (intercoms-V04-01-02)
+- Patched access to public static data in G4VGlobalFastSimulationManager
+  and G4VVisManager. Added static accessors to be used in the kernel to
+  allow porting on Windows DLLs.
+
+Nov 01, 2002, M.Asai (intercoms-V04-01-01)
+- Tagged for Geant4 5.0
+
+Oct 29, 2002, M.Asai
+- Fixed uninitialized data member in G4UIcommand.cc
+
+Oct 17, 2002, J.Allison (intercoms-V04-01-00 with vis-V04-01-02)
+- Added two new pure virtual functions to G4VGraphicsScene:
+    AddThis(const G4VTrajectory&)
+    AddThis(const G4VHit&)
+
+Jun 7, 2002, M.Asai (intercoms-V04-00-04)
+- Fix for a warning message in G4UIbatch.
+
+May 15, 2002, M.Asai (intercoms-V04-00-03)
+- Limit number of stored command string. (improvements)
+
+May 14, 2002, M.Asai (intercoms-V04-00-02)
+- Limit number of stored command string.
+
+May 3, 2002, M.Asai (intercoms-V04-00-01)
+- Recover G4UImanager::ApplyCommand(G4String) to accept + operator
+
+Apr 26, 2002, M.Asai (intercoms-V04-00-00)
+- Eliminate naive G4String type arguments
+ Modified classes :
+  G4UIparameter G4UImanager G4UIbatch G4UIaliasList G4UIcmdWithAnInteger
+  G4UIcmdWithADoubleAndUnit G4UIcmdWithADouble G4UIcmdWithABool
+  G4UIcmdWith3VectorAndUnit G4UIcmdWith3Vector G4UIcommand G4UIcommandTree
+
+Nov 23, 2001, M.Asai (intercoms-V03-02-15)
+- Fix a problem with a command which has doubled slash.
+
+Oct 23, 2001, G.Cosmo (intercoms-V03-02-14)
+- Restored inclusion of G4Tokenizer.hh for removal of STLinterface module.
+  Files: G4UImanager.cc, G4UIcommand.cc and G4UIparameter.cc.
+
+Oct 12, 2001, M.Asai (intercoms-V03-02-13)
+- Rename method in G4UIcommandTree to avoid confliction.
+- Temporarly replaced inclusion of G4Tokenizer.hh with old RW wrapper. (G.Cosmo)
+- Replaced int/double with G4int/G4double wherever needed. (G.Cosmo)
+
+Oct 11, 2001, G.Cosmo (intercoms-V03-02-12)
+- Replaced inclusions of ctoken.h with G4Tokenizer.hh in
+  G4UImanager[.hh.cc], G4UIcommand.cc and G4UIparameter.cc.
+  Removed comment on RW wrappers.
+- Co-works with tag "globals-V03-02-03" where the STLInterface
+  module has been removed.
+
+Oct 10, 2001, M.Asai (intercoms-V03-02-11)
+- Change aliasing characters from "[" and "]" to "{" and "}".
+  This is required to fix the crash in hadronics test code.
+- Introducing /control/createHTML
+
+Oct 5, 2001, M.Asai (intercoms-V03-02-10)
+- Introducing Loop() and Foreach() methods.
+- Introducing three new UI commands
+    /control/shell
+    /control/foreach
+    /control/loop
+
+Oct 4, 2001, M.Asai (intercoms-V03-02-09)
+- Correction for string parameter starting with a space.
+- Recurrent variables 
+
+Oct 1, 2001, M.Asai (intercoms-V03-02-08)
+- Introducing a functionality of "shell variables".
+    New class : G4UIaliasList
+    Modified classes : G4UImanager G4UIcontrolMessenger
+
+Sep 28, 2001, M.Asai (intercoms-V03-02-07)
+- For Batch mode, comment lines are displayed only at verbose level = 2.
+
+Aug 29, 2001, M.Asai (intercoms-V03-02-06)
+- Corrections in G4UIbatch to ignore the blank line.
+
+Aug 27, 2001, M.Asai (intercoms-V03-02-05)
+- G4UIbatch now displays (G4cerr) the error message.
+  Correction according to the bug report #294.
+
+Aug 17, 2001, J.Allison (intercoms-V03-02-04)
+- Coworks with vis-V03-02-12 and greps-V03-02-02.
+- Added G4VisManager::Draw(const G4Scale&,...
+
+Aug 14, 2001, J.Allison (intercoms-V03-02-03)
+- Coworks with vis-V03-02-11 and greps-V03-02-02.
+- Moved default value of argument G4Transform3D::Identity from
+  G4VSceneHandler::BeginPrimitives to
+  G4VGraphicsScene::BeginPrimitives.
+
+July 21, 2001, J.Allison (intercoms-V03-02-02)
+- Added G4VGraphicsScene::AddPrimitive(const G4Scale&).
+
+July 18, 2001, M.Asai (intercoms-V03-02-01)
+- Added a feature of suppressing program abortion due to G4Exception
+  affected files : G4UIcontrolMessenger.hh G4UIcontrolMessenger.cc
+- This co-works with global-V03-02-01
+
+July 17, 2001, J.Allison (intercoms-V03-02-00)
+- Fixed parsing of quoted (") tokens in current value for null or defaulted
+  parameters in loop over previous parameters in G4UIcommand::DoIt().
+
+May 18, 2001, G.Cosmo (intercoms-V03-01-00)
+- Cleared pedantic warnings detected in Linux-g++ with ISO/ANSI setup.
+
+Mar 8, 2001, G.Cosmo (intercoms-V03-00-02)
+- G4UIcommand.cc: replaced calls to entries() with size(), according
+  to migration to STL vectors for G4UnitsTable and related in tag
+  "global-V03-00-07".
+
+Feb 8, 2001, M.Asai (intercoms-V03-00-01)
+- Migration to STL vector classes
+  affected classes :
+./intercoms/include/G4UIcommand.hh
+./intercoms/include/G4UIcommandTree.hh
+./intercoms/include/G4UImanager.hh
+./intercoms/src/G4UIcommand.cc
+./intercoms/src/G4UIcommandTree.cc
+./intercoms/src/G4UImanager.cc
+
+Jul 26, 00, M.Asai (tag intercoms-V02-00-01)
+- Retagging with removing G4StateManager, G4VStateDependent and G4ApplicationState
+  classes.
+
+Jul 22, 00, M.Asai (tag intercoms-V02-00-00)
+- Making G4UImanager as a state dependent class.
+- Remove G4StateManager and G4VStateDependent classes. They are now in
+  source/global/management.
+
+May 18, 00, J.Allison
+- Small spelling correction in class description of G4VGraphicsScene.hh.
+
+Feb 14, 00, M.Asai (tag intercoms-V01-00-00)
+- Put "const" to "char *" arguments in G4UImanager
+
+Nov 23, 99, J.Allison (tag intercoms-V00-01-02)
+- Tagged changes for Software Reference Manual on behalf of Makoto Asai.
+
+Nov 4, 99, M.Asai (tag intercoms-V00-01-01)
+- G4UImanager.cc is updated for G4cout modification.
+- Comments are enriched for software reference manual.
+
+Oct 26th, 99 J.Allison
+- Prepared G4VVisManager.hh and G4VGraphicsScene.hh for Software
+  Reference Manual.
+
+Oct 4th, 99 J.Allison (tag intercoms-V00-01-00)
+- Augmented G4VGraphicsScene to include AddPrimitive methods for
+  G4Polyline, G4Text, G4Circle, G4Square, G4Polymarker, G4Polyhedron
+  and G4NURBS.
+
+May 19th, 99 J.Allison (tag intercoms-01-00-05)
+- Protected G4UIcommand.cc with if (aToken.length()>0...
+
+May 19th, 99 J.Allison (tag intercoms-01-00-04)
+- Improvements suggested by Code Wizard in G4VVisManager.
+
+May 7th, 99 J.Allison (tag intercoms-01-00-03)
+- Added newVal.resize( parameter.entries() ) to G4UIcommand::SetParameter.
+
+Apr 28, 99 J.Allison (tag intercoms-01-00-02)
+- Moved G4VVisManager and G4VGraphicsScene from graphics_reps.
+
+Paulo Mora de Freitas (tag intercoms-01-00-01)
+- Added abstract interface G4VFlavoredParallelWorld and
+  G4VGlobalFastSimulationManager so we can decouple vis from parametrisation.
+
+Dec 03, 98 J.Allison (tag intercoms-00-04-04)
+- Protected G4UImanager::SetCoutDestination with #ifdef G4STREAM.
+
+Dec 02, 98 M.Asai (tag intercoms-00-04-03)
+- G4UnitsMessenger is constructed/destructed by G4UImanager.
+
+Nov 27, 98 M.Asai (tag intercoms-00-04-02)
+- G4UnitsMessenger has been inported from global/management to avoid a loop dependency.
+
+Nov 25, 98 J.Allison (tag intercoms-00-04-01)
+- Allowed quotation-mark-enclosed blank-embedded parameters in GetCurrentValue.
+- "Cosmetic" change to G4UIparameter (M.Asai).
+
+Nov 05, 98 M.Asai (tag intercoms-00-03-07)
+- Move G4strstreambuf.hh to global category to avoid a loop dependency (M.Nagamatsu)
+  affected files are G4UImanager.hh G4UImanager.cc, G4UIsession.hh.
+
+Oct 26, 98 M.Asai (tag intercoms-00-03-06)
+- Add SetCoutDestination(NULL) to the constructor and destructor of G4UImanager.
+
+Oct 20, 98 M.Asai (tag intercoms-00-03-05)
+- Change static methods in G4UIcommand which are for unit conversion from protected
+  to public.
+
+Oct 13, 98 M.Asai (tag intercoms-00-03-04)
+- Interoducing a concrete implementation of G4cout/G4cerr (M.Nagamatsu).
+   affected files : include/G4UImanager.hh G4strstreambuf.hh
+                    src/G4UImanager.cc G4UIsession.cc
+
+Oct 01, 98 M.Asai (tag intercoms-00-03-03)
+- Introducing a new UI command named "manual".
+
+Sep 27, 98 M.Asai (tag intercoms-00-03-02)
+- Fixes a bug in G4UIparameter. This bug caused a trouble of range
+ checking *only* for the parameter(s) atouched to the G4UIcommand
+ base class objects.
+
+Sep 25, 98 M.Asai (tag intercoms-00-03-01)
+- Minor modification in G4UIcommand.cc.
+- "DeregisterDependent()" method is implemented in G4StateManager and
+  this method is invoked by the destructor of G4VStateDependent base class.
+
+Aug 11, 98 M.Asai (tag intercoms-00-02-01)
+- G4UIcommand.cc corresponds to "string with blanks".
+
+July 15, 98 M.Asai (tag intercoms-00-01-03)
+
+July 13, 98 M.Asai (tag intercoms-00-01-02)
+- Bug in G4UIcommand.hh is fixed.
+
+July 4, 98 <.Asai (tag intercoms-00-01-01)
+- Ready for the beta release.
+
+June 30, 98 M.Asai (tag intercoms-00-07-01)
+- Debug G4UIdirectory.cc for protecting against missing "/" at the tail.
+
+June 10, 98 M.Asai
+- Introducing more methods in G4UIcommand, G4UIcmdWithADoubleAndUnit,
+G4UIcmdWith3VectorAndUnit with the new G4UnitsTable
+- Tagged as intercoms-00-06-02
+
+June 8, 98 M.Asai
+- Introducing new methods in G4UIcommand, G4UIcmdWithADoubleAndUnit,
+G4UIcmdWith3VectorAndUnit with the new G4UnitsTable
+- Tagged as intercoms-00-06-01
+
+April 21, 98 M.Asai
+- G5ApplicationState.hh, G4StateManager.h and .cc, G4VStateDependent.hh
+  and .cc are moved from "globals/management".
+- Tagged as intercoms-00-05-03.
+
+April 20, 98 M.Asai
+- tagged intercoms-00-05-02.
+
+April 9, 98 G.Cosmo
+- Porting on DEC-cxx 6.0.
+  Removed meaningless usage of "const" qualifier from functions
+  return type for basic types by value. Modified files:
+  G4UIcommand.hh, G4UIcommandTree.hh, G4UIparameter.hh
+
+April 6, 98 M.Nagamatu
+- added getRange() to G4UIcommand.hh
+
+March 27, 98 M.Asai
+- remove redandant constructors/methods from
+ G4UIparameter, G4UIcommand, G4UIcmd***
+- tagged intercoms-00-05-01
+
+March 2, 98 S.Sadilov
+- fix include <strstrea.h> in G4UIcommand.cc for WinNT
+
+February 18, 98  John Allison
+- made G4UIcommand::valueOf a static member function.
+- tagged intercoms-00-04-01
+
+February 3, 98 M.Asai - (intercoms-00-03-02)
+- Debugged : G4UImanager.cc
+- Tagged as intercoms-00-03-02
+
+January 29, 98 M.Asai - (intercoms-00-03-01)
+- Tagged as intercoms-00-03-01
+
+December 19, 97 G. Cosmo - (alpha03)
+- Created.
+
Index: trunk/source/intercoms/include/G4UIaliasList.hh
===================================================================
--- trunk/source/intercoms/include/G4UIaliasList.hh	(revision 821)
+++ trunk/source/intercoms/include/G4UIaliasList.hh	(revision 821)
@@ -0,0 +1,71 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIaliasList.hh,v 1.6 2006/06/29 19:07:42 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+
+#ifndef G4UIaliasList_h
+#define G4UIaliasList_h 1
+
+
+#include "globals.hh"
+#include <vector>
+
+// class description:
+//
+//  This class is exclusively used by G4UImanager for handling the
+// alias list.
+// 
+
+class G4UIaliasList 
+{
+  public:
+      G4UIaliasList();
+      ~G4UIaliasList();
+
+  private:
+      G4int operator==(const G4UIaliasList &right) const;
+      G4int operator!=(const G4UIaliasList &right) const;
+
+  public:
+      void RemoveAlias(const char* aliasName);
+      void ChangeAlias(const char* aliasName, const char* aliasValue);
+      G4String* FindAlias(const char* aliasName);
+      void List();
+
+  private:
+      void AddNewAlias(const char* aliasName, const char* aliasValue);
+      G4int FindAliasID(const char* aliasName);
+
+  private:
+      std::vector<G4String*> alias;
+      std::vector<G4String*> value;
+
+};
+
+#endif
+
Index: trunk/source/intercoms/include/G4UIbatch.hh
===================================================================
--- trunk/source/intercoms/include/G4UIbatch.hh	(revision 821)
+++ trunk/source/intercoms/include/G4UIbatch.hh	(revision 821)
@@ -0,0 +1,77 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4UIbatch.hh,v 1.10 2007/07/16 10:15:12 kmura Exp $
+// GEANT4 tag $Name:  $
+//
+// ====================================================================
+//   G4UIbatch.hh
+//
+//  This is a concrete class of G4UIsession.
+//
+//  This class object is instantiated by G4UImanager at every time 
+//  when "/control/execute macro_file" command is executed.
+//  Also in the case of pure batch mode with a macro file, 
+//  this class can be used as other ordinary G4UIsession 
+//  concrete classes, i.e. SessionStart() is invoked in main().
+// ====================================================================
+#ifndef G4UI_BATCH_H
+#define G4UI_BATCH_H 1
+
+#include "G4UIsession.hh"
+#include <fstream>
+
+// ====================================================================
+//
+// class definition
+//
+// ====================================================================
+
+class G4UIbatch : public G4UIsession {
+private:
+  G4UIsession* previousSession;
+
+  std::ifstream macroStream;
+  G4bool isOpened;
+
+  //static G4bool commandFailed;
+
+  // get command from a batch script file
+  G4String ReadCommand();
+  G4int ExecCommand(const G4String& command);
+
+public:
+  G4UIbatch(const char* fileName, G4UIsession* prevSession=0);
+  //  "prevSession" must be 0 if this class is constructed
+  //  from main().
+
+  ~G4UIbatch();
+  
+  virtual G4UIsession* SessionStart();
+  virtual void PauseSessionStart(G4String Prompt);
+
+};
+
+#endif
Index: trunk/source/intercoms/include/G4UIcmdWith3Vector.hh
===================================================================
--- trunk/source/intercoms/include/G4UIcmdWith3Vector.hh	(revision 821)
+++ trunk/source/intercoms/include/G4UIcmdWith3Vector.hh	(revision 821)
@@ -0,0 +1,70 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcmdWith3Vector.hh,v 1.7 2006/06/29 19:07:47 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#ifndef G4UIcmdWith3Vector_H
+#define G4UIcmdWith3Vector_H 1
+
+#include "G4UIcommand.hh"
+#include "G4ThreeVector.hh"
+
+// class description:
+//  A concrete class of G4UIcommand. The command defined by this class
+// takes three double values.
+//  General information of G4UIcommand is given in G4UIcommand.hh.
+
+class G4UIcmdWith3Vector : public G4UIcommand
+{
+  public: // with description
+    G4UIcmdWith3Vector
+    (const char * theCommandPath,G4UImessenger * theMessenger);
+    //  Constructor. The command string with full path directory
+    // and the pointer to the messenger must be given.
+    static G4ThreeVector GetNew3VectorValue(const char* paramString);
+    //  Convert string which represents three double values to
+    // G4ThreeVector.
+    void SetParameterName(const char * theNameX,const char * theNameY,
+      const char * theNameZ,G4bool omittable,G4bool currentAsDefault=false);
+    //  Set the parameter names for three parameters. Names are used by
+    // the range checking routine.
+    //  If "omittable" is set as true, the user of this command can ommit
+    // the value(s) when he/she applies the command. If "omittable" is false,
+    // the user must supply all three values.
+    //  "currentAsDefault" flag is valid only if "omittable" is true. If this
+    // flag is true, the current values are used as the default values when the 
+    // user ommit some of the parameters. If this flag is false, the values
+    // given by the next SetDefaultValue() method are used. 
+    void SetDefaultValue(G4ThreeVector defVal);
+    //  Set the default values of the parameters. These default values are used
+    // when the user of this command ommits some of the parameter values, and
+    // "ommitable" is true and "currentAsDefault" is false.
+};
+
+#endif
Index: trunk/source/intercoms/include/G4UIcmdWith3VectorAndUnit.hh
===================================================================
--- trunk/source/intercoms/include/G4UIcmdWith3VectorAndUnit.hh	(revision 821)
+++ trunk/source/intercoms/include/G4UIcmdWith3VectorAndUnit.hh	(revision 821)
@@ -0,0 +1,103 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcmdWith3VectorAndUnit.hh,v 1.8 2006/06/29 19:07:49 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#ifndef G4UIcmdWith3VectorAndUnit_H
+#define G4UIcmdWith3VectorAndUnit_H 1
+
+#include "G4UIcommand.hh"
+#include "G4ThreeVector.hh"
+
+// class description:
+//  A concrete class of G4UIcommand. The command defined by this class
+// takes three double values and a unit.
+//  General information of G4UIcommand is given in G4UIcommand.hh.
+
+class G4UIcmdWith3VectorAndUnit : public G4UIcommand
+{
+  public: // with description
+    G4UIcmdWith3VectorAndUnit
+    (const char * theCommandPath,G4UImessenger * theMessenger);
+    //  Constructor. The command string with full path directory
+    // and the pointer to the messenger must be given.
+    static G4ThreeVector GetNew3VectorValue(const char* paramString);
+    //  Convert string which represents three double values and a unit to
+    // G4ThreeVector. Values are converted to the Geant4 internal unit.
+    static G4ThreeVector GetNew3VectorRawValue(const char* paramString);
+    //  Convert string which represents three double values and a unit to
+    // G4ThreeVector. Values are NOT converted to the Geant4 internal unit
+    // but just as the given string.
+    static G4double GetNewUnitValue(const char* paramString);
+    //  Convert the unit string to the value of the unit. "paramString"
+    // must contain three double values AND a unit string.
+    G4String ConvertToStringWithBestUnit(G4ThreeVector vec);
+    //  Convert a 3 vector value to a string of digits and unit. Best unit is
+    // chosen from the unit category of default unit (in case SetDefaultUnit()
+    //  is defined) or category defined by SetUnitCategory().
+    G4String ConvertToStringWithDefaultUnit(G4ThreeVector vec);
+    //  Convert a 3 vector value to a string of digits and unit. Best unit is
+    // chosen from the category defined by SetUnitCategory() in case default
+    // unit is not defined.
+    void SetParameterName(const char * theNameX,const char * theNameY,
+      const char * theNameZ,G4bool omittable,G4bool currentAsDefault=false);
+    //  Set the parameter names for three parameters. Names are used by
+    // the range checking routine.
+    //  If "omittable" is set as true, the user of this command can ommit
+    // the value(s) when he/she applies the command. If "omittable" is false,
+    // the user must supply all three values.
+    //  "currentAsDefault" flag is valid only if "omittable" is true. If this
+    // flag is true, the current values are used as the default values when the 
+    // user ommit some of the parameters. If this flag is false, the values
+    // given by the next SetDefaultValue() method are used.
+    void SetDefaultValue(G4ThreeVector defVal);
+    //  Set the default values of the parameters. These default values are used
+    // when the user of this command ommits some of the parameter values, and
+    // "ommitable" is true and "currentAsDefault" is false.
+    void SetUnitCategory(const char * unitCategory);
+    void SetUnitCandidates(const char * candidateList);
+    void SetDefaultUnit(const char * defUnit);
+    //  These three methods must be used alternatively.
+    //  The user cannot ommit the unit as the fourth parameter of the command if
+    // SetUnitCategory() or SetUnitCandidates() is used, while the unit defined
+    // by SetDefaultUnit() method is used as the default unit so that the user can
+    // ommits the fourth parameter.
+    //  SetUnitCategory() defines the category of the units which will be accepted.
+    // The available categories can be found in G4SystemOfUnits.hh in global category.
+    // Only the units categorized in the given category are accepted as the fourth
+    // parameter of the command.
+    //  SetUnitCandidates() defines the candidates of units. Units listed in the
+    // argument of this method must be separated by space(s). Only the units listed
+    // in the candidate list are accepted as the fourth parameter of the command.
+    //  SetDefaultUnit() defines the default unit and also it defines the category
+    // of the allowed units. Thus only the units categorized as the given default
+    // unit will be accepted.
+};
+
+#endif
Index: trunk/source/intercoms/include/G4UIcmdWithABool.hh
===================================================================
--- trunk/source/intercoms/include/G4UIcmdWithABool.hh	(revision 821)
+++ trunk/source/intercoms/include/G4UIcmdWithABool.hh	(revision 821)
@@ -0,0 +1,71 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcmdWithABool.hh,v 1.7 2006/06/29 19:07:51 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#ifndef G4UIcmdWithABool_H
+#define G4UIcmdWithABool_H 1
+
+#include "G4UIcommand.hh"
+
+// class description:
+//  A concrete class of G4UIcommand. The command defined by this class
+// takes a boolean value. Boolean value can be the following notations.
+//    TRUE : 
+//       1 t T true TRUE
+//    FALSE : 
+//       0 f F false FALSE
+//  General information of G4UIcommand is given in G4UIcommand.hh.
+
+class G4UIcmdWithABool : public G4UIcommand
+{
+  public: // with description
+    G4UIcmdWithABool
+    (const char * theCommandPath,G4UImessenger * theMessenger);
+    //  Constructor. The command string with full path directory
+    // and the pointer to the messenger must be given.
+    static G4bool GetNewBoolValue(const char* paramString);
+    //  Convert string which represents a boolean value to G4bool.
+    void SetParameterName(const char * theName,G4bool omittable,
+                          G4bool currentAsDefault=false);
+    //  Set the parameter name for a boolean parameter.
+    //  If "omittable" is set as true, the user of this command can ommit
+    // the value when he/she applies the command. If "omittable" is false,
+    // the user must supply a boolean value.
+    //  "currentAsDefault" flag is valid only if "omittable" is true. If this
+    // flag is true, the current value is used as the default value when the 
+    // user ommit the parameter. If this flag is false, the value given by the 
+    // next SetDefaultValue() method is used.
+    void SetDefaultValue(G4bool defVal);
+    //  Set the default value of the parameter. This default value is used
+    // when the user of this command ommits the parameter value, and
+    // "ommitable" is true and "currentAsDefault" is false.
+};
+
+#endif
Index: trunk/source/intercoms/include/G4UIcmdWithADouble.hh
===================================================================
--- trunk/source/intercoms/include/G4UIcmdWithADouble.hh	(revision 821)
+++ trunk/source/intercoms/include/G4UIcmdWithADouble.hh	(revision 821)
@@ -0,0 +1,67 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcmdWithADouble.hh,v 1.7 2006/06/29 19:07:54 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#ifndef G4UIcmdWithADouble_H
+#define G4UIcmdWithADouble_H 1
+
+#include "G4UIcommand.hh"
+
+// class description:
+//  A concrete class of G4UIcommand. The command defined by this class
+// takes a double value.
+//  General information of G4UIcommand is given in G4UIcommand.hh.
+
+class G4UIcmdWithADouble : public G4UIcommand
+{
+  public: // with description
+    G4UIcmdWithADouble
+    (const char * theCommandPath,G4UImessenger * theMessenger);
+    //  Constructor. The command string with full path directory
+    // and the pointer to the messenger must be given.
+    static G4double GetNewDoubleValue(const char* paramString);
+    //  Convert string which represents a double value to a double.
+    void SetParameterName(const char * theName,G4bool omittable,
+                          G4bool currentAsDefault=false);
+    //  Set the parameter name. The name is used by the range checking.
+    //  If "omittable" is set as true, the user of this command can ommit
+    // the value when he/she applies the command. If "omittable" is false,
+    // the user must supply a double value.
+    //  "currentAsDefault" flag is valid only if "omittable" is true. If this
+    // flag is true, the current value is used as the default value when the 
+    // user ommit the parameter. If this flag is false, the value given by the 
+    // next SetDefaultValue() method is used.
+    void SetDefaultValue(G4double defVal);
+    //  Set the default value of the parameter. This default value is used
+    // when the user of this command ommits the parameter value, and
+    // "ommitable" is true and "currentAsDefault" is false.
+};
+
+#endif
Index: trunk/source/intercoms/include/G4UIcmdWithADoubleAndUnit.hh
===================================================================
--- trunk/source/intercoms/include/G4UIcmdWithADoubleAndUnit.hh	(revision 821)
+++ trunk/source/intercoms/include/G4UIcmdWithADoubleAndUnit.hh	(revision 821)
@@ -0,0 +1,102 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcmdWithADoubleAndUnit.hh,v 1.8 2006/06/29 19:07:57 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#ifndef G4UIcmdWithADoubleAndUnit_H
+#define G4UIcmdWithADoubleAndUnit_H 1
+
+#include "G4UIcommand.hh"
+
+// class description:
+//  A concrete class of G4UIcommand. The command defined by this class
+// takes a double value and a unit string.
+//  General information of G4UIcommand is given in G4UIcommand.hh.
+
+class G4UIcmdWithADoubleAndUnit : public G4UIcommand
+{
+  public: // with description
+    G4UIcmdWithADoubleAndUnit
+    (const char * theCommandPath,G4UImessenger * theMessenger);
+    //  Constructor. The command string with full path directory
+    // and the pointer to the messenger must be given.    
+    static G4double GetNewDoubleValue(const char* paramString);
+    //  Convert string which represents a double value and a unit to
+    // double. Value is converted to the Geant4 internal unit.
+    static G4double GetNewDoubleRawValue(const char* paramString);
+    //  Convert string which represents a double value and a unit to
+    // double. Value is NOT converted to the Geant4 internal unit
+    // but just as the given string.
+    static G4double GetNewUnitValue(const char* paramString);
+    //  Convert the unit string to the value of the unit. "paramString"
+    // must contain a double value AND a unit string.
+    G4String ConvertToStringWithBestUnit(G4double val);
+    //  Convert a double value to a string of digits and unit. Best unit is
+    // chosen from the unit category of default unit (in case SetDefaultUnit()
+    //  is defined) or category defined by SetUnitCategory().
+    G4String ConvertToStringWithDefaultUnit(G4double val);
+    //  Convert a double value to a string of digits and unit. Best unit is
+    // chosen from the category defined by SetUnitCategory() in case default
+    // unit is not defined.
+    void SetParameterName(const char * theName,G4bool omittable,
+                          G4bool currentAsDefault=false);
+    //  Set the parameter name for double parameterxs. Name is used by
+    // the range checking routine.
+    //  If "omittable" is set as true, the user of this command can ommit
+    // the value when he/she applies the command. If "omittable" is false,
+    // the user must supply a value.
+    //  "currentAsDefault" flag is valid only if "omittable" is true. If this
+    // flag is true, the current value is used as the default value when the 
+    // user ommit the double parameter. If this flag is false, the value
+    // given by the next SetDefaultValue() method is used.
+    void SetDefaultValue(G4double defVal);
+    //  Set the default value of the parameter. This default value is used
+    // when the user of this command ommits the parameter value, and
+    // "ommitable" is true and "curreutAsDefault" is false.
+    void SetUnitCategory(const char * unitCategory);
+    void SetUnitCandidates(const char * candidateList);
+    void SetDefaultUnit(const char * defUnit);
+    //  These three methods must be used alternatively.
+    //  The user cannot ommit the unit as the second parameter of the command if
+    // SetUnitCategory() or SetUnitCandidates() is used, while the unit defined
+    // by SetDefaultUnit() method is used as the default unit so that the user can
+    // ommits the second parameter.
+    //  SetUnitCategory() defines the category of the units which will be accepted.
+    // The available categories can be found in G4SystemOfUnits.hh in global category.
+    // Only the units categorized in the given category are accepted as the second
+    // parameter of the command.
+    //  SetUnitCandidates() defines the candidates of units. Units listed in the
+    // argument of this method must be separated by space(s). Only the units listed
+    // in the candidate list are accepted as the second parameter of the command.
+    //  SetDefaultUnit() defines the default unit and also it defines the category
+    // of the allowed units. Thus only the units categorized as the given default
+    // unit will be accepted.
+};
+
+#endif
Index: trunk/source/intercoms/include/G4UIcmdWithAString.hh
===================================================================
--- trunk/source/intercoms/include/G4UIcmdWithAString.hh	(revision 821)
+++ trunk/source/intercoms/include/G4UIcmdWithAString.hh	(revision 821)
@@ -0,0 +1,69 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcmdWithAString.hh,v 1.5 2006/06/29 19:07:59 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#ifndef G4UIcmdWithAString_H
+#define G4UIcmdWithAString_H 1
+
+#include "G4UIcommand.hh"
+
+// class description:
+//  A concrete class of G4UIcommand. The command defined by this class
+// takes a string. Incase the parameter string contains space(s), it
+// must be enclosed by double-quotations (").
+//  General information of G4UIcommand is given in G4UIcommand.hh.
+
+class G4UIcmdWithAString : public G4UIcommand
+{
+  public: // with description
+    G4UIcmdWithAString
+    (const char * theCommandPath,G4UImessenger * theMessenger);
+    //  Constructor. The command string with full path directory
+    // and the pointer to the messenger must be given.
+    void SetParameterName(const char * theName,G4bool omittable,
+                          G4bool currentAsDefault=false);
+    //  Set the parameter name.
+    //  If "omittable" is set as true, the user of this command can ommit
+    // the value when he/she applies the command. If "omittable" is false,
+    // the user must supply the parameter string.
+    //  "currentAsDefault" flag is valid only if "omittable" is true. If this
+    // flag is true, the current value is used as the default value when the 
+    // user ommit the parameter. If this flag is false, the value given by the 
+    // next SetDefaultValue() method is used.
+    void SetCandidates(const char * candidateList);
+    //  Defines the candidates of the parameter string. Candidates listed in
+    // the argument must be separated by space(s).
+    void SetDefaultValue(const char * defVal);
+    //  Set the default value of the parameter. This default value is used
+    // when the user of this command ommits the parameter value, and
+    // "ommitable" is true and "curreutAsDefault" is false.
+};
+
+#endif
Index: trunk/source/intercoms/include/G4UIcmdWithAnInteger.hh
===================================================================
--- trunk/source/intercoms/include/G4UIcmdWithAnInteger.hh	(revision 821)
+++ trunk/source/intercoms/include/G4UIcmdWithAnInteger.hh	(revision 821)
@@ -0,0 +1,67 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcmdWithAnInteger.hh,v 1.7 2006/06/29 19:08:01 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#ifndef G4UIcmdWithAnInteger_H
+#define G4UIcmdWithAnInteger_H 1
+
+#include "G4UIcommand.hh"
+
+// class description:
+//  A concrete class of G4UIcommand. The command defined by this class
+// takes an integer value.
+//  General information of G4UIcommand is given in G4UIcommand.hh.
+
+class G4UIcmdWithAnInteger : public G4UIcommand
+{
+  public: // with description
+    G4UIcmdWithAnInteger
+    (const char * theCommandPath,G4UImessenger * theMessenger);
+    //  Constructor. The command string with full path directory
+    // and the pointer to the messenger must be given.
+    static G4int GetNewIntValue(const char* paramString);
+    //  Convert string which represents an integer to an integer.
+    void SetParameterName(const char * theName,G4bool omittable,
+                          G4bool currentAsDefault=false);
+    //  Set the parameter name. The name is used by the range checking.
+    //  If "omittable" is set as true, the user of this command can ommit
+    // the value when he/she applies the command. If "omittable" is false,
+    // the user must supply an integer value.
+    //  "currentAsDefault" flag is valid only if "omittable" is true. If this
+    // flag is true, the current value is used as the default value when the 
+    // user ommit the parameter. If this flag is false, the value given by the 
+    // next SetDefaultValue() method is used.
+    void SetDefaultValue(G4int defVal);
+    //  Set the default value of the parameter. This default value is used
+    // when the user of this command ommits the parameter value, and
+    // "ommitable" is true and "currentAsDefault" is false.
+};
+
+#endif
Index: trunk/source/intercoms/include/G4UIcmdWithoutParameter.hh
===================================================================
--- trunk/source/intercoms/include/G4UIcmdWithoutParameter.hh	(revision 821)
+++ trunk/source/intercoms/include/G4UIcmdWithoutParameter.hh	(revision 821)
@@ -0,0 +1,51 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcmdWithoutParameter.hh,v 1.5 2006/06/29 19:08:03 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#ifndef G4UIcmdWithoutParameter_H
+#define G4UIcmdWithoutParameter_H 1
+
+#include "G4UIcommand.hh"
+
+// class description:
+//  A concrete class of G4UIcommand. The command defined by this class
+// takes no parameter argument.
+//  General information of G4UIcommand is given in G4UIcommand.hh.
+
+class G4UIcmdWithoutParameter : public G4UIcommand
+{
+  public: // with description
+    G4UIcmdWithoutParameter
+    (const char * theCommandPath,G4UImessenger * theMessenger);
+    //  Constructor. The command string with full path directory
+    // and the pointer to the messenger must be given.
+};
+
+#endif
Index: trunk/source/intercoms/include/G4UIcommand.hh
===================================================================
--- trunk/source/intercoms/include/G4UIcommand.hh	(revision 821)
+++ trunk/source/intercoms/include/G4UIcommand.hh	(revision 821)
@@ -0,0 +1,216 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcommand.hh,v 1.15 2006/06/29 19:08:05 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+#ifndef G4UIcommand_h
+#define G4UIcommand_h 1
+
+#include "G4UIparameter.hh"
+class G4UImessenger;
+#include "globals.hh"
+#include "G4ApplicationState.hh"
+#include <vector>
+#include "G4UItokenNum.hh"
+#include "G4ThreeVector.hh"
+
+// class description:
+//  
+//  This G4UIcommand is the "concrete" base class which represents a command
+// used by Geant4 (G)UI. The user can use this class in case the parameter
+// arguments of a command are not suitable with respect to the derived command
+// classes.
+//  Some methods defined in this base class are used by the derived classes.
+//
+
+class G4UIcommand 
+{
+  public: 
+      G4UIcommand();
+  public: // with description
+      G4UIcommand(const char * theCommandPath, G4UImessenger * theMessenger);
+      //  Constructor. The command string with full path directory
+      // and the pointer to the messenger must be given.
+  public: 
+      virtual ~G4UIcommand();
+
+      G4int operator==(const G4UIcommand &right) const;
+      G4int operator!=(const G4UIcommand &right) const;
+
+      G4int DoIt(G4String parameterList);
+      G4String GetCurrentValue();
+  public: // with description
+      void AvailableForStates(G4ApplicationState s1);
+      void AvailableForStates(G4ApplicationState s1,G4ApplicationState s2);
+      void AvailableForStates(G4ApplicationState s1,G4ApplicationState s2,
+                              G4ApplicationState s3);
+      void AvailableForStates(G4ApplicationState s1,G4ApplicationState s2,
+                              G4ApplicationState s3,G4ApplicationState s4);
+      void AvailableForStates(G4ApplicationState s1,G4ApplicationState s2,
+                              G4ApplicationState s3,G4ApplicationState s4,
+                              G4ApplicationState s5);
+      //  These methods define the states where the command is available.
+      // Once one of these commands is invoked, the command application will
+      // be denied when Geant4 is NOT in the assigned states.
+  public:
+      G4bool IsAvailable();
+      virtual void List();
+
+  public: // with description
+      static G4String ConvertToString(G4bool boolVal);
+      static G4String ConvertToString(G4int intValue);
+      static G4String ConvertToString(G4double doubleValue);
+      static G4String ConvertToString(G4double doubleValue,const char* unitName);
+      static G4String ConvertToString(G4ThreeVector vec);
+      static G4String ConvertToString(G4ThreeVector vec,const char* unitName);
+      // Static methods for conversion from value(s) to a string. These methods are to be
+      // used by GetCurrentValues() methods of concrete messengers.
+
+      static G4bool ConvertToBool(const char* st);
+      static G4int ConvertToInt(const char* st);
+      static G4double ConvertToDouble(const char* st);
+      static G4double ConvertToDimensionedDouble(const char* st);
+      static G4ThreeVector ConvertTo3Vector(const char* st);
+      static G4ThreeVector ConvertToDimensioned3Vector(const char* st);
+      // Static methods for conversion from a string to a value of the returning type.
+      // These methods are to be used directly by SetNewValues() methods of concrete
+      // messengers, or GetNewXXXValue() of classes derived from this G4UIcommand class.
+
+      static G4double ValueOf(const char* unitName);
+      static G4String CategoryOf(const char* unitName);
+      static G4String UnitsList(const char* unitCategory);
+      // Static methods for unit and its category.
+
+  private:  
+      void G4UIcommandCommonConstructorCode (const char * theCommandPath);
+      G4UImessenger *messenger;
+      G4String commandPath;
+      G4String commandName;
+      G4String rangeString;
+      std::vector<G4UIparameter*> parameter;
+      std::vector<G4String> commandGuidance;
+      std::vector<G4ApplicationState> availabelStateList;
+
+  public: // with description
+      inline void SetRange(const char* rs)
+      { rangeString = rs; }
+      //  Defines the range the command parameter(s) can take.
+      //  The variable name(s) appear in the range expression must be same
+      // as the name(s) of the parameter(s).
+      //  All the C++ syntax of relational operators are allowed for the
+      // range expression.
+  public:
+      inline const G4String & GetRange() const
+      { return rangeString; };
+      inline G4int GetGuidanceEntries() const
+      { return commandGuidance.size(); }
+      inline const G4String & GetGuidanceLine(G4int i) const
+      { return commandGuidance[i]; }
+      inline const G4String & GetCommandPath() const
+      { return commandPath; }
+      inline const G4String & GetCommandName() const
+      { return commandName; }
+      inline G4int GetParameterEntries() const
+      { return parameter.size(); }
+      inline G4UIparameter * GetParameter(G4int i) const
+      { return parameter[i]; }
+      inline std::vector<G4ApplicationState>* GetStateList()
+      { return &availabelStateList; }
+  public: // with description
+      inline void SetParameter(G4UIparameter *const newParameter)
+      {
+	parameter.push_back( newParameter );
+	newVal.resize( parameter.size() );
+      }
+      //  Defines a parameter. This method is used by the derived command classes
+      // but the user can directly use this command when he/she defines a command
+      // by hem(her)self without using the derived class. For this case, the order
+      // of the parameters is the order of invoking this method.
+      inline void SetGuidance(const char * aGuidance)
+      { 
+        commandGuidance.push_back( G4String( aGuidance ) ); 
+      }
+      //  Adds a guidance line. Unlimitted number of invokation of this method is
+      // allowed. The given lines of guidance will appear for the help. The first
+      // line of the guidance will be used as the title of the command, i.e. one
+      // line list of the commands.
+  public:
+      inline const G4String GetTitle() const
+      {
+	    if(commandGuidance.size() == 0)
+	    { return G4String("...Title not available..."); }
+ 	    else
+	    { return commandGuidance[0]; }
+      }
+
+  protected:
+    G4int CheckNewValue(const char* newValue);
+
+    // --- the following is used by CheckNewValue() --------
+  private:
+    G4int TypeCheck(const char* t);
+    G4int RangeCheck(const char* t);
+    G4int IsInt(const char* str, short maxLength);
+    G4int IsDouble(const char* str);
+    G4int ExpectExponent(const char* str);
+    //  syntax nodes
+    yystype Expression( void );
+    yystype LogicalORExpression( void );
+    yystype LogicalANDExpression( void );
+    yystype EqualityExpression ( void );
+    yystype RelationalExpression( void );
+    yystype AdditiveExpression( void );
+    yystype MultiplicativeExpression( void );
+    yystype UnaryExpression( void );
+    yystype PrimaryExpression( void );
+    //  semantics routines
+    G4int Eval2( yystype arg1, G4int op, yystype arg2 );
+    G4int CompareInt( G4int arg1, G4int op, G4int arg2);
+    G4int CompareDouble( G4double arg1, G4int op, G4double arg2);
+    //  utility 
+    tokenNum Yylex( void );      // returns next token
+    unsigned IndexOf( const char* ); // returns the index of the var name
+    unsigned IsParameter( const char* ); // returns 1 or 0
+    G4int G4UIpGetc( void );      // read one char from rangeBuf
+    G4int G4UIpUngetc( G4int c );   // put back  
+    G4int Backslash( G4int c );
+    G4int Follow( G4int expect, G4int ifyes, G4int ifno );
+    G4String TokenToStr(G4int token);
+    void PrintToken(void);      // for debug
+    //  data
+    G4String rangeBuf;
+    G4int bp;                      // buffer pointer for rangeBuf
+    tokenNum token;
+    yystype yylval;
+    std::vector<yystype>  newVal;
+    G4int paramERR;
+};
+
+#endif
+
Index: trunk/source/intercoms/include/G4UIcommandStatus.hh
===================================================================
--- trunk/source/intercoms/include/G4UIcommandStatus.hh	(revision 821)
+++ trunk/source/intercoms/include/G4UIcommandStatus.hh	(revision 821)
@@ -0,0 +1,45 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcommandStatus.hh,v 1.5 2006/06/29 19:08:08 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+
+#ifndef G4UIcommandStatus_h
+#define G4UIcommandStatus_h 1
+
+enum G4UIcommandStatus
+{
+  fCommandSucceeded         =   0,
+  fCommandNotFound          = 100,
+  fIllegalApplicationState  = 200,
+  fParameterOutOfRange      = 300,
+  fParameterUnreadable      = 400,
+  fParameterOutOfCandidates = 500,
+  fAliasNotFound            = 600
+};
+
+#endif
Index: trunk/source/intercoms/include/G4UIcommandTree.hh
===================================================================
--- trunk/source/intercoms/include/G4UIcommandTree.hh	(revision 821)
+++ trunk/source/intercoms/include/G4UIcommandTree.hh	(revision 821)
@@ -0,0 +1,106 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcommandTree.hh,v 1.15 2006/06/29 19:08:11 gunter Exp $
+// GEANT4 tag $Name: geant4-09-01-patch-02 $
+//
+
+#ifndef G4UIcommandTree_h
+#define G4UIcommandTree_h 1
+
+
+#include "G4UIcommand.hh"
+#include "globals.hh"
+#include <vector>
+
+// class description:
+//
+//  This class is exclusively used by G4UImanager for handling the
+// tree structure of the commands. The user MUST NOT construct/use
+// this class object.
+
+class G4UIcommandTree 
+{
+  public:
+      G4UIcommandTree();
+      G4UIcommandTree(const char * thePathName);
+      ~G4UIcommandTree();
+      G4int operator==(const G4UIcommandTree &right) const;
+      G4int operator!=(const G4UIcommandTree &right) const;
+
+  public:
+      void AddNewCommand(G4UIcommand * newCommand);
+      void RemoveCommand(G4UIcommand * aCommand);
+      G4UIcommand * FindPath(const char* commandPath);
+      void List();
+      void ListCurrent();
+      void ListCurrentWithNum();
+      void CreateHTML();
+
+  private:
+      G4String CreateFileName(const char* pName);
+      G4String ModStr(const char* strS);
+
+      std::vector<G4UIcommand*> command;
+      std::vector<G4UIcommandTree*> tree;
+      G4UIcommand *guidance;
+      G4String pathName;
+
+  public:
+      inline const G4UIcommand * GetGuidance() const
+      { return guidance; };
+      inline const G4String GetPathName() const
+      { return pathName; };
+      inline G4int GetTreeEntry() const
+      { return tree.size(); };
+      inline G4int GetCommandEntry() const
+      { return command.size(); };
+      inline G4UIcommandTree * GetTree(G4int i)
+      { return tree[i-1]; };
+      inline G4UIcommandTree * GetTree(const char* comNameC)
+      { 
+        G4String comName = comNameC;
+        for( size_t i=0; i < tree.size(); i++)
+        {
+          if( comName == tree[i]->GetPathName() )
+          { return tree[i]; }
+        }
+        return NULL;
+      };
+      inline G4UIcommand * GetCommand(G4int i)
+      { return command[i-1]; };
+      inline const G4String GetTitle() const
+      { 
+	    if(guidance==NULL)
+	    { return G4String("...Title not available..."); }
+    	else
+	    { return guidance->GetTitle(); }
+      };
+
+};
+
+#endif
+
Index: trunk/source/intercoms/include/G4UIcontrolMessenger.hh
===================================================================
--- trunk/source/intercoms/include/G4UIcontrolMessenger.hh	(revision 821)
+++ trunk/source/intercoms/include/G4UIcontrolMessenger.hh	(revision 821)
@@ -0,0 +1,93 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcontrolMessenger.hh,v 1.12 2007/06/06 15:14:51 asaim Exp $
+// GEANT4 tag $Name:  $
+//
+
+#ifndef G4UIcontrolMessenger_h
+#define G4UIcontrolMessenger_h 1
+
+#include "G4UImessenger.hh"
+
+class G4UIdirectory;
+class G4UIcmdWithAString;
+class G4UIcmdWithAnInteger;
+class G4UIcmdWithoutParameter;
+class G4UIcommand;
+
+// class description:
+//  This class is a concrete class of G4UImessenger which defines
+// commands affecting to the G4UImanager. Commands defined by
+// this messenger are
+//   /control/ 
+//   /control/execute
+//   /control/loop
+//   /control/foreach
+//   /control/suppressAbortion
+//   /control/verbose
+//   /control/saveHistory
+//   /control/stopSavingHistory
+//   /control/alias
+//   /control/unalias
+//   /control/listAlias
+//   /control/getEnv
+//   /control/echo
+//   /control/shell
+//   /control/manual
+//   /control/createHTML
+//   /control/maximumStoredHistory
+
+class G4UIcontrolMessenger : public G4UImessenger 
+{
+  public:
+      G4UIcontrolMessenger();
+      ~G4UIcontrolMessenger();
+      void SetNewValue(G4UIcommand * command,G4String newValue);
+      G4String GetCurrentValue(G4UIcommand * command);
+
+  private:
+      G4UIdirectory * controlDirectory;
+      G4UIcmdWithAString * ExecuteCommand;
+      G4UIcmdWithAnInteger * suppressAbortionCommand;
+      G4UIcmdWithAnInteger * verboseCommand;
+      G4UIcmdWithAString * historyCommand;
+      G4UIcmdWithoutParameter * stopStoreHistoryCommand;
+      G4UIcommand * aliasCommand;
+      G4UIcmdWithAString * unaliasCommand;
+      G4UIcmdWithoutParameter * listAliasCommand;
+      G4UIcmdWithAString * getEnvCmd;
+      G4UIcmdWithAString * echoCmd;
+      G4UIcmdWithAString * shellCommand;
+      G4UIcommand * loopCommand;
+      G4UIcommand * foreachCommand;
+      G4UIcmdWithAString * ManualCommand;
+      G4UIcmdWithAString * HTMLCommand;
+      G4UIcmdWithAnInteger * maxStoredHistCommand;
+};
+
+#endif
+
Index: trunk/source/intercoms/include/G4UIdirectory.hh
===================================================================
--- trunk/source/intercoms/include/G4UIdirectory.hh	(revision 821)
+++ trunk/source/intercoms/include/G4UIdirectory.hh	(revision 821)
@@ -0,0 +1,51 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIdirectory.hh,v 1.5 2006/06/29 19:08:15 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#ifndef G4UIdirectory_H
+#define G4UIdirectory_H 1
+
+#include "G4UIcommand.hh"
+
+// class description:
+//  A concrete class of G4UIcommand. This class defines a command
+// directory which can have commands.
+//  General information of G4UIcommand is given in G4UIcommand.hh.
+
+class G4UIdirectory : public G4UIcommand
+{
+  public: // with description
+    G4UIdirectory(char * theCommandPath);
+    G4UIdirectory(const char * theCommandPath);
+    // Constructors. The argument is a full path directory which
+    // starts and ends with "/".
+};
+
+#endif
Index: trunk/source/intercoms/include/G4UImanager.hh
===================================================================
--- trunk/source/intercoms/include/G4UImanager.hh	(revision 821)
+++ trunk/source/intercoms/include/G4UImanager.hh	(revision 821)
@@ -0,0 +1,240 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UImanager.hh,v 1.21 2006/06/29 19:08:17 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+
+#ifndef G4UImanager_h
+#define G4UImanager_h 1
+
+#include "globals.hh"
+
+#include <vector>
+#include <fstream>
+#include "G4VStateDependent.hh"
+#include "G4UIcommandStatus.hh"
+class G4UIcommandTree;
+class G4UIcommand;
+class G4UIsession;
+class G4UIcontrolMessenger;
+class G4UnitsMessenger;
+class G4UIaliasList;
+
+// class description:
+//
+//  This is a singlton class which controls the command manipulation
+// and the user interface(s). The constructor of this class MUST NOT 
+// invoked by the user.
+//
+
+class G4UImanager : public G4VStateDependent
+{
+  public: // with description
+      static G4UImanager * GetUIpointer();
+      //  A static method to get the pointer to the only existing object
+      // of this class.
+
+  protected:
+      G4UImanager();
+  public:
+      ~G4UImanager();
+  private:
+      G4UImanager(const G4UImanager &right);
+      const G4UImanager & operator=(const G4UImanager &right);
+      G4int operator==(const G4UImanager &right) const;
+      G4int operator!=(const G4UImanager &right) const;
+
+  public: // with description
+      G4String GetCurrentValues(const char * aCommand);
+      //  This method returns a string which represents the current value(s)
+      // of the parameter(s) of the specified command. Null string will be
+      // returned if the given command is not defined or the command does
+      // not support the GetCurrentValues() method.
+      void AddNewCommand(G4UIcommand * newCommand);
+      //  This method register a new command.
+      void RemoveCommand(G4UIcommand * aCommand);
+      //  This command remove the registered command. After invokation of this
+      // command, that particular command cannot be applied.
+      void ExecuteMacroFile(const char * fileName);
+      //  A macro file defined by the argument will be read by G4UIbatch object.
+      void Loop(const char * macroFile,const char * variableName,
+                   G4double initialValue,G4double finalValue,G4double stepSize=1.0);
+      // Execute a macro file more than once with a loop counter.
+      void Foreach(const char * macroFile,const char * variableName,
+                                                        const char * candidates);
+      // Execute a macro file more than once with an aliased variable which takes
+      // a value in the candidate list.
+      G4int ApplyCommand(const char * aCommand);
+      G4int ApplyCommand(G4String aCommand);
+      //  A command (and parameter(s)) given
+      // by the method's argument will be applied. Zero will be returned in 
+      // case the command is successfully executed. Positive non-zero value
+      // will be returned if the command couldn't be executed. The meaning of
+      // this non-zero value is the following.
+      //   The returned number : xyy
+      //        x00 : G4CommandStatus.hh enumeration
+      //         yy : the problematic parameter (first found)
+      void StoreHistory(const char* fileName = "G4history.macro");
+      void StoreHistory(G4bool historySwitch,
+                        const char* fileName = "G4history.macro");
+      //  The executed commands will be stored in the defined file. If 
+      // "historySwitch" is false, saving will be suspended.
+      void ListCommands(const char* direc);
+      //  All commands registored under the given directory will be listed to
+      // G4cout.
+      void SetAlias(const char * aliasLine);
+      //  Define an alias. The first word of "aliasLine" string is the
+      // alias name and the remaining word(s) is(are) string value
+      // to be aliased.
+      void RemoveAlias(const char * aliasName);
+      //  Remove the defined alias.
+      void ListAlias();
+      //  Print all aliases.
+      G4String SolveAlias(const char* aCmd);
+      //  Convert a command string which contains alias(es).
+      void CreateHTML(const char* dir = "/");
+      //  Generate HTML files for defined UI commands
+
+
+  public: 
+      void LoopS(const char* valueList);
+      void ForeachS(const char* valueList);
+      //  These methods are used by G4UIcontrolMessenger to use Loop() and Foreach() methods.
+      virtual G4bool Notify(G4ApplicationState requestedState);
+      //  This method is exclusively invoked by G4StateManager and the user
+      // must not use this method.
+ 
+  private:
+      void PauseSession(const char* msg);
+      void CreateMessenger();
+      G4UIcommandTree* FindDirectory(const char* dirName);
+
+  //public:
+  // following three methods will be removed quite soon.
+  //    void Interact();
+  //    void Interact(const char * promptCharacters);
+
+  private:
+      static G4UImanager * fUImanager;
+      static G4bool fUImanagerHasBeenKilled;
+      G4UIcommandTree * treeTop;
+      G4UIsession * session;
+      G4UIcontrolMessenger * UImessenger;
+      G4UnitsMessenger * UnitsMessenger;
+      G4String savedParameters;
+      G4UIcommand * savedCommand;
+      G4int verboseLevel;
+      std::ofstream historyFile;
+      G4bool saveHistory;
+      std::vector<G4String> histVec;
+      G4UIaliasList* aliasList;
+      G4int maxHistSize;
+      G4bool pauseAtBeginOfEvent;
+      G4bool pauseAtEndOfEvent;
+
+
+  public: // with description
+      G4String GetCurrentStringValue(const char * aCommand, 
+	    G4int parameterNumber=1, G4bool reGet=true);
+      G4int GetCurrentIntValue(const char * aCommand, 
+	    G4int parameterNumber=1, G4bool reGet=true);
+      G4double GetCurrentDoubleValue(const char * aCommand,
+	    G4int parameterNumber=1, G4bool reGet=true);
+      G4String GetCurrentStringValue(const char * aCommand, 
+	    const char * aParameterName, G4bool reGet=true);
+      G4int GetCurrentIntValue(const char * aCommand, 
+	    const char * aParameterName, G4bool reGet=true);
+      G4double GetCurrentDoubleValue(const char * aCommand,
+	    const char * aParameterName, G4bool reGet=true);
+      //  These six methods returns the current value of a parameter of the
+      // given command. For the first three methods, the ordering number of
+      // the parameter (1 is the first parameter) can be given, whereas,
+      // other three methods can give the parameter name.
+      //  If "reGet" is true, actual request of returning the current value
+      // will be sent to the corresponding messenger, while, if it is false,
+      // the value stored in G4Umanager will be used. The later case is valid
+      // for the sequential invokation for the same command.
+
+      inline void SetPauseAtBeginOfEvent(G4bool vl)
+      { pauseAtBeginOfEvent = vl; }
+      inline G4bool GetPauseAtBeginOfEvent() const
+      { return pauseAtBeginOfEvent; }
+      inline void SetPauseAtEndOfEvent(G4bool vl)
+      { pauseAtEndOfEvent = vl; }
+      inline G4bool GetPauseAtEndOfEvent() const
+      { return pauseAtEndOfEvent; }
+      //  If the boolean flags are true, Pause() method of G4StateManager is invoked
+      // at the very begining (before generating a G4Event object) or at the end of
+      // each event. So that, in case a (G)UI session is defined, the user can interact.
+
+
+  public:
+      inline G4UIcommandTree * GetTree() const
+      { return treeTop; }
+      inline G4UIsession * GetSession() const
+      { return session; }
+  public: // with description
+      inline void SetSession(G4UIsession *const value)
+      { session = value; }
+      //  This method defines the active (G)UI session.
+     void SetCoutDestination(G4UIsession *const value);
+     //  This method defines the destination of G4cout/G4cerr stream.
+     // For usual cases, this method will be invoked by a concrete
+     // (G)UI session class object and thus the user needs not to invoke
+     // this method by him(her)self.
+
+  public:
+      inline void SetVerboseLevel(G4int val)
+      { verboseLevel = val; }
+      inline G4int GetVerboseLevel() const
+      { return verboseLevel; }
+      inline G4int GetNumberOfHistory() const
+      { return histVec.size(); }
+      inline G4String GetPreviousCommand(G4int i) const
+      { 
+        G4String st;
+        if(i>=0 && i<G4int(histVec.size()))
+        { st = histVec[i]; }
+        return st;
+      }
+      inline void SetMaxHistSize(G4int mx)
+      { maxHistSize = mx; }
+      inline G4int GetMaxHistSize() const
+      { return maxHistSize; }
+
+  // Old methods kept for backward compatibility
+  //    inline G4UIcommandTree * GetTree() const
+  //    { return treeTop; };
+  //    inline G4UIsession * GetSession() const
+  //    { return session; };
+  //    inline void SetSession(G4UIsession *const  value)
+  //    { session = value; };
+
+};
+
+#endif
+
Index: trunk/source/intercoms/include/G4UImessenger.hh
===================================================================
--- trunk/source/intercoms/include/G4UImessenger.hh	(revision 821)
+++ trunk/source/intercoms/include/G4UImessenger.hh	(revision 821)
@@ -0,0 +1,87 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UImessenger.hh,v 1.9 2006/06/29 19:08:19 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+
+#ifndef G4UImessenger_h
+#define G4UImessenger_h 1
+
+#include "globals.hh"
+#include "G4ios.hh"
+
+class G4UIcommand;
+
+// class description:
+//
+//  This class is the base class which represents a messenger which maintains
+// the commands. The user who wants to define some commands must create his/her
+// own concrete class derived from this class. The user's concrete messenger
+// must have a responsibility of creating and deleting commands. Also, it must
+// take care the delivering of the command to the destination class and replying
+// the current value(s) of the parameter(s).
+//
+
+class G4UImessenger 
+{
+
+  public: // with description
+      G4UImessenger();
+      // Constructor. In the implementation of the concrete messenger, all commands
+      // related to the messenger must be constructed.
+      virtual ~G4UImessenger();
+      // Destructor. In the implementation of the concrete messenger, all commands
+      // defined in the constructor must be deleted.
+      virtual G4String GetCurrentValue(G4UIcommand * command);
+      // The concrete implementation of this method gets the current value(s) of the
+      // parameter(s) of the given command from the destination class, converts the
+      // value(s) to a string, and returns the string. Conversion could be done by
+      // the ConvertToString() method of corresponding G4UIcmdXXX classes if the
+      // the command is an object of these G4UIcmdXXX classes.
+      virtual void SetNewValue(G4UIcommand * command,G4String newValue);
+      // The concrete implementation of this method converts the string "newValue"
+      // to value(s) of type(s) of the parameter(s). Convert methods corresponding
+      // to the type of the command can be used if the command is an object of
+      // G4UIcmdXXX classes.
+
+  public:
+      G4bool operator == (const G4UImessenger& messenger) const;
+
+  protected:
+      G4String ItoS(G4int i);
+      G4String DtoS(G4double a);
+      G4String BtoS(G4bool b);
+      G4int    StoI(G4String s);
+      G4double StoD(G4String s);
+      G4bool   StoB(G4String s);
+
+  protected:
+      void AddUIcommand(G4UIcommand * newCommand);
+};
+
+#endif
+
Index: trunk/source/intercoms/include/G4UIparameter.hh
===================================================================
--- trunk/source/intercoms/include/G4UIparameter.hh	(revision 821)
+++ trunk/source/intercoms/include/G4UIparameter.hh	(revision 821)
@@ -0,0 +1,184 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIparameter.hh,v 1.9 2006/06/29 19:08:21 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// ---------------------------------------------------------------------
+
+#ifndef G4UIparameter_h
+#define G4UIparameter_h 1
+
+#include "globals.hh"
+#include "G4UItokenNum.hh"
+
+// class description:
+//
+//  This class represents a parameter which will be taken by a G4UIcommand
+// object. In case a command is defined by constructing G4UIcmdXXX class,
+// it automatically creates necessary parameter objects, thus the user needs 
+// not to create parameter object(s) by him/herself. In case the user wants 
+// to create a command directly instansiated by G4UIcommand class, he/she
+// must create parameter object(s) by him/herself.
+
+class G4UIparameter 
+{
+  public: // with description
+      G4UIparameter();
+      G4UIparameter(char theType);
+      G4UIparameter(const char * theName, char theType, G4bool theOmittable);
+      // Constructors, where "theName" is the name of the parameter which will
+      // be used by the range checking, "theType" is the type of the parameter
+      // (currently "b" (boolean), "i" (integer), "d" (double), and "s" (string)
+      // are supported), and "theOmittable" is a boolean flag to set whether
+      // the user of the command can ommit the parameter or not. If "theOmittable"
+      // is true, the default value must be given.
+      ~G4UIparameter();
+      // Destructor. When a command is destructed, the delete operator(s) for 
+      // associating parameter(s) are AUTOMATICALLY invoked. Thus the user needs 
+      // NOT to invoke this by him/herself.
+
+  public:
+      G4int operator==(const G4UIparameter &right) const;
+      G4int operator!=(const G4UIparameter &right) const;
+
+      G4int CheckNewValue(const char* newValue);
+      void List();
+
+  private:
+      G4String parameterName;
+      G4String parameterGuidance;
+      G4String defaultValue;
+      G4String parameterRange;
+      G4String parameterCandidate;
+      char parameterType;
+      G4bool omittable;
+      G4bool currentAsDefaultFlag;
+      G4int widget;
+
+  public: // with description
+      inline void SetDefaultValue(const char * theDefaultValue)
+      { defaultValue = theDefaultValue; }
+      void SetDefaultValue(G4int theDefaultValue);
+      void SetDefaultValue(G4double theDefaultValue);
+      // These methods set the default value of the parameter.
+  public:
+      inline G4String GetDefaultValue() const
+      { return defaultValue; }
+      inline char GetParameterType() const
+      { return parameterType; }
+
+  public: // with description
+      inline void SetParameterRange(const char * theRange)
+      { parameterRange = theRange; }
+      //  Defines the range the parameter can take.
+      //  The variable name appear in the range expression must be same
+      // as the name of the parameter.
+      //  All the C++ syntax of relational operators are allowed for the
+      // range expression.
+  public:
+      inline G4String GetParameterRange() const
+      { return parameterRange; }
+    
+    // parameterName
+      inline void SetParameterName(const char * theName)
+      { parameterName = theName; }
+      inline G4String GetParameterName() const
+      { return parameterName; }
+    
+  public: // with description
+      inline void SetParameterCandidates(const char * theString)
+      { parameterCandidate = theString; }
+      //  This method is meaningful if the type of the parameter is string.
+      // The candidates listed in the argument must be separated by space(s).
+  public:
+      inline G4String GetParameterCandidates() const
+      { return parameterCandidate; }
+    
+    // omittable
+      inline void SetOmittable(G4bool om)
+      { omittable = om; }
+      inline G4bool IsOmittable() const
+      { return omittable; }
+    
+    // currentAsDefaultFlag
+      inline void SetCurrentAsDefault(G4bool val)
+      { currentAsDefaultFlag = val; }
+      inline G4bool GetCurrentAsDefault() const
+      { return currentAsDefaultFlag; }
+    
+    // out of date methods
+      inline void SetWidget(G4int theWidget)
+      { widget = theWidget; }
+      inline const G4String GetParameterGuidance() const
+      { return parameterGuidance; }
+      inline void SetGuidance(const char * theGuidance)
+      { parameterGuidance = theGuidance; }
+
+  private:
+    // --- the following is used by CheckNewValue() -------
+    G4int TypeCheck(const char* newValue );
+    G4int RangeCheck(const char* newValue );
+    G4int CandidateCheck(const char* newValue );
+    G4int IsInt(const char* str, short maxDigit);
+    G4int IsDouble(const char* str);
+    G4int ExpectExponent(const char* str);
+    //  syntax nodes
+    yystype Expression( void );
+    yystype LogicalORExpression( void );
+    yystype LogicalANDExpression( void );
+    yystype EqualityExpression ( void );
+    yystype RelationalExpression( void );
+    yystype AdditiveExpression( void );
+    yystype MultiplicativeExpression( void );
+    yystype UnaryExpression( void );
+    yystype PrimaryExpression( void );
+    //  semantics routines
+    G4int Eval2( yystype arg1, G4int op, yystype arg2 );
+    G4int CompareInt( G4int arg1, G4int op, G4int arg2);
+    G4int CompareDouble( double arg1, G4int op, double arg2);
+    //  utility 
+    tokenNum Yylex( void );     // returns next token
+    G4int G4UIpGetc( void );     // read one char from rangeBuf
+    G4int G4UIpUngetc( G4int c );  // put back  
+    G4int Backslash( G4int c );
+    G4int Follow( G4int expect, G4int ifyes, G4int ifno );
+    G4String TokenToStr(G4int token);
+    //void PrintToken(void);  // debug
+    //  data
+    G4String rangeBuf;
+    G4int bp;                  // buffer pointer for rangeBuf
+    tokenNum token;
+    yystype yylval;
+    yystype newVal;
+    G4int paramERR;
+   //------------ end of CheckNewValue() related member --------------
+
+};
+
+#endif
+
Index: trunk/source/intercoms/include/G4UIsession.hh
===================================================================
--- trunk/source/intercoms/include/G4UIsession.hh	(revision 821)
+++ trunk/source/intercoms/include/G4UIsession.hh	(revision 821)
@@ -0,0 +1,69 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIsession.hh,v 1.5 2006/06/29 19:08:23 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// $id$
+
+#ifndef G4UIsession_h
+#define G4UIsession_h 1
+
+#include "G4coutDestination.hh"
+#include "globals.hh"
+
+// class description:
+//
+//  This is a base class of all (G)UI session.
+//  SessionStart() method should be called to start the session.
+//
+
+class G4UIsession : public G4coutDestination
+{
+  // Base class of UI/GUI session
+  
+  public:
+      G4UIsession();
+      virtual ~G4UIsession();
+
+      virtual G4UIsession * SessionStart();
+      // This method will be invoked by main().
+      // Optionally, it can be invoked by another session.
+      
+      virtual void PauseSessionStart(G4String Prompt);
+      // This method will be invoked by G4UImanager
+      // when G4kernel becomes to Pause state.
+      
+      virtual G4int ReceiveG4cout(G4String coutString);
+      virtual G4int ReceiveG4cerr(G4String cerrString);
+      // These two methods will be invoked by G4strstreambuf.
+
+};
+
+
+
+#endif
+
Index: trunk/source/intercoms/include/G4UItokenNum.hh
===================================================================
--- trunk/source/intercoms/include/G4UItokenNum.hh	(revision 821)
+++ trunk/source/intercoms/include/G4UItokenNum.hh	(revision 821)
@@ -0,0 +1,87 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UItokenNum.hh,v 1.8 2006/06/29 19:08:25 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// G4UItokenNum.hh
+
+#ifndef G4UItokenNum_hh
+#define G4UItokenNum_hh 1
+#include "globals.hh"
+
+
+enum  tokenNum
+{
+  IDENTIFIER = 257,
+  CONSTINT   = 258,
+  CONSTDOUBLE= 259,
+  CONSTCHAR  = 260,
+  CONSTSTRING= 261,
+  GT         = 262,
+  GE         = 263,
+  LT         = 264,
+  LE         = 265,
+  EQ         = 266,
+  NE         = 267,
+  //LOGICALNOT = 268,
+  LOGICALOR  = 269,
+  LOGICALAND = 270
+};
+
+
+typedef struct yystype
+{
+    tokenNum      type;
+    G4double D;
+    G4int    I;
+    char     C;
+    G4String S;
+
+    yystype() : D(0.0), I(0), C(' '), S("")
+    {
+    }
+    G4int operator==(const yystype& right) const
+    {
+      return (this == &right)?1:0;
+    }
+    yystype& operator=(const yystype& right)
+    {
+      if (&right==this) return *this;
+      type = right.type;
+      D = right.D;
+      I = right.I;
+      C = right.C;
+      S = right.S;
+      return *this;
+    }
+    yystype(const yystype& right)
+    {
+      *this=right;
+    }
+} yystype;
+ 
+#endif
Index: trunk/source/intercoms/include/G4UnitsMessenger.hh
===================================================================
--- trunk/source/intercoms/include/G4UnitsMessenger.hh	(revision 821)
+++ trunk/source/intercoms/include/G4UnitsMessenger.hh	(revision 821)
@@ -0,0 +1,64 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UnitsMessenger.hh,v 1.5 2006/06/29 19:08:27 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// class description
+//
+// This class is the messenger of the class which maintain the table of Units.
+// (located in global/management/include/G4UnitsTable.hh)
+// Its contains the commands to interact with the table of Units 
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+#ifndef G4UnitsMessenger_h
+#define G4UnitsMessenger_h 1
+
+#include "globals.hh"
+#include "G4UImessenger.hh"
+
+class G4UIdirectory;
+class G4UIcmdWithoutParameter;
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+class G4UnitsMessenger: public G4UImessenger
+{
+  public:
+    G4UnitsMessenger();
+   ~G4UnitsMessenger();
+    
+    void SetNewValue(G4UIcommand*, G4String);
+    
+  private:    
+    G4UIdirectory*             UnitsTableDir;
+    G4UIcmdWithoutParameter*   ListCmd;
+};
+
+#endif
+
Index: trunk/source/intercoms/include/G4VFlavoredParallelWorld.hh
===================================================================
--- trunk/source/intercoms/include/G4VFlavoredParallelWorld.hh	(revision 821)
+++ trunk/source/intercoms/include/G4VFlavoredParallelWorld.hh	(revision 821)
@@ -0,0 +1,51 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VFlavoredParallelWorld.hh,v 1.5 2006/11/03 17:44:40 mverderi Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Abstract interface for GEANT4 Flavored Parallel World.
+// P. Mora de Freitas & M. Verderi 14/April/1999.
+//
+
+#ifndef G4VFLAVOREDPARALLELWORLD_HH
+#define G4VFLAVOREDPARALLELWORLD_HH
+
+class G4VPhysicalVolume;
+
+class G4VFlavoredParallelWorld {
+
+public:
+
+  virtual ~G4VFlavoredParallelWorld () {}
+
+  // G4VFlavoredParallelWorld Interface for visualisation.
+
+  virtual 
+  G4VPhysicalVolume* GetThePhysicalVolumeWorld() const =0;
+};
+#endif
Index: trunk/source/intercoms/include/G4VGlobalFastSimulationManager.hh
===================================================================
--- trunk/source/intercoms/include/G4VGlobalFastSimulationManager.hh	(revision 821)
+++ trunk/source/intercoms/include/G4VGlobalFastSimulationManager.hh	(revision 821)
@@ -0,0 +1,87 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VGlobalFastSimulationManager.hh,v 1.5 2006/06/29 19:08:31 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Abstract interface for GEANT4 Global Fast Simulation Manager.
+// P. Mora de Freitas & M. Verderi 14/April/1999.
+//
+// Class description:
+//
+// G4GlobalFastSimulationManager is a "Singleton", i.e., only one instance 
+// of it may exist. This is ensured by making the constructor private.
+//
+// G4VGlobalFastSimulationManager is an abstract interface for the
+// G4GlobalFastSimulationManager one. It has the public access function
+// GetConcreteInstance(), which is used to obtain a pointer to the concrete 
+// G4GlobalFastSimulationManager, should it exist. After
+//
+// G4VGlobalFastSimulationManager* pVFSMan =  
+//     G4VGlobalFastSimulationManager::GetConcreteInstance ();
+//
+// pVFSMan points to the real (concrete) G4GlobalFastSimulationManager if
+// at least a parameterisation envelope exists, otherwise is zero.  
+//
+// Thus all code must be protected, for example by:
+//   if (pVFSMan) 
+//    G4FlavoredParallelWorld* =
+//      pVFSMan -> GetFlavoredWorldForThis(p);
+//
+
+#ifndef G4VGLOBALFASTSIMULATIONMANAGER_HH
+#define G4VGLOBALFASTSIMULATIONMANAGER_HH
+
+class G4VFlavoredParallelWorld;
+class G4ParticleDefinition;
+
+class G4VGlobalFastSimulationManager
+{
+
+public:  // with description
+
+  static G4VGlobalFastSimulationManager* GetConcreteInstance ();
+    // Returns pointer to actual Global Fast Simulation manager if
+    // at least a parameterisation envelope exists. Always check value.
+
+  virtual ~G4VGlobalFastSimulationManager () {}
+
+  virtual
+  G4VFlavoredParallelWorld* GetFlavoredWorldForThis(G4ParticleDefinition*)=0;
+    // VGlobalFastSimulationManager interface for visualisation.
+
+protected:
+
+  static void SetConcreteInstance (G4VGlobalFastSimulationManager*);
+    // Sets the pointer to actual Global Fast Simulation manager.
+
+  static G4VGlobalFastSimulationManager* fpConcreteInstance;  
+    // Pointer to real G4GlobalFastSimulationManager.
+
+};
+
+#endif
Index: trunk/source/intercoms/src/G4UIaliasList.cc
===================================================================
--- trunk/source/intercoms/src/G4UIaliasList.cc	(revision 821)
+++ trunk/source/intercoms/src/G4UIaliasList.cc	(revision 821)
@@ -0,0 +1,130 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIaliasList.cc,v 1.6 2006/06/29 19:08:33 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+
+#include "G4UIaliasList.hh"
+#include "G4ios.hh"
+
+G4UIaliasList::G4UIaliasList()
+{ }
+
+G4UIaliasList::~G4UIaliasList()
+{
+  G4int i;
+  G4int n_treeEntry = alias.size();
+  for( i=0; i < n_treeEntry; i++ )
+  { delete alias[i]; 
+    delete value[i]; }
+}
+
+G4int G4UIaliasList::operator==(const G4UIaliasList &right) const
+{
+  return ( this == &right );
+}
+
+G4int G4UIaliasList::operator!=(const G4UIaliasList &right) const
+{
+  return ( this != &right );
+}
+
+void G4UIaliasList::AddNewAlias(const char* aliasName, const char* aliasValue)
+{
+  if(FindAlias(aliasName))
+  {
+    G4cerr << "Alias <" << aliasName << "> already exist. Command ignored."
+           << G4endl;
+    return;
+  }
+  G4String* newAlias = new G4String(aliasName);
+  alias.push_back(newAlias);
+  G4String* newValue = new G4String(aliasValue);
+  value.push_back(newValue);
+}
+
+void G4UIaliasList::RemoveAlias(const char* aliasName)
+{
+  G4int i = FindAliasID(aliasName);
+  if(i<0)
+  {
+    G4cerr << "Alias <" << aliasName << "> does not exist. Command ignored."
+           << G4endl;
+    return;
+  }
+  alias.erase(alias.begin()+i);
+  value.erase(value.begin()+i);
+}
+
+void G4UIaliasList::ChangeAlias(const char* aliasName, const char* aliasValue)
+{
+  G4int i = FindAliasID(aliasName);
+  if(i<0)
+  {
+    AddNewAlias(aliasName,aliasValue);
+    return;
+  }
+  *(value[i]) = aliasValue;
+}
+
+G4String* G4UIaliasList::FindAlias(const char* aliasName)
+{
+  G4int i = FindAliasID(aliasName);
+  if(i<0)
+  { return 0; }
+  return value[i];
+}
+
+G4int G4UIaliasList::FindAliasID(const char* aliasName)
+{
+  G4int i_entry = alias.size();
+  for(G4int i=0;i<i_entry;i++)
+  { if(*(alias[i])==aliasName) return i; }
+  return -1;
+}
+
+void G4UIaliasList::List() 
+{
+  G4int i_entry = alias.size();
+  for(G4int i1=0;i1<i_entry-1;i1++)
+  for(G4int i2=i1+1;i2<i_entry;i2++)
+  {
+    if(*(alias[i1])>*(alias[i2]))
+    {
+      G4String* tmp = alias[i1];
+      alias[i1] = alias[i2];
+      alias[i2] = tmp;
+      tmp = value[i1];
+      value[i1] = value[i2];
+      value[i2] = tmp;
+    }
+  }
+
+  for(G4int i=0;i<i_entry;i++)
+  { G4cout << "  " << *(alias[i]) << " : " << *(value[i]) << G4endl; }
+}
+
Index: trunk/source/intercoms/src/G4UIbatch.cc
===================================================================
--- trunk/source/intercoms/src/G4UIbatch.cc	(revision 821)
+++ trunk/source/intercoms/src/G4UIbatch.cc	(revision 821)
@@ -0,0 +1,230 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+// $Id: G4UIbatch.cc,v 1.16 2007/08/10 09:46:10 kmura Exp $
+// GEANT4 tag $Name:  $
+//
+// ====================================================================
+//   G4UIbatch.cc
+//
+// ====================================================================
+#include "G4UIbatch.hh"
+#include "G4UImanager.hh"
+#include <vector>
+
+////////////////////////////////////////////////////////////////////////
+static void Tokenize(const G4String& str, std::vector<G4String>& tokens)
+////////////////////////////////////////////////////////////////////////
+{
+  const char* delimiter= " ";
+
+  str_size pos0= str.find_first_not_of(delimiter);
+  str_size pos = str.find_first_of(delimiter, pos0);
+  
+  while (pos != G4String::npos || pos0 != G4String::npos) {
+    tokens.push_back(str.substr(pos0, pos-pos0));
+
+    pos0 = str.find_first_not_of(delimiter, pos);
+    pos = str.find_first_of(delimiter, pos0);
+  }
+}
+
+// ====================================================================
+//
+// class description
+//
+// ====================================================================
+
+////////////////////////////////////////////////////////////////////
+G4UIbatch::G4UIbatch(const char* fileName, G4UIsession* prevSession) 
+  : previousSession(prevSession), isOpened(false)
+////////////////////////////////////////////////////////////////////
+{
+  macroStream.open(fileName, std::ios::in);
+  if(macroStream.fail()) {
+    G4cerr << "***** Can not open a macro file <" 
+           << fileName << ">" 
+           << G4endl;
+  } else {
+    isOpened= true;
+  }
+
+  G4UImanager::GetUIpointer()-> SetSession(this);
+}
+
+
+///////////////////////
+G4UIbatch::~G4UIbatch() 
+///////////////////////
+{
+  if(isOpened) macroStream.close();
+}
+
+
+/////////////////////////////////
+G4String G4UIbatch::ReadCommand()
+/////////////////////////////////
+{
+  enum { BUFSIZE= 4096 };
+  static char linebuf[BUFSIZE];
+
+  G4String cmdtotal= "";
+  G4bool qcontinued= false;
+  while(macroStream.good()) {
+    macroStream.getline(linebuf, BUFSIZE);
+
+    G4String cmdline(linebuf);
+
+    // TAB-> ' ' conversion
+    str_size nb=0;
+    while ((nb= cmdline.find('\t',nb)) != G4String::npos) {
+      cmdline.replace(nb, 1, " ");
+    }
+
+    // strip
+    cmdline= cmdline.strip(G4String::both);
+
+    // skip null line if single line
+    if(!qcontinued && cmdline.size()==0) continue;
+
+    // tokenize...
+    std::vector<G4String> tokens;
+    Tokenize(cmdline, tokens);
+    qcontinued= false;
+    for (G4int i=0; i< G4int(tokens.size()); i++) {
+      // '\' or '_' is treated as continued line.
+      if(tokens[i] == '\\' || tokens[i] == '_' ) {
+        qcontinued= true;
+        // check nothing after line continuation character
+        if( i != G4int(tokens.size())-1) {
+          G4Exception("unexpected character after "
+                      "line continuation character");
+        }
+        break; // stop parsing
+      }
+      cmdtotal+= tokens[i];
+      cmdtotal+= " ";
+    }
+
+    if(qcontinued) continue; // read` the next line
+
+    if(cmdtotal.size() != 0) break;
+    if(macroStream.eof()) break;
+  }
+
+  // strip again
+  cmdtotal= cmdtotal.strip(G4String::both);
+
+  // '#' is treated as echoing something
+  if(cmdtotal[(size_t)0]=='#') return cmdtotal;
+
+  // normally something after # is treated just as comment and ignored
+  str_size ic= cmdtotal.find_first_of('#');
+  if(ic != G4String::npos) {
+    cmdtotal= cmdtotal(0, ic);
+  }
+
+  // finally,
+  if(macroStream.eof() && cmdtotal.size()==0) {
+    return "exit";
+  }
+
+  return cmdtotal;
+
+}
+
+
+/////////////////////////////////////////////////////
+G4int G4UIbatch::ExecCommand(const G4String& command)
+/////////////////////////////////////////////////////
+{
+  G4UImanager* UI= G4UImanager::GetUIpointer();
+  G4int rc= UI-> ApplyCommand(command);
+
+  switch(rc) {
+  case fCommandSucceeded:
+    break;
+  case fCommandNotFound:
+    G4cerr << "***** COMMAND NOT FOUND <"
+           << command << "> *****" << G4endl;
+    break;
+  case fIllegalApplicationState:
+    G4cerr << "***** Illegal application state <"
+           << command << "> *****" << G4endl;
+    break;
+  default:
+    G4int pn= rc%100;
+    G4cerr << "***** Illegal parameter (" << pn << ") <"
+           << command << "> *****" << G4endl;
+  }
+
+  return rc;
+}
+
+
+///////////////////////////////////////
+G4UIsession * G4UIbatch::SessionStart() 
+///////////////////////////////////////
+{
+  if(!isOpened) return previousSession;
+
+  while(1) {
+    G4String newCommand = ReadCommand();
+
+    if(newCommand == "exit") { 
+      break;
+    }
+
+    // just echo something
+    if( newCommand[(size_t)0] == '#') { 
+      if(G4UImanager::GetUIpointer()-> GetVerboseLevel()==2) {
+        G4cout << newCommand << G4endl; 
+      }
+      continue;
+    }
+
+    // execute command
+    G4int rc= ExecCommand(newCommand);
+    if(rc != fCommandSucceeded) {
+      G4cerr << G4endl << "***** Batch is interupted!! *****" << G4endl;
+      break;
+    }
+  }
+
+  return previousSession;
+}
+
+
+//////////////////////////////////////////////////
+void G4UIbatch::PauseSessionStart(G4String Prompt) 
+//////////////////////////////////////////////////
+{
+  G4cout << "Pause session <" << Prompt << "> start." << G4endl;
+
+  SessionStart();
+
+  G4cout << "Pause session <" << Prompt << "> Terminate." << G4endl;
+}
+
Index: trunk/source/intercoms/src/G4UIcmdWith3Vector.cc
===================================================================
--- trunk/source/intercoms/src/G4UIcmdWith3Vector.cc	(revision 821)
+++ trunk/source/intercoms/src/G4UIcmdWith3Vector.cc	(revision 821)
@@ -0,0 +1,78 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcmdWith3Vector.cc,v 1.8 2006/06/29 19:08:38 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#include "G4UIcmdWith3Vector.hh"
+
+G4UIcmdWith3Vector::G4UIcmdWith3Vector
+(const char * theCommandPath,G4UImessenger * theMessenger)
+:G4UIcommand(theCommandPath,theMessenger)
+{
+  G4UIparameter * dblParamX = new G4UIparameter('d');
+  SetParameter(dblParamX);
+  G4UIparameter * dblParamY = new G4UIparameter('d');
+  SetParameter(dblParamY);
+  G4UIparameter * dblParamZ = new G4UIparameter('d');
+  SetParameter(dblParamZ);
+}
+
+G4ThreeVector G4UIcmdWith3Vector::GetNew3VectorValue(const char* paramString)
+{
+  return ConvertTo3Vector(paramString);
+}
+
+void G4UIcmdWith3Vector::SetParameterName
+(const char * theNameX,const char * theNameY,const char * theNameZ,
+G4bool omittable,G4bool currentAsDefault)
+{
+  G4UIparameter * theParamX = GetParameter(0);
+  theParamX->SetParameterName(theNameX);
+  theParamX->SetOmittable(omittable);
+  theParamX->SetCurrentAsDefault(currentAsDefault);
+  G4UIparameter * theParamY = GetParameter(1);
+  theParamY->SetParameterName(theNameY);
+  theParamY->SetOmittable(omittable);
+  theParamY->SetCurrentAsDefault(currentAsDefault);
+  G4UIparameter * theParamZ = GetParameter(2);
+  theParamZ->SetParameterName(theNameZ);
+  theParamZ->SetOmittable(omittable);
+  theParamZ->SetCurrentAsDefault(currentAsDefault);
+}
+
+void G4UIcmdWith3Vector::SetDefaultValue(G4ThreeVector vec)
+{
+  G4UIparameter * theParamX = GetParameter(0);
+  theParamX->SetDefaultValue(vec.x());
+  G4UIparameter * theParamY = GetParameter(1);
+  theParamY->SetDefaultValue(vec.y());
+  G4UIparameter * theParamZ = GetParameter(2);
+  theParamZ->SetDefaultValue(vec.z());
+}
+
Index: trunk/source/intercoms/src/G4UIcmdWith3VectorAndUnit.cc
===================================================================
--- trunk/source/intercoms/src/G4UIcmdWith3VectorAndUnit.cc	(revision 821)
+++ trunk/source/intercoms/src/G4UIcmdWith3VectorAndUnit.cc	(revision 821)
@@ -0,0 +1,152 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcmdWith3VectorAndUnit.cc,v 1.9 2006/06/29 19:08:41 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#include "G4UIcmdWith3VectorAndUnit.hh"
+#include "G4Tokenizer.hh"
+#include "G4UnitsTable.hh"
+#include <sstream>
+
+G4UIcmdWith3VectorAndUnit::G4UIcmdWith3VectorAndUnit
+(const char * theCommandPath,G4UImessenger * theMessenger)
+:G4UIcommand(theCommandPath,theMessenger)
+{
+  G4UIparameter * dblParamX = new G4UIparameter('d');
+  SetParameter(dblParamX);
+  G4UIparameter * dblParamY = new G4UIparameter('d');
+  SetParameter(dblParamY);
+  G4UIparameter * dblParamZ = new G4UIparameter('d');
+  SetParameter(dblParamZ);
+  G4UIparameter * untParam = new G4UIparameter('s');
+  SetParameter(untParam);
+  untParam->SetParameterName("Unit");
+}
+
+G4ThreeVector G4UIcmdWith3VectorAndUnit::GetNew3VectorValue(const char* paramString)
+{
+  return ConvertToDimensioned3Vector(paramString);
+}
+
+G4ThreeVector G4UIcmdWith3VectorAndUnit::GetNew3VectorRawValue(const char* paramString)
+{
+  G4double vx;
+  G4double vy;
+  G4double vz;
+  char unts[30];
+  std::istringstream is(paramString);
+  is >> vx >> vy >> vz >> unts;
+  return G4ThreeVector(vx,vy,vz);
+}
+
+G4double G4UIcmdWith3VectorAndUnit::GetNewUnitValue(const char* paramString)
+{
+  G4double vx;
+  G4double vy;
+  G4double vz;
+  char unts[30];
+  std::istringstream is(paramString);
+  is >> vx >> vy >> vz >> unts;
+  G4String unt = unts;
+  return ValueOf(unt);
+}
+
+G4String G4UIcmdWith3VectorAndUnit::ConvertToStringWithBestUnit(G4ThreeVector vec)
+{
+  G4UIparameter* unitParam = GetParameter(3);
+  G4String canList = unitParam->GetParameterCandidates();
+  G4Tokenizer candidateTokenizer(canList);
+  G4String aToken = candidateTokenizer();
+
+  std::ostringstream os;
+  os << G4BestUnit(vec,CategoryOf(aToken));
+  G4String st = os.str();
+
+  return st;
+}
+
+G4String G4UIcmdWith3VectorAndUnit::ConvertToStringWithDefaultUnit(G4ThreeVector vec)
+{
+  G4UIparameter* unitParam = GetParameter(3);
+  G4String st;
+  if(unitParam->IsOmittable())
+  { st = ConvertToString(vec,unitParam->GetDefaultValue()); }
+  else
+  { st = ConvertToStringWithBestUnit(vec); }
+  return st;
+}
+
+void G4UIcmdWith3VectorAndUnit::SetParameterName
+(const char * theNameX,const char * theNameY,const char * theNameZ,
+G4bool omittable,G4bool currentAsDefault)
+{
+  G4UIparameter * theParamX = GetParameter(0);
+  theParamX->SetParameterName(theNameX);
+  theParamX->SetOmittable(omittable);
+  theParamX->SetCurrentAsDefault(currentAsDefault);
+  G4UIparameter * theParamY = GetParameter(1);
+  theParamY->SetParameterName(theNameY);
+  theParamY->SetOmittable(omittable);
+  theParamY->SetCurrentAsDefault(currentAsDefault);
+  G4UIparameter * theParamZ = GetParameter(2);
+  theParamZ->SetParameterName(theNameZ);
+  theParamZ->SetOmittable(omittable);
+  theParamZ->SetCurrentAsDefault(currentAsDefault);
+}
+
+void G4UIcmdWith3VectorAndUnit::SetDefaultValue(G4ThreeVector vec)
+{
+  G4UIparameter * theParamX = GetParameter(0);
+  theParamX->SetDefaultValue(vec.x());
+  G4UIparameter * theParamY = GetParameter(1);
+  theParamY->SetDefaultValue(vec.y());
+  G4UIparameter * theParamZ = GetParameter(2);
+  theParamZ->SetDefaultValue(vec.z());
+}
+
+void G4UIcmdWith3VectorAndUnit::SetUnitCategory(const char * unitCategory)
+{
+  SetUnitCandidates(UnitsList(unitCategory));
+}
+
+void G4UIcmdWith3VectorAndUnit::SetUnitCandidates(const char * candidateList)
+{
+  G4UIparameter * untParam = GetParameter(3);
+  G4String canList = candidateList;
+  untParam->SetParameterCandidates(canList);
+}
+
+void G4UIcmdWith3VectorAndUnit::SetDefaultUnit(const char * defUnit)
+{
+  G4UIparameter * untParam = GetParameter(3);
+  untParam->SetOmittable(true);
+  untParam->SetDefaultValue(defUnit);
+  SetUnitCategory(CategoryOf(defUnit));
+}
+
Index: trunk/source/intercoms/src/G4UIcmdWithABool.cc
===================================================================
--- trunk/source/intercoms/src/G4UIcmdWithABool.cc	(revision 821)
+++ trunk/source/intercoms/src/G4UIcmdWithABool.cc	(revision 821)
@@ -0,0 +1,61 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcmdWithABool.cc,v 1.8 2006/06/29 19:08:43 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#include "G4UIcmdWithABool.hh"
+
+G4UIcmdWithABool::G4UIcmdWithABool
+(const char * theCommandPath,G4UImessenger * theMessenger)
+:G4UIcommand(theCommandPath,theMessenger)
+{
+  G4UIparameter * blParam = new G4UIparameter('b');
+  SetParameter(blParam);
+}
+
+G4bool G4UIcmdWithABool::GetNewBoolValue(const char* paramString)
+{
+  return ConvertToBool(paramString);
+}
+
+void G4UIcmdWithABool::SetParameterName
+(const char * theName,G4bool omittable,G4bool currentAsDefault)
+{
+  G4UIparameter * theParam = GetParameter(0);
+  theParam->SetParameterName(theName);
+  theParam->SetOmittable(omittable);
+  theParam->SetCurrentAsDefault(currentAsDefault);
+}
+
+void G4UIcmdWithABool::SetDefaultValue(G4bool defVal)
+{
+  G4UIparameter * theParam = GetParameter(0);
+  theParam->SetDefaultValue(defVal);
+}
+
Index: trunk/source/intercoms/src/G4UIcmdWithADouble.cc
===================================================================
--- trunk/source/intercoms/src/G4UIcmdWithADouble.cc	(revision 821)
+++ trunk/source/intercoms/src/G4UIcmdWithADouble.cc	(revision 821)
@@ -0,0 +1,61 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcmdWithADouble.cc,v 1.8 2006/06/29 19:08:45 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#include "G4UIcmdWithADouble.hh"
+
+G4UIcmdWithADouble::G4UIcmdWithADouble
+(const char * theCommandPath,G4UImessenger * theMessenger)
+:G4UIcommand(theCommandPath,theMessenger)
+{
+  G4UIparameter * dblParam = new G4UIparameter('d');
+  SetParameter(dblParam);
+}
+
+G4double G4UIcmdWithADouble::GetNewDoubleValue(const char* paramString)
+{
+  return ConvertToDouble(paramString);
+}
+
+void G4UIcmdWithADouble::SetParameterName
+(const char * theName,G4bool omittable,G4bool currentAsDefault)
+{
+  G4UIparameter * theParam = GetParameter(0);
+  theParam->SetParameterName(theName);
+  theParam->SetOmittable(omittable);
+  theParam->SetCurrentAsDefault(currentAsDefault);
+}
+
+void G4UIcmdWithADouble::SetDefaultValue(G4double defVal)
+{
+  G4UIparameter * theParam = GetParameter(0);
+  theParam->SetDefaultValue(defVal);
+}
+
Index: trunk/source/intercoms/src/G4UIcmdWithADoubleAndUnit.cc
===================================================================
--- trunk/source/intercoms/src/G4UIcmdWithADoubleAndUnit.cc	(revision 821)
+++ trunk/source/intercoms/src/G4UIcmdWithADoubleAndUnit.cc	(revision 821)
@@ -0,0 +1,134 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcmdWithADoubleAndUnit.cc,v 1.9 2006/06/29 19:08:48 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#include "G4UIcmdWithADoubleAndUnit.hh"
+#include "G4Tokenizer.hh"
+#include "G4UnitsTable.hh"
+#include <sstream>
+
+G4UIcmdWithADoubleAndUnit::G4UIcmdWithADoubleAndUnit
+(const char * theCommandPath,G4UImessenger * theMessenger)
+:G4UIcommand(theCommandPath,theMessenger)
+{
+  G4UIparameter * dblParam = new G4UIparameter('d');
+  SetParameter(dblParam);
+  G4UIparameter * untParam = new G4UIparameter('s');
+  SetParameter(untParam);
+  untParam->SetParameterName("Unit");
+}
+
+G4double G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(const char* paramString)
+{
+  return ConvertToDimensionedDouble(paramString);
+}
+
+G4double G4UIcmdWithADoubleAndUnit::GetNewDoubleRawValue(const char* paramString)
+{
+  G4double vl;
+  char unts[30];
+  
+  std::istringstream is(paramString);
+  is >> vl >> unts;
+  
+  return vl;
+}
+
+G4double G4UIcmdWithADoubleAndUnit::GetNewUnitValue(const char* paramString)
+{
+  G4double vl;
+  char unts[30];
+  
+  std::istringstream is(paramString);
+  is >> vl >> unts;
+  G4String unt = unts;
+  
+  return ValueOf(unt);
+}
+
+G4String G4UIcmdWithADoubleAndUnit::ConvertToStringWithBestUnit(G4double val)
+{
+  G4UIparameter* unitParam = GetParameter(1);
+  G4String canList = unitParam->GetParameterCandidates();
+  G4Tokenizer candidateTokenizer(canList);
+  G4String aToken = candidateTokenizer();
+  std::ostringstream os;
+  os << G4BestUnit(val,CategoryOf(aToken));
+
+  G4String st = os.str();
+  return st;
+}
+
+G4String G4UIcmdWithADoubleAndUnit::ConvertToStringWithDefaultUnit(G4double val)
+{
+  G4UIparameter* unitParam = GetParameter(1);
+  G4String st;
+  if(unitParam->IsOmittable())
+  { st = ConvertToString(val,unitParam->GetDefaultValue()); }
+  else
+  { st = ConvertToStringWithBestUnit(val); }
+  return st;
+}
+
+void G4UIcmdWithADoubleAndUnit::SetParameterName
+(const char * theName,G4bool omittable,G4bool currentAsDefault)
+{
+  G4UIparameter * theParam = GetParameter(0);
+  theParam->SetParameterName(theName);
+  theParam->SetOmittable(omittable);
+  theParam->SetCurrentAsDefault(currentAsDefault);
+}
+
+void G4UIcmdWithADoubleAndUnit::SetDefaultValue(G4double defVal)
+{
+  G4UIparameter * theParam = GetParameter(0);
+  theParam->SetDefaultValue(defVal);
+}
+
+void G4UIcmdWithADoubleAndUnit::SetUnitCategory(const char * unitCategory)
+{
+  SetUnitCandidates(UnitsList(unitCategory));
+}
+
+void G4UIcmdWithADoubleAndUnit::SetUnitCandidates(const char * candidateList)
+{
+  G4UIparameter * untParam = GetParameter(1);
+  G4String canList = candidateList;
+  untParam->SetParameterCandidates(canList);
+}
+
+void G4UIcmdWithADoubleAndUnit::SetDefaultUnit(const char * defUnit)
+{
+  G4UIparameter * untParam = GetParameter(1);
+  untParam->SetOmittable(true);
+  untParam->SetDefaultValue(defUnit);
+  SetUnitCategory(CategoryOf(defUnit));
+}
+
Index: trunk/source/intercoms/src/G4UIcmdWithAString.cc
===================================================================
--- trunk/source/intercoms/src/G4UIcmdWithAString.cc	(revision 821)
+++ trunk/source/intercoms/src/G4UIcmdWithAString.cc	(revision 821)
@@ -0,0 +1,63 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcmdWithAString.cc,v 1.6 2006/06/29 19:08:50 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#include "G4UIcmdWithAString.hh"
+
+G4UIcmdWithAString::G4UIcmdWithAString
+(const char * theCommandPath,G4UImessenger * theMessenger)
+:G4UIcommand(theCommandPath,theMessenger)
+{
+  G4UIparameter * strParam = new G4UIparameter('s');
+  SetParameter(strParam);
+}
+
+void G4UIcmdWithAString::SetParameterName
+(const char * theName,G4bool omittable,G4bool currentAsDefault)
+{
+  G4UIparameter * theParam = GetParameter(0);
+  theParam->SetParameterName(theName);
+  theParam->SetOmittable(omittable);
+  theParam->SetCurrentAsDefault(currentAsDefault);
+}
+
+void G4UIcmdWithAString::SetCandidates(const char * candidateList)
+{
+  G4UIparameter * theParam = GetParameter(0);
+  G4String canList = candidateList;
+  theParam->SetParameterCandidates(canList);
+}
+
+void G4UIcmdWithAString::SetDefaultValue(const char * defVal)
+{
+  G4UIparameter * theParam = GetParameter(0);
+  theParam->SetDefaultValue(defVal);
+}
+
Index: trunk/source/intercoms/src/G4UIcmdWithAnInteger.cc
===================================================================
--- trunk/source/intercoms/src/G4UIcmdWithAnInteger.cc	(revision 821)
+++ trunk/source/intercoms/src/G4UIcmdWithAnInteger.cc	(revision 821)
@@ -0,0 +1,61 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcmdWithAnInteger.cc,v 1.8 2006/06/29 19:08:52 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#include "G4UIcmdWithAnInteger.hh"
+
+G4UIcmdWithAnInteger::G4UIcmdWithAnInteger
+(const char * theCommandPath,G4UImessenger * theMessenger)
+:G4UIcommand(theCommandPath,theMessenger)
+{
+  G4UIparameter * intParam = new G4UIparameter('i');
+  SetParameter(intParam);
+}
+
+G4int G4UIcmdWithAnInteger::GetNewIntValue(const char* paramString)
+{
+  return ConvertToInt(paramString);
+}
+
+void G4UIcmdWithAnInteger::SetParameterName
+(const char * theName,G4bool omittable,G4bool currentAsDefault)
+{
+  G4UIparameter * theParam = GetParameter(0);
+  theParam->SetParameterName(theName);
+  theParam->SetOmittable(omittable);
+  theParam->SetCurrentAsDefault(currentAsDefault);
+}
+
+void G4UIcmdWithAnInteger::SetDefaultValue(G4int defVal)
+{
+  G4UIparameter * theParam = GetParameter(0);
+  theParam->SetDefaultValue(defVal);
+}
+
Index: trunk/source/intercoms/src/G4UIcmdWithoutParameter.cc
===================================================================
--- trunk/source/intercoms/src/G4UIcmdWithoutParameter.cc	(revision 821)
+++ trunk/source/intercoms/src/G4UIcmdWithoutParameter.cc	(revision 821)
@@ -0,0 +1,38 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcmdWithoutParameter.cc,v 1.4 2006/06/29 19:08:54 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#include "G4UIcmdWithoutParameter.hh"
+
+G4UIcmdWithoutParameter::G4UIcmdWithoutParameter
+(const char * theCommandPath,G4UImessenger * theMessenger)
+:G4UIcommand(theCommandPath,theMessenger)
+{;}
+
Index: trunk/source/intercoms/src/G4UIcommand.cc
===================================================================
--- trunk/source/intercoms/src/G4UIcommand.cc	(revision 821)
+++ trunk/source/intercoms/src/G4UIcommand.cc	(revision 821)
@@ -0,0 +1,1123 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcommand.cc,v 1.25 2006/06/29 19:08:56 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+#include "G4UIcommand.hh"
+#include "G4UImessenger.hh"
+#include "G4UImanager.hh"
+#include "G4UIcommandStatus.hh"
+#include "G4StateManager.hh"
+#include "G4UnitsTable.hh"
+#include "G4Tokenizer.hh"
+#include "G4ios.hh"
+#include <sstream>
+
+G4UIcommand::G4UIcommand()
+:messenger(0),token(IDENTIFIER),paramERR(0)
+{;}
+
+G4UIcommand::G4UIcommand(const char * theCommandPath,
+			 G4UImessenger * theMessenger)
+:messenger(theMessenger),token(IDENTIFIER),paramERR(0)
+{
+  G4String comStr = theCommandPath;
+  if(!theMessenger)
+  { // this must be a directory
+    if(comStr(comStr.length()-1)!='/')
+    {
+      G4cerr << "G4UIcommand Warning : " << G4endl;
+      G4cerr << "  <" << theCommandPath << "> must be a directory." << G4endl;
+      G4cerr << "  '/' is appended." << G4endl;
+      comStr += "/";
+    }
+  }
+  G4UIcommandCommonConstructorCode (comStr);
+  G4String nullString;
+  availabelStateList.clear();
+  availabelStateList.push_back(G4State_PreInit);
+  availabelStateList.push_back(G4State_Init);
+  availabelStateList.push_back(G4State_Idle);
+  availabelStateList.push_back(G4State_GeomClosed);
+  availabelStateList.push_back(G4State_EventProc);
+  availabelStateList.push_back(G4State_Abort);
+}
+
+void G4UIcommand::G4UIcommandCommonConstructorCode
+(const char * theCommandPath)
+{ 
+  commandPath = theCommandPath;
+  commandName = theCommandPath;
+  G4int commandNameIndex = commandName.last('/');
+  commandName.remove(0,commandNameIndex+1);
+
+  G4UImanager::GetUIpointer()->AddNewCommand(this);
+}
+
+G4UIcommand::~G4UIcommand()
+{
+  G4UImanager* fUImanager = G4UImanager::GetUIpointer();
+  if(fUImanager) fUImanager->RemoveCommand(this);
+  
+  G4int n_parameterEntry = parameter.size();
+  for( G4int i_thParameter=0; i_thParameter < n_parameterEntry; i_thParameter++ )
+  { delete parameter[i_thParameter]; }
+  parameter.clear();
+}
+
+G4int G4UIcommand::operator==(const G4UIcommand &right) const
+{
+  return ( commandPath == right.GetCommandPath() );
+}
+
+G4int G4UIcommand::operator!=(const G4UIcommand &right) const
+{
+  return ( commandPath != right.GetCommandPath() );
+}
+
+G4int G4UIcommand::DoIt(G4String parameterList)
+{
+  G4String correctParameters;
+  G4int n_parameterEntry = parameter.size();
+  if( n_parameterEntry != 0 )
+  {
+    G4String aToken;
+    G4String correctToken;
+    G4Tokenizer parameterToken( parameterList );
+    for( G4int i_thParameter=0; i_thParameter<n_parameterEntry; i_thParameter++ )
+    {
+      if(i_thParameter > 0)
+      {
+        correctParameters.append(" ");
+      }
+      aToken = parameterToken();
+      if( aToken.length()>0 && aToken(0)=='"' )
+      {
+        while( aToken(aToken.length()-1) != '"'
+               || ( aToken.length()==1 && aToken(0)=='"' ))
+        {
+          G4String additionalToken = parameterToken();
+          if( additionalToken.isNull() )
+          { return fParameterUnreadable+i_thParameter; }
+          aToken += " ";
+          aToken += additionalToken;
+        }
+      }
+      else if(i_thParameter==n_parameterEntry-1 && parameter[i_thParameter]->GetParameterType()=='s')
+      {
+        G4String anotherToken;
+        while(!((anotherToken=parameterToken()).isNull()))
+        {
+          G4int idxs = anotherToken.index("#");
+          if(idxs==G4int(std::string::npos))
+          {
+            aToken += " ";
+            aToken += anotherToken;
+          }
+          else if(idxs>0)
+          {
+            aToken += " ";
+            aToken += anotherToken(0,idxs);
+            break;
+          }
+          else
+          { break; }
+        }
+      }
+
+      if( aToken.isNull() || aToken == "!" )
+      {
+        if(parameter[i_thParameter]->IsOmittable())
+        { 
+          if(parameter[i_thParameter]->GetCurrentAsDefault())
+          {
+            G4Tokenizer cvSt(messenger->GetCurrentValue(this));
+            G4String parVal;
+            for(G4int ii=0;ii<i_thParameter;ii++)
+            {
+	      parVal = cvSt();
+	      if (parVal(0)=='"')
+		{
+		  while( parVal(parVal.length()-1) != '"' )
+		    {
+		      G4String additionalToken = cvSt();
+		      if( additionalToken.isNull() )
+			{ return fParameterUnreadable+i_thParameter; }
+		      parVal += " ";
+		      parVal += additionalToken;
+		    }
+		}
+	    }
+	    G4String aCVToken = cvSt();
+	    if (aCVToken(0)=='"')
+	    {
+	      while( aCVToken(aCVToken.length()-1) != '"' )
+	      {
+		G4String additionalToken = cvSt();
+		if( additionalToken.isNull() )
+		{ return fParameterUnreadable+i_thParameter; }
+		aCVToken += " ";
+		aCVToken += additionalToken;
+	      }
+	      // aCVToken.strip(G4String::both,'"');
+	    }
+            correctParameters.append(aCVToken);
+          }
+          else
+          { correctParameters.append(parameter[i_thParameter]->GetDefaultValue()); }
+        }
+        else
+        { return fParameterUnreadable+i_thParameter; }
+      }
+      else
+      {
+        G4int stat = parameter[i_thParameter]->CheckNewValue( aToken );
+        if(stat) return stat+i_thParameter;
+        correctParameters.append(aToken);
+      }
+    }
+  }
+
+  if(CheckNewValue( correctParameters ))
+  { return fParameterOutOfRange+99; }
+
+  messenger->SetNewValue( this, correctParameters );
+  return 0;
+}
+
+G4String G4UIcommand::GetCurrentValue()
+{
+  return messenger->GetCurrentValue(this);
+}
+
+void G4UIcommand::AvailableForStates(G4ApplicationState s1)
+{
+  availabelStateList.clear();
+  availabelStateList.push_back(s1);
+}
+
+void G4UIcommand::AvailableForStates(G4ApplicationState s1,
+                                     G4ApplicationState s2)
+{
+  availabelStateList.clear();
+  availabelStateList.push_back(s1);
+  availabelStateList.push_back(s2);
+}
+
+void G4UIcommand::AvailableForStates(G4ApplicationState s1,
+                                     G4ApplicationState s2,
+                                     G4ApplicationState s3)
+{
+  availabelStateList.clear();
+  availabelStateList.push_back(s1);
+  availabelStateList.push_back(s2);
+  availabelStateList.push_back(s3);
+}
+
+void G4UIcommand::AvailableForStates(G4ApplicationState s1,
+                                     G4ApplicationState s2,
+                                     G4ApplicationState s3,
+                                     G4ApplicationState s4)
+{
+  availabelStateList.clear();
+  availabelStateList.push_back(s1);
+  availabelStateList.push_back(s2);
+  availabelStateList.push_back(s3);
+  availabelStateList.push_back(s4);
+}
+
+void G4UIcommand::AvailableForStates(G4ApplicationState s1,
+                                     G4ApplicationState s2,
+                                     G4ApplicationState s3,
+                                     G4ApplicationState s4,
+                                     G4ApplicationState s5)
+{
+  availabelStateList.clear();
+  availabelStateList.push_back(s1);
+  availabelStateList.push_back(s2);
+  availabelStateList.push_back(s3);
+  availabelStateList.push_back(s4);
+  availabelStateList.push_back(s5);
+}
+
+G4bool G4UIcommand::IsAvailable()
+{
+  G4bool av = false;
+  G4ApplicationState currentState 
+   = G4StateManager::GetStateManager()->GetCurrentState();
+   
+  G4int nState = availabelStateList.size();
+  for(G4int i=0;i<nState;i++)
+  {
+  	if(availabelStateList[i]==currentState)
+  	{
+  	  av = true;
+  	  break;
+  	}
+  }
+
+  return av;
+}
+
+G4double G4UIcommand::ValueOf(const char* unitName)
+{
+   G4double value = 0.;
+   value = G4UnitDefinition::GetValueOf(unitName);
+   return value;              
+}
+
+G4String G4UIcommand::CategoryOf(const char* unitName)
+{
+   return G4UnitDefinition::GetCategory(unitName);
+}
+
+G4String G4UIcommand::UnitsList(const char* unitCategory)
+{
+  G4String retStr;
+  G4UnitsTable& UTbl = G4UnitDefinition::GetUnitsTable();
+  size_t i;
+  for(i=0;i<UTbl.size();i++)
+  { if(UTbl[i]->GetName()==unitCategory) break; }
+  if(i==UTbl.size())
+  { 
+    G4cerr << "Unit category <" << unitCategory << "> is not defined." << G4endl;
+    return retStr;
+  }
+  G4UnitsContainer& UCnt = UTbl[i]->GetUnitsList();
+  retStr = UCnt[0]->GetSymbol();
+  G4int je = UCnt.size();
+  for(G4int j=1;j<je;j++)
+  {
+    retStr += " ";
+    retStr += UCnt[j]->GetSymbol();
+  }
+  for(G4int k=0;k<je;k++)
+  {
+    retStr += " ";
+    retStr += UCnt[k]->GetName();
+  }
+  return retStr;
+}
+  
+void G4UIcommand::List()
+{
+  G4cout << G4endl;
+  G4cout << G4endl;
+  if(commandPath(commandPath.length()-1)!='/')
+  { G4cout << "Command " << commandPath << G4endl; }
+  G4cout << "Guidance :" << G4endl;
+  G4int n_guidanceEntry = commandGuidance.size();
+  for( G4int i_thGuidance=0; i_thGuidance < n_guidanceEntry; i_thGuidance++ )
+  { G4cout << commandGuidance[i_thGuidance] << G4endl; }
+  if( ! rangeString.isNull() )
+  { G4cout << " Range of parameters : " << rangeString << G4endl; }
+  G4int n_parameterEntry = parameter.size();
+  if( n_parameterEntry > 0 )
+  {
+    for( G4int i_thParameter=0; i_thParameter<n_parameterEntry; i_thParameter++ )
+    { parameter[i_thParameter]->List(); }
+  }
+  G4cout << G4endl;
+}
+
+G4String G4UIcommand::ConvertToString(G4bool boolVal)
+{
+  G4String vl = "0";
+  if(boolVal) vl = "1";
+  return vl;
+}
+
+G4String G4UIcommand::ConvertToString(G4int intValue)
+{
+  std::ostringstream os;
+  os << intValue;
+  G4String vl = os.str();
+  return vl;
+}
+
+G4String G4UIcommand::ConvertToString(G4double doubleValue)
+{
+  std::ostringstream os;
+  os << doubleValue;
+  G4String vl = os.str();
+  return vl;
+}
+
+G4String G4UIcommand::ConvertToString(G4double doubleValue,const char* unitName)
+{
+  G4String unt = unitName;
+  G4double uv = ValueOf(unitName);
+
+  std::ostringstream os;
+  os << doubleValue/uv << " " << unitName;
+  G4String vl = os.str();
+  return vl;
+}
+
+G4String G4UIcommand::ConvertToString(G4ThreeVector vec)
+{
+  std::ostringstream os;
+  os << vec.x() << " " << vec.y() << " " << vec.z();
+  G4String vl = os.str();
+  return vl;
+}
+
+G4String G4UIcommand::ConvertToString(G4ThreeVector vec,const char* unitName)
+{
+  G4String unt = unitName;
+  G4double uv = ValueOf(unitName);
+
+  std::ostringstream os;
+  os << vec.x()/uv << " " << vec.y()/uv << " " << vec.z()/uv
+     << " " << unitName;
+  G4String vl = os.str();
+  return vl;
+}
+
+G4bool G4UIcommand::ConvertToBool(const char* st)
+{
+  G4String v = st;
+  v.toUpper();
+  G4bool vl = false;
+  if( v=="Y" || v=="YES" || v=="1" || v=="T" || v=="TRUE" )
+  { vl = true; }
+  return vl;
+}
+
+G4int G4UIcommand::ConvertToInt(const char* st)
+{
+  G4int vl;
+  std::istringstream is(st);
+  is >> vl;
+  return vl;
+}
+
+G4double G4UIcommand::ConvertToDouble(const char* st)
+{
+  G4double vl;
+  std::istringstream is(st);
+  is >> vl;
+  return vl;
+}
+
+G4double G4UIcommand::ConvertToDimensionedDouble(const char* st)
+{
+  G4double vl;
+  char unts[30];
+
+  std::istringstream is(st);
+  is >> vl >> unts;
+  G4String unt = unts;
+
+  return (vl*ValueOf(unt));
+}
+
+G4ThreeVector G4UIcommand::ConvertTo3Vector(const char* st)
+{
+  G4double vx;
+  G4double vy;
+  G4double vz;
+  std::istringstream is(st);
+  is >> vx >> vy >> vz;
+  return G4ThreeVector(vx,vy,vz);
+}
+
+G4ThreeVector G4UIcommand::ConvertToDimensioned3Vector(const char* st)
+{
+  G4double vx;
+  G4double vy;
+  G4double vz;
+  char unts[30];
+  std::istringstream is(st);
+  is >> vx >> vy >> vz >> unts;
+  G4String unt = unts;
+  G4double uv = ValueOf(unt);
+  return G4ThreeVector(vx*uv,vy*uv,vz*uv);
+}
+
+
+// ----- the following is used by CheckNewValue()  ------------
+
+
+#include <ctype.h>          // isalpha(), toupper()
+
+//#include "checkNewValue_debug.icc"
+//#define DEBUG 1
+
+G4int G4UIcommand::
+CheckNewValue(const char * newValue)
+{
+   yystype result;
+   // if( TypeCheck(newValue) == 0 ) return 1;
+   if( ! rangeString.isNull() )
+   { if( RangeCheck(newValue) == 0 ) return fParameterOutOfRange; }
+   return 0;  // succeeded
+}
+
+// ------------------ type check routines -------------------
+
+G4int G4UIcommand::
+TypeCheck(const char * t)
+{
+    G4String aNewValue;
+    char type;
+    std::istringstream is(t);
+    for (unsigned i=0; i< parameter.size(); i++) {
+        is >> aNewValue;
+        type = toupper(parameter[i]->GetParameterType());
+        switch ( type ) {
+            case 'D':
+                if( IsDouble(aNewValue)==0 ){
+                    G4cerr << aNewValue << ": double value expected."
+                         << G4endl;
+                    return 0;
+                } break;
+            case 'I':
+                if( IsInt(aNewValue,20)==0 ){
+                    G4cerr <<aNewValue<<": integer expected."
+                         <<G4endl;
+                     return 0;
+                } break;
+            case 'S':
+                break;
+            case 'B':
+                aNewValue.toUpper(); 
+                if (aNewValue == "Y"   || aNewValue == "N"
+                  ||aNewValue == "YES" || aNewValue == "NO"
+                  ||aNewValue == "1"   || aNewValue == "0"
+                  ||aNewValue == "T"   || aNewValue == "F"
+                  ||aNewValue == "TRUE" || aNewValue == "FALSE")
+                return 1;
+                else return 0; 
+                break;
+            default:  ;
+        }
+    }
+    return 1;
+}
+
+
+G4int G4UIcommand::
+IsInt(const char* buf, short maxDigits)
+{
+    const char* p= buf;
+    G4int length=0;
+    if( *p == '+' || *p == '-') { ++p; }
+    if( isdigit( (G4int)(*p) )) {
+        while( isdigit( (G4int)(*p) )) { ++p;  ++length; }
+        if( *p == '\0' ) {
+            if( length > maxDigits) {
+                G4cerr <<"digit length exceeds"<<G4endl;
+                return 0;
+            }
+            return 1;
+        } else {
+            // G4cerr <<"illegal character after int:"<<buf<<G4endl;
+        }
+    } else {
+        // G4cerr <<"illegal int:"<<buf<<G4endl;
+    }
+    return 0;
+}
+
+
+G4int G4UIcommand::
+ExpectExponent(const char* str)   // used only by IsDouble()
+{
+    G4int maxExplength;
+    if( IsInt( str, maxExplength=7 )) return 1;
+    else return 0;
+}
+
+
+G4int G4UIcommand::
+IsDouble(const char* buf)
+{
+    const char* p= buf;
+    switch( *p) {
+        case '+':  case '-': ++p;
+            if( isdigit(*p) ) {
+                 while( isdigit( (G4int)(*p) )) { ++p; }
+                 switch ( *p ) {
+                     case '\0':    return 1;
+		        // break;
+                     case 'E':  case 'e':
+                         return ExpectExponent(++p );
+			// break;
+                     case '.':  ++p;
+                         if( *p == '\0' )  return 1;
+                         if( *p == 'e' || *p =='E' ) return ExpectExponent(++p );
+                         if( isdigit(*p) ) {
+                             while( isdigit( (G4int)(*p) )) { ++p; }
+                             if( *p == '\0' )  return 1;
+                             if( *p == 'e' || *p =='E') return ExpectExponent(++p);
+                         } else return 0;   break;
+                     default: return 0;
+                 }
+            }
+            if( *p == '.' ) { ++p;
+                 if( isdigit(*p) ) {
+                     while( isdigit( (G4int)(*p) )) { ++p; }
+                     if( *p == '\0' )  return 1;
+                     if( *p == 'e' || *p =='E')  return ExpectExponent(++p);
+                 }
+            }
+            break;
+        case '.':  ++p;
+            if( isdigit(*p) ) {
+                 while( isdigit( (G4int)(*p) )) { ++p; }
+                 if( *p == '\0' )  return 1;
+                 if( *p == 'e' || *p =='E' )  return ExpectExponent(++p);
+            }    break;
+        default: // digit is expected
+            if( isdigit(*p) ) {
+                 while( isdigit( (G4int)(*p) )) { ++p; }
+                 if( *p == '\0' )  return 1;
+                 if( *p == 'e' || *p =='E')  return ExpectExponent(++p);
+                 if( *p == '.' ) { ++p;
+                      if( *p == '\0' )  return 1;
+                      if( *p == 'e' || *p =='E')  return ExpectExponent(++p);
+                      if( isdigit(*p) ) {
+                          while( isdigit( (G4int)(*p) )) { ++p; }
+                          if( *p == '\0' )  return 1;
+                          if( *p == 'e' || *p =='E') return ExpectExponent(++p);
+                      }
+                 }
+            }
+     }
+     return 0;
+}
+
+
+// ------------------ range Check routines -------------------
+G4int G4UIcommand::
+RangeCheck(const char* t) {
+    yystype result;
+    char type;
+    bp = 0;                 // reset buffer pointer for G4UIpGetc()
+    std::istringstream is(t);
+    for (unsigned i=0; i< parameter.size(); i++) {
+        type= toupper(parameter[i]->GetParameterType());
+        switch ( type ) {
+            case 'D':  is >> newVal[i].D;  break;
+            case 'I':  is >> newVal[i].I;  break;
+            case 'S':
+            case 'B':
+            default:  ;
+        }
+   }
+   // PrintToken();          // Print tokens (consumes all tokens)
+   token= Yylex();
+   result = Expression();
+
+   if( paramERR == 1 ) return 0;
+   if( result.type != CONSTINT) {
+      G4cerr << "Illegal Expression in parameter range." << G4endl;
+      return 0;
+   }
+   if ( result.I ) return 1;
+   G4cerr << "parameter out of range: "<< rangeString << G4endl;
+   return 0;
+}
+
+// ------------------ syntax node functions  ------------------
+yystype G4UIcommand:: 
+Expression(void)
+{
+    yystype result;
+    #ifdef DEBUG
+        G4cerr << " Expression()" << G4endl;
+    #endif
+    result = LogicalORExpression();
+    return result;
+}
+
+yystype G4UIcommand:: 
+LogicalORExpression(void)
+{
+    yystype result;
+    yystype p;
+    p = LogicalANDExpression();
+    if( token != LOGICALOR)  return p;
+    if( p.type == CONSTSTRING || p.type == IDENTIFIER ) {
+        G4cerr << "Parameter range: illegal type at '||'" << G4endl;
+        paramERR = 1;
+    }
+    result.I = p.I;
+    while (token == LOGICALOR) 
+    {  
+        token = Yylex();
+        p = LogicalANDExpression();
+        if( p.type == CONSTSTRING || p.type == IDENTIFIER ) {
+            G4cerr << "Parameter range: illegal type at '||'" <<G4endl;
+            paramERR = 1;
+        }
+        switch (p.type) {
+            case CONSTINT: 
+                result.I  += p.I; 
+                result.type = CONSTINT;      break;
+            case CONSTDOUBLE:
+                result.I += (p.D != 0.0); 
+                result.type = CONSTINT;      break;
+            default: 
+                G4cerr << "Parameter range: unknown type"<<G4endl; 
+                paramERR = 1;
+        } 
+    }
+    return result;
+}
+
+yystype G4UIcommand:: 
+LogicalANDExpression(void)
+{
+    yystype result;
+    yystype p;
+    p = EqualityExpression();
+    if( token != LOGICALAND)  return p;
+    if( p.type == CONSTSTRING || p.type == IDENTIFIER ) {
+        G4cerr << "Parameter range: illegal type at '&&'" << G4endl;
+        paramERR = 1;
+    }
+    result.I = p.I;
+    while (token == LOGICALAND)
+    {
+        token = Yylex();
+        p = EqualityExpression();
+        if( p.type == CONSTSTRING || p.type == IDENTIFIER ) {
+            G4cerr << "Parameter range: illegal type at '&&'" << G4endl;
+            paramERR = 1;
+        }
+        switch (p.type) {
+            case CONSTINT:
+                result.I  *= p.I;
+                result.type = CONSTINT;      break;
+            case CONSTDOUBLE:
+                result.I *= (p.D != 0.0);
+                result.type = CONSTINT;      break;
+            default:
+                G4cerr << "Parameter range: unknown type."<< G4endl;
+                paramERR = 1;
+        } 
+    }
+    return result;
+}
+
+
+yystype G4UIcommand:: 
+EqualityExpression(void)
+{ 
+    yystype  arg1, arg2;
+    G4int operat;
+    yystype result;
+    #ifdef DEBUG
+        G4cerr << " EqualityExpression()" <<G4endl;
+    #endif
+    result = RelationalExpression();
+    if( token==EQ || token==NE ) {
+        operat = token;
+        token =  Yylex();
+        arg1 = result;
+        arg2 = RelationalExpression();
+        result.I = Eval2( arg1, operat, arg2 );   // semantic action
+        result.type = CONSTINT;
+        #ifdef DEBUG
+            G4cerr << " return code of Eval2(): " << result.I <<G4endl;
+        #endif
+    } else {
+        if (result.type != CONSTINT && result.type != CONSTDOUBLE) {  
+            G4cerr << "Parameter range: error at EqualityExpression"
+                 << G4endl;
+            paramERR = 1;
+        }
+    }
+    return  result;
+}
+
+
+yystype G4UIcommand:: 
+RelationalExpression(void)
+{ 
+    yystype  arg1, arg2;
+    G4int operat;
+    yystype result;
+    #ifdef DEBUG
+        G4cerr << " RelationalExpression()" <<G4endl;
+    #endif
+
+    arg1 = AdditiveExpression();
+    if( token==GT || token==GE || token==LT || token==LE  ) {
+        operat = token;
+        token =  Yylex();
+        arg2 = AdditiveExpression();
+        result.I = Eval2( arg1, operat, arg2 );    // semantic action
+        result.type = CONSTINT;
+        #ifdef DEBUG
+            G4cerr << " return code of Eval2(): " << result.I << G4endl;
+        #endif
+    } else {
+              result = arg1;
+    }
+    #ifdef DEBUG
+       G4cerr <<" return RelationalExpression()"<< G4endl;
+    #endif
+    return  result;
+}
+
+yystype G4UIcommand::
+AdditiveExpression(void)
+{   yystype result;
+    result = MultiplicativeExpression();
+    if( token != '+' && token != '-' )  return result;
+    G4cerr << "Parameter range: operator " 
+         << (char)token 
+         << " is not supported." << G4endl;
+    paramERR = 1;
+    return  result;
+}
+
+yystype G4UIcommand::
+MultiplicativeExpression(void)
+{   yystype result;
+    result = UnaryExpression();
+    if( token != '*' && token != '/' && token != '%' ) return result;
+    G4cerr << "Parameter range: operator "
+         << (char)token
+         << " is not supported." << G4endl;
+    paramERR = 1;
+    return  result;
+}
+
+yystype G4UIcommand::
+UnaryExpression(void)
+{
+    yystype result;
+    yystype p;
+    #ifdef DEBUG
+        G4cerr <<" UnaryExpression"<< G4endl;
+    #endif
+    switch(token) {
+        case '-':
+            token = Yylex();
+            p = UnaryExpression();
+            if (p.type == CONSTINT) {
+                result.I = - p.I;
+                result.type = CONSTINT;
+            }
+            if (p.type == CONSTDOUBLE) {
+                result.D = - p.D;
+                result.type = CONSTDOUBLE;
+            }                              break;
+        case '+':
+            token = Yylex();
+            result = UnaryExpression();   break;
+        case '!':
+            token = Yylex();
+            G4cerr << "Parameter range error: "
+                 << "operator '!' is not supported (sorry)."
+                 << G4endl;
+            paramERR = 1;
+            result = UnaryExpression();   break;
+        default:
+            result = PrimaryExpression();
+    }
+    return result;
+}
+
+
+yystype G4UIcommand:: 
+PrimaryExpression(void)
+{
+     yystype result;
+     #ifdef DEBUG
+         G4cerr <<" primary_exp"<<G4endl;
+     #endif
+     switch (token) {
+         case IDENTIFIER:
+              result.S = yylval.S;
+              result.type =  token;
+              token = Yylex();           break;
+         case CONSTINT:
+              result.I = yylval.I;
+              result.type =  token;
+              token= Yylex();            break;
+         case CONSTDOUBLE:
+              result.D = yylval.D;
+              result.type =  token;
+              token = Yylex();           break;
+         case '(' :
+              token= Yylex();
+              result = Expression();
+              if( token !=  ')'  ) {
+                  G4cerr << " ')' expected" << G4endl;
+                  paramERR = 1;
+              }
+              token = Yylex();
+                                         break;
+         default:
+         return result;
+    }
+    return result; // never executed
+}
+
+//---------------- semantic routines ---------------------------------
+
+G4int G4UIcommand::
+Eval2(yystype arg1, G4int op, yystype arg2)
+{
+    char newValtype;
+    if( (arg1.type != IDENTIFIER) && (arg2.type != IDENTIFIER)) {
+        G4cerr << commandName
+             << ": meaningless comparison"
+             << G4endl;
+        paramERR = 1;
+    }
+
+    if( arg1.type == IDENTIFIER) {
+        unsigned i = IndexOf( arg1.S );
+        newValtype = toupper(parameter[i]->GetParameterType());
+        switch ( newValtype ) {
+            case 'I': 
+                if( arg2.type == CONSTINT ) {
+                    return CompareInt( newVal[i].I, op, arg2.I );
+                } else {
+                    G4cerr << "integer operand expected for "
+                         <<  rangeString 
+                         << '.' << G4endl;
+                } break;
+            case 'D':
+                if( arg2.type == CONSTDOUBLE ) {
+                    return CompareDouble( newVal[i].D, op, arg2.D );
+                } else
+                if ( arg2.type == CONSTINT ) {  // integral promotion
+                    return CompareDouble( newVal[i].D, op, arg2.I );
+                } break;
+            default: ;
+        }
+    }
+    if( arg2.type == IDENTIFIER) {
+        unsigned i = IndexOf( arg2.S );
+        newValtype = toupper(parameter[i]->GetParameterType());
+        switch ( newValtype ) {
+            case 'I': 
+                if( arg1.type == CONSTINT ) {
+                    return CompareInt( arg1.I, op, newVal[i].I );
+                } else {
+                    G4cerr << "integer operand expected for "
+                         <<  rangeString
+                         << '.' << G4endl;
+                } break;
+            case 'D':
+                if( arg1.type == CONSTDOUBLE ) {
+                    return CompareDouble( arg1.D, op, newVal[i].D );
+                } else
+                if ( arg1.type == CONSTINT ) {  // integral promotion
+                    return CompareDouble( arg1.I, op, newVal[i].D );
+                } break;
+            default: ;
+        }
+    }
+    return 0;
+}
+
+G4int G4UIcommand::
+CompareInt(G4int arg1, G4int op, G4int arg2)
+{   
+    G4int result=-1;
+    G4String opr;
+    switch (op) {
+       case GT:  result = ( arg1 >  arg2); opr= ">" ;  break;
+       case GE:  result = ( arg1 >= arg2); opr= ">=";  break;
+       case LT:  result = ( arg1 <  arg2); opr= "<" ;  break;
+       case LE:  result = ( arg1 <= arg2); opr= "<=";  break;
+       case EQ:  result = ( arg1 == arg2); opr= "==";  break;
+       case NE:  result = ( arg1 != arg2); opr= "!=";  break;
+       default: 
+           G4cerr << "Parameter range: error at CompareInt" << G4endl;
+           paramERR = 1;
+    }
+    #ifdef DEBUG
+        G4cerr << "CompareInt "
+             << arg1 << " " << opr << arg2 
+             << " result: " << result
+             << G4endl;
+    #endif
+    return result;
+}
+
+G4int G4UIcommand::
+CompareDouble(G4double arg1, G4int op, G4double arg2)
+{   
+    G4int result=-1;
+    G4String opr;
+    switch (op) {
+        case GT:  result = ( arg1 >  arg2); opr= ">";   break;
+        case GE:  result = ( arg1 >= arg2); opr= ">=";  break;
+        case LT:  result = ( arg1 <  arg2); opr= "<";   break;
+        case LE:  result = ( arg1 <= arg2); opr= "<=";  break;
+        case EQ:  result = ( arg1 == arg2); opr= "==";  break;
+        case NE:  result = ( arg1 != arg2); opr= "!=";  break;
+        default:
+           G4cerr << "Parameter range: error at CompareDouble"
+                << G4endl;
+           paramERR = 1;
+    }
+    #ifdef DEBUG
+        G4cerr << "CompareDouble " 
+             << arg1 <<" " << opr << " "<< arg2
+             << " result: " << result
+             << G4endl;
+    #endif
+    return result;
+}
+
+unsigned G4UIcommand::
+IndexOf(const char* nam)
+{
+    unsigned i;
+    G4String pname;
+    for( i=0;  i<parameter.size(); i++)
+    {
+        pname = parameter[i]-> GetParameterName();
+        if( pname == nam ) {
+            return i;
+        }
+    }
+    paramERR = 1;
+    G4cerr << "parameter name:"<<nam<<" not found."<< G4endl;
+    return 0;
+}
+
+
+unsigned G4UIcommand::
+IsParameter(const char* nam)
+{
+    G4String pname;
+    for(unsigned i=0;  i<parameter.size(); i++)  
+    {
+        pname = parameter[i]-> GetParameterName();
+        if( pname == nam ) return 1;
+    }
+    return 0;
+}
+
+
+// --------------------- utility functions --------------------------
+
+tokenNum G4UIcommand::
+Yylex()         // reads input and returns token number, KR486
+{               // (returns EOF)
+    G4int c;             
+    G4String buf;
+
+    while(( c= G4UIpGetc())==' '|| c=='\t' || c== '\n' )
+        ;
+    if (c== EOF)
+        return (tokenNum)EOF;            // KR488 
+    buf= "";
+    if (isdigit(c) || c== '.') {         // I or D
+        do {
+             buf += G4String((unsigned char)c);
+             c=G4UIpGetc();
+         }  while (c=='.' || isdigit(c) || 
+                   c=='e' || c=='E' || c=='+' || c=='-');
+         G4UIpUngetc(c);
+         const char* t = buf;
+	 std::istringstream is(t);
+         if ( IsInt(buf.data(),20) ) {
+             is >> yylval.I;
+             return  CONSTINT;
+         } else 
+         if ( IsDouble(buf.data()) ) {
+             is >> yylval.D;
+             return  CONSTDOUBLE;
+         } else {
+             G4cerr << buf<<": numeric format error."<<G4endl;
+         }
+    }
+    buf="";
+    if (isalpha(c)|| c=='_') {           // IDENTIFIER
+        do {
+            buf += G4String((unsigned char)c); 
+        } while ((c=G4UIpGetc()) != EOF && (isalnum(c) || c=='_'));
+        G4UIpUngetc(c);
+        if( IsParameter(buf) ) {
+            yylval.S =buf;
+            return IDENTIFIER;
+        } else {
+            G4cerr << buf << " is not a parameter name."<< G4endl;
+            paramERR = 1;
+       }
+    }
+    switch (c) {
+      case '>':   return (tokenNum) Follow('=', GE,        GT);
+      case '<':   return (tokenNum) Follow('=', LE,        LT);
+      case '=':   return (tokenNum) Follow('=', EQ,        '=');
+      case '!':   return (tokenNum) Follow('=', NE,        '!');
+      case '|':   return (tokenNum) Follow('|', LOGICALOR, '|');
+      case '&':   return (tokenNum) Follow('&', LOGICALAND, '&');
+      default:
+          return (tokenNum) c;
+    }
+}
+
+
+G4int G4UIcommand::
+Follow(G4int expect, G4int ifyes, G4int ifno)
+{
+    G4int c = G4UIpGetc();
+    if ( c== expect)
+          return ifyes;
+    G4UIpUngetc(c);
+    return ifno;
+}
+
+//------------------ low level routines -----------------------------
+G4int G4UIcommand::
+G4UIpGetc() {                        // emulation of getc() 
+    G4int length = rangeString.length();
+    if( bp < length)
+        return  rangeString(bp++);
+    else 
+        return EOF;
+}
+G4int G4UIcommand::
+G4UIpUngetc(G4int c) {                 // emulation of ungetc() 
+    if (c<0) return -1;
+    if (bp >0 && c == rangeString(bp-1)) {
+         --bp;
+    } else {
+         G4cerr << "G4UIpUngetc() failed." << G4endl;
+         G4cerr << "bp="<<bp <<" c="<<c
+              << " pR(bp-1)=" << rangeString(bp-1)
+              << G4endl;
+         paramERR = 1;
+         return -1;
+    }
+    return 0;
+}
Index: trunk/source/intercoms/src/G4UIcommandTree.cc
===================================================================
--- trunk/source/intercoms/src/G4UIcommandTree.cc	(revision 821)
+++ trunk/source/intercoms/src/G4UIcommandTree.cc	(revision 821)
@@ -0,0 +1,363 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcommandTree.cc,v 1.13 2006/06/29 19:08:58 gunter Exp $
+// GEANT4 tag $Name: geant4-09-01-patch-02 $
+//
+
+#include "G4UIcommandTree.hh"
+#include "G4StateManager.hh"
+#include <fstream>
+#include "G4ios.hh"
+
+G4UIcommandTree::G4UIcommandTree()
+:guidance(NULL)
+{ }
+
+G4UIcommandTree::G4UIcommandTree(const char * thePathName)
+:guidance(NULL)
+{
+  pathName = thePathName;
+}
+
+G4UIcommandTree::~G4UIcommandTree()
+{
+  G4int i;
+  G4int n_treeEntry = tree.size();
+  for( i=0; i < n_treeEntry; i++ )
+  { delete tree[i]; }
+}
+
+G4int G4UIcommandTree::operator==(const G4UIcommandTree &right) const
+{
+  return ( pathName == right.GetPathName() );
+}
+
+G4int G4UIcommandTree::operator!=(const G4UIcommandTree &right) const
+{
+  return ( pathName != right.GetPathName() );
+}
+
+void G4UIcommandTree::AddNewCommand(G4UIcommand *newCommand)
+{
+  G4String commandPath = newCommand->GetCommandPath();
+  G4String remainingPath = commandPath;
+  remainingPath.remove(0,pathName.length());
+  if( remainingPath.isNull() )
+  {
+    guidance = newCommand;
+    return;
+  }
+  G4int i = remainingPath.first('/');
+  if( i == G4int(std::string::npos) )
+  {
+    // Find command
+    G4int n_commandEntry = command.size();
+    for( G4int i_thCommand = 0; i_thCommand < n_commandEntry; i_thCommand++ )
+    {
+      if( remainingPath == command[i_thCommand]->GetCommandName() )
+      { return; }
+    }
+    command.push_back( newCommand );
+    return;
+  }
+  else
+  {
+    // Find path
+    G4String nextPath = pathName;
+    nextPath.append(remainingPath(0,i+1));
+    G4int n_treeEntry = tree.size();
+    for( G4int i_thTree = 0; i_thTree < n_treeEntry; i_thTree++ )
+    {
+      if( nextPath == tree[i_thTree]->GetPathName() )
+      { 
+	tree[i_thTree]->AddNewCommand( newCommand );
+	return; 
+      }
+    }
+    G4UIcommandTree * newTree = new G4UIcommandTree( nextPath );
+    tree.push_back( newTree );
+    newTree->AddNewCommand( newCommand );
+    return;
+  }
+}
+
+void G4UIcommandTree::RemoveCommand(G4UIcommand *aCommand)
+{
+  G4String commandPath = aCommand->GetCommandPath();
+  G4String remainingPath = commandPath;
+  remainingPath.remove(0,pathName.length());
+  if( remainingPath.isNull() )
+  {
+    guidance = NULL;
+  }
+  else
+  {
+    G4int i = remainingPath.first('/');
+    if( i == G4int(std::string::npos) )
+    {
+      // Find command
+      G4int n_commandEntry = command.size();
+      for( G4int i_thCommand = 0; i_thCommand < n_commandEntry; i_thCommand++ )
+      {
+        if( remainingPath == command[i_thCommand]->GetCommandName() )
+        { 
+          command.erase(command.begin()+i_thCommand);
+          break;
+        }
+      }
+    }
+    else
+    {
+      // Find path
+      G4String nextPath = pathName;
+      nextPath.append(remainingPath(0,i+1));
+      G4int n_treeEntry = tree.size();
+      for( G4int i_thTree = 0; i_thTree < n_treeEntry; i_thTree++ )
+      {
+        if( nextPath == tree[i_thTree]->GetPathName() )
+        { 
+    	  tree[i_thTree]->RemoveCommand( aCommand );
+    	  G4int n_commandRemain = tree[i_thTree]->GetCommandEntry();
+    	  if(n_commandRemain==0)
+    	  {
+    	    G4UIcommandTree * emptyTree = tree[i_thTree];
+    	    tree.erase(tree.begin()+i_thTree);
+    	    delete emptyTree;
+    	  }
+    	  break;
+        }
+      }
+    }
+  }
+}
+
+G4UIcommand * G4UIcommandTree::FindPath(const char* commandPath)
+{
+  G4String remainingPath = commandPath;
+  if( remainingPath.index( pathName ) == std::string::npos )
+  { return NULL; }
+  remainingPath.remove(0,pathName.length());
+  G4int i = remainingPath.first('/');
+  if( i == G4int(std::string::npos) )
+  {
+    // Find command
+    G4int n_commandEntry = command.size();
+    for( G4int i_thCommand = 0; i_thCommand < n_commandEntry; i_thCommand++ )
+    {
+      if( remainingPath == command[i_thCommand]->GetCommandName() )
+      { return command[i_thCommand]; }
+    }
+  }
+  else
+  {
+    // Find path
+    G4String nextPath = pathName;
+    nextPath.append(remainingPath(0,i+1));
+    G4int n_treeEntry = tree.size();
+    for( G4int i_thTree = 0; i_thTree < n_treeEntry; i_thTree++ )
+    {
+      if( nextPath == tree[i_thTree]->GetPathName() )
+      { return tree[i_thTree]->FindPath( commandPath ); }
+    }
+  }
+  return NULL;
+}
+
+void G4UIcommandTree::ListCurrent()
+{
+  G4cout << "Command directory path : " << pathName << G4endl;
+  if( guidance != NULL ) guidance->List();
+  G4cout << " Sub-directories : " << G4endl;
+  G4int n_treeEntry = tree.size();
+  for( G4int i_thTree = 0; i_thTree < n_treeEntry; i_thTree++ )
+  {
+    G4cout << "   " << tree[i_thTree]->GetPathName() 
+	 << "   " << tree[i_thTree]->GetTitle() << G4endl;
+  }
+  G4cout << " Commands : " << G4endl;
+  G4int n_commandEntry = command.size();
+  for( G4int i_thCommand = 0; i_thCommand < n_commandEntry; i_thCommand++ )
+  {
+    G4cout << "   " << command[i_thCommand]->GetCommandName() 
+	 << " * " << command[i_thCommand]->GetTitle() << G4endl;
+  }
+}
+
+void G4UIcommandTree::ListCurrentWithNum()
+{
+  G4cout << "Command directory path : " << pathName << G4endl;
+  if( guidance != NULL ) guidance->List();
+  G4int i = 0;
+  G4cout << " Sub-directories : " << G4endl;
+  G4int n_treeEntry = tree.size();
+  for( G4int i_thTree = 0; i_thTree < n_treeEntry; i_thTree++ )
+  {
+    i++;
+    G4cout << " " << i << ") " << tree[i_thTree]->GetPathName() 
+	 << "   " << tree[i_thTree]->GetTitle() << G4endl;
+  }
+  G4cout << " Commands : " << G4endl;
+  G4int n_commandEntry = command.size();
+  for( G4int i_thCommand = 0; i_thCommand < n_commandEntry; i_thCommand++ )
+  {
+    i++;
+    G4cout << " " << i << ") " << command[i_thCommand]->GetCommandName() 
+	 << " * " << command[i_thCommand]->GetTitle() << G4endl;
+  }
+}
+
+void G4UIcommandTree::List()
+{
+  ListCurrent();
+  G4int n_commandEntry = command.size();
+  for( G4int i_thCommand = 0; i_thCommand < n_commandEntry; i_thCommand++ )
+  {
+    command[i_thCommand]->List();
+  }
+  G4int n_treeEntry = tree.size();
+  for( G4int i_thTree = 0; i_thTree < n_treeEntry; i_thTree++ )
+  {
+    tree[i_thTree]->List();
+  }
+}
+
+G4String G4UIcommandTree::CreateFileName(const char* pName)
+{
+  G4String fn = pName;
+  G4int idxs;
+  while((idxs=fn.index("/"))!=G4int(std::string::npos))
+  { fn(idxs) = '_'; }
+  fn += ".html";
+  return fn;
+}
+
+G4String G4UIcommandTree::ModStr(const char* strS)
+{
+  G4String sx;
+  G4String str = strS;
+  for(G4int i=0;i<G4int(str.length());i++)
+  {
+    char c = str(i);
+    switch(c)
+    {
+    case '<':
+      sx += "&lt;"; break;
+    case '>':
+      sx += "&gt;"; break;
+    case '&':
+      sx += "&amp;"; break;
+    default:
+      sx += c;
+    }
+  }
+  return sx;
+}
+
+void G4UIcommandTree::CreateHTML()
+{
+  G4String ofileName = CreateFileName(pathName);
+  std::ofstream oF(ofileName, std::ios::out);
+
+  oF << "<html><head><title>Commands in " << ModStr(pathName) << "</title></head>" << G4endl;
+  oF << "<body bgcolor=\"#ffffff\"><h2>" << ModStr(pathName) << "</h2><p>" << G4endl;
+
+  if( guidance != NULL ) 
+  {
+    for(G4int i=0;i<guidance->GetGuidanceEntries();i++)
+    { oF << ModStr(guidance->GetGuidanceLine(i)) << "<br>" << G4endl; }
+  }
+
+  oF << "<p><hr><p>" << G4endl;
+  
+  oF << "<h2>Sub-directories : </h2><dl>" << G4endl;
+  for( G4int i_thTree = 0; i_thTree < G4int(tree.size()); i_thTree++ )
+  {
+    oF << "<p><br><p><dt><a href=\"" << CreateFileName(tree[i_thTree]->GetPathName())
+       << "\">" << ModStr(tree[i_thTree]->GetPathName()) << "</a>" << G4endl;
+    oF << "<p><dd>" << ModStr(tree[i_thTree]->GetTitle()) << G4endl;
+    tree[i_thTree]->CreateHTML();
+  }
+
+  oF << "</dl><p><hr><p>" << G4endl;
+  
+  oF << "<h2>Commands : </h2><dl>" << G4endl;
+  for( G4int i_thCommand = 0; i_thCommand < G4int(command.size()); i_thCommand++ )
+  {
+    G4UIcommand* cmd = command[i_thCommand];
+    oF << "<p><br><p><dt><b>" << ModStr(cmd->GetCommandName());
+    if(cmd->GetParameterEntries()>0)
+    {
+      for(G4int i_thParam=0;i_thParam<cmd->GetParameterEntries();i_thParam++)
+      { oF << " [<i>" << ModStr(cmd->GetParameter(i_thParam)->GetParameterName()) << "</i>]"; }
+    }
+    oF << "</b>" << G4endl;
+    oF << "<p><dd>" << G4endl;
+    for(G4int i=0;i<cmd->GetGuidanceEntries();i++)
+    { oF << ModStr(cmd->GetGuidanceLine(i)) << "<br>" << G4endl; }
+    if(!(cmd->GetRange()).isNull())
+    { oF << "<p><dd>Range : " << ModStr(cmd->GetRange()) << G4endl; }
+    std::vector<G4ApplicationState>* availabelStateList = cmd->GetStateList();
+    if(availabelStateList->size()==6)
+    { oF << "<p><dd>Available at all Geant4 states." << G4endl; }
+    else
+    {
+      oF << "<p><dd>Available Geant4 state(s) : ";
+      for(G4int ias=0;ias<G4int(availabelStateList->size());ias++)
+      { oF << G4StateManager::GetStateManager()->GetStateString((*availabelStateList)[ias]) << " " << G4endl; }
+    }
+    if(cmd->GetParameterEntries()>0)
+    {
+      oF << "<p><dd>Parameters<table border=1>" << G4endl;
+      for(G4int i_thParam=0;i_thParam<cmd->GetParameterEntries();i_thParam++)
+      {
+        G4UIparameter* prm = cmd->GetParameter(i_thParam);
+        oF << "<tr><td>" << ModStr(prm->GetParameterName()) << G4endl;
+        oF << "<td>type " << prm->GetParameterType() << G4endl;
+        oF << "<td>";
+        if(prm->IsOmittable())
+        { 
+          oF << "Omittable : ";
+          if(prm->GetCurrentAsDefault())
+          { oF << "current value is used as the default value." << G4endl; }
+          else
+          { oF << "default value = " << prm->GetDefaultValue() << G4endl; }
+        }
+        oF << "<td>";
+        if(!(prm->GetParameterRange()).isNull())
+        { oF << "Parameter range : " << ModStr(prm->GetParameterRange()) << G4endl; }
+        else if(!(prm->GetParameterCandidates()).isNull())
+        { oF << "Parameter candidates : " << ModStr(prm->GetParameterCandidates()) << G4endl; }
+      }
+      oF << "</table>" << G4endl;
+    }
+
+  }
+  
+  oF << "</dl></body></html>" << G4endl;
+  oF.close();
+}
+
Index: trunk/source/intercoms/src/G4UIcontrolMessenger.cc
===================================================================
--- trunk/source/intercoms/src/G4UIcontrolMessenger.cc	(revision 821)
+++ trunk/source/intercoms/src/G4UIcontrolMessenger.cc	(revision 821)
@@ -0,0 +1,276 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIcontrolMessenger.cc,v 1.11 2007/06/06 15:14:51 asaim Exp $
+// GEANT4 tag $Name:  $
+//
+
+#include <stdlib.h>
+#include "G4UIcontrolMessenger.hh"
+#include "G4UImanager.hh"
+#include "G4UIdirectory.hh"
+#include "G4UIcommand.hh"
+#include "G4UIparameter.hh"
+#include "G4UIcmdWithAString.hh"
+#include "G4UIcmdWithAnInteger.hh"
+#include "G4UIcmdWithoutParameter.hh"
+#include "G4UIaliasList.hh"
+#include "G4StateManager.hh"
+#include "G4ios.hh"
+
+G4UIcontrolMessenger::G4UIcontrolMessenger()
+{
+  controlDirectory = new G4UIdirectory("/control/");
+  controlDirectory->SetGuidance("UI control commands.");
+
+  ExecuteCommand = new G4UIcmdWithAString("/control/execute",this);
+  ExecuteCommand->SetGuidance("Execute a macro file.");
+  ExecuteCommand->SetParameterName("fileName",false);
+
+  loopCommand = new G4UIcommand("/control/loop",this);
+  loopCommand->SetGuidance("Execute a macro file more than once.");
+  loopCommand->SetGuidance("Loop counter can be used as an aliased variable.");
+  G4UIparameter* param1 = new G4UIparameter("macroFile",'s',false);
+  loopCommand->SetParameter(param1);
+  G4UIparameter* param2 = new G4UIparameter("counterName",'s',false);
+  loopCommand->SetParameter(param2);
+  G4UIparameter* param3 = new G4UIparameter("initialValue",'d',false);
+  loopCommand->SetParameter(param3);
+  G4UIparameter* param4 = new G4UIparameter("finalValue",'d',false);
+  loopCommand->SetParameter(param4);
+  G4UIparameter* param5 = new G4UIparameter("stepSize",'d',true);
+  param5->SetDefaultValue(1.0);
+  loopCommand->SetParameter(param5);
+
+  foreachCommand = new G4UIcommand("/control/foreach",this);
+  foreachCommand->SetGuidance("Execute a macro file more than once.");
+  foreachCommand->SetGuidance("Loop counter can be used as an aliased variable.");
+  foreachCommand->SetGuidance("Values must be separated by a space.");
+  G4UIparameter* param6 = new G4UIparameter("macroFile",'s',false);
+  foreachCommand->SetParameter(param6);
+  G4UIparameter* param7 = new G4UIparameter("counterName",'s',false);
+  foreachCommand->SetParameter(param7);
+  G4UIparameter* param8 = new G4UIparameter("valueList",'s',false);
+  foreachCommand->SetParameter(param8);
+  
+  suppressAbortionCommand = new G4UIcmdWithAnInteger("/control/suppressAbortion",this);
+  suppressAbortionCommand->SetGuidance("Suppress the program abortion caused by G4Exception.");
+  suppressAbortionCommand->SetGuidance("Suppression level = 0 : no suppression");
+  suppressAbortionCommand->SetGuidance("                  = 1 : suppress during EventProc state");
+  suppressAbortionCommand->SetGuidance("                  = 2 : full suppression, i.e. no abortion by G4Exception");
+  suppressAbortionCommand->SetGuidance("When abortion is suppressed, you will get error messages issued by G4Exception,");
+  suppressAbortionCommand->SetGuidance("and there is NO guarantee for the correct result after the G4Exception error message.");
+  suppressAbortionCommand->SetParameterName("level",true);
+  suppressAbortionCommand->SetRange("level >= 0 && level <= 2");
+  suppressAbortionCommand->SetDefaultValue(0);
+
+  verboseCommand = new G4UIcmdWithAnInteger("/control/verbose",this);
+  verboseCommand->SetGuidance("Applied command will also be shown on screen.");
+  verboseCommand->SetGuidance("This command is useful with MACRO file.");
+  verboseCommand->SetGuidance("  0 : silent");
+  verboseCommand->SetGuidance("  1 : only the valid commands are shown.");
+  verboseCommand->SetGuidance("  2 : comment lines are also shown (default).");
+  verboseCommand->SetParameterName("switch",true);
+  verboseCommand->SetRange("switch >= 0 && switch <=2");
+  verboseCommand->SetDefaultValue(2);
+  
+  historyCommand = new G4UIcmdWithAString("/control/saveHistory",this);
+  historyCommand->SetGuidance("Store command history to a file.");
+  historyCommand->SetGuidance("Defaul file name is G4history.macro.");
+  historyCommand->SetParameterName("fileName",true);
+  historyCommand->SetDefaultValue("G4History.macro");
+  
+  stopStoreHistoryCommand 
+    = new G4UIcmdWithoutParameter("/control/stopSavingHistory",this);
+  stopStoreHistoryCommand->SetGuidance("Stop saving history file.");
+
+  aliasCommand = new G4UIcommand("/control/alias",this);
+  aliasCommand->SetGuidance("Set an alias.");
+  aliasCommand->SetGuidance("String can be aliased by this command.");
+  aliasCommand->SetGuidance("The string may contain one or more spaces,");
+  aliasCommand->SetGuidance("the string must be enclosed by double quotes (\").");
+  aliasCommand->SetGuidance("To use an alias, enclose the alias name with");
+  aliasCommand->SetGuidance("parenthis \"{\" and \"}\".");
+  G4UIparameter* aliasNameParam = new G4UIparameter("aliasName",'s',false);
+  aliasCommand->SetParameter(aliasNameParam);
+  G4UIparameter* aliasValueParam = new G4UIparameter("aliasValue",'s',false);
+  aliasCommand->SetParameter(aliasValueParam);
+
+  unaliasCommand = new G4UIcmdWithAString("/control/unalias",this);
+  unaliasCommand->SetGuidance("Remove an alias.");
+  unaliasCommand->SetParameterName("aliasName",false);
+
+  listAliasCommand = new G4UIcmdWithoutParameter("/control/listAlias",this);
+  listAliasCommand->SetGuidance("List aliases.");
+
+  getEnvCmd = new G4UIcmdWithAString("/control/getEnv",this);
+  getEnvCmd->SetGuidance("Get a shell environment variable and define it as an alias.");
+
+  echoCmd = new G4UIcmdWithAString("/control/echo",this);
+  echoCmd->SetGuidance("Display the aliased value.");
+
+  shellCommand = new G4UIcmdWithAString("/control/shell",this);
+  shellCommand->SetGuidance("Execute a (Unix) SHELL command.");
+
+  ManualCommand = new G4UIcmdWithAString("/control/manual",this);
+  ManualCommand->SetGuidance("Display all of sub-directories and commands.");
+  ManualCommand->SetGuidance("Directory path should be given by FULL-PATH.");
+  ManualCommand->SetParameterName("dirPath",true);
+  ManualCommand->SetDefaultValue("/");
+
+  HTMLCommand = new G4UIcmdWithAString("/control/createHTML",this);
+  HTMLCommand->SetGuidance("Generate HTML files for all of sub-directories and commands.");
+  HTMLCommand->SetGuidance("Directory path should be given by FULL-PATH.");
+  HTMLCommand->SetParameterName("dirPath",true);
+  HTMLCommand->SetDefaultValue("/");
+
+  maxStoredHistCommand = new G4UIcmdWithAnInteger("/control/maximumStoredHistory",this);
+  maxStoredHistCommand->SetGuidance("Set maximum number of stored UI commands.");
+  maxStoredHistCommand->SetParameterName("max",true);
+  maxStoredHistCommand->SetDefaultValue(20);
+}
+
+G4UIcontrolMessenger::~G4UIcontrolMessenger()
+{
+  delete ExecuteCommand;
+  delete suppressAbortionCommand;
+  delete verboseCommand;
+  delete historyCommand;
+  delete stopStoreHistoryCommand;
+  delete ManualCommand;
+  delete aliasCommand;
+  delete unaliasCommand;
+  delete listAliasCommand;
+  delete getEnvCmd;
+  delete echoCmd;
+  delete shellCommand;
+  delete loopCommand;
+  delete foreachCommand; 
+  delete HTMLCommand;
+  delete maxStoredHistCommand;
+  delete controlDirectory;
+}
+
+void G4UIcontrolMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
+{
+  G4UImanager * UI = G4UImanager::GetUIpointer();
+  
+  if(command==ExecuteCommand)
+  {
+    UI->ExecuteMacroFile(newValue);
+  }
+  if(command==suppressAbortionCommand)
+  {
+    G4StateManager::GetStateManager()->SetSuppressAbortion(suppressAbortionCommand->GetNewIntValue(newValue));
+  }
+  if(command==verboseCommand)
+  {
+    UI->SetVerboseLevel(verboseCommand->GetNewIntValue(newValue));
+  }
+  if(command==historyCommand)
+  {
+  	UI->StoreHistory(newValue);
+  }
+  if(command==stopStoreHistoryCommand)
+  {
+  	UI->StoreHistory(false);
+  }
+  if(command==ManualCommand)
+  {
+    UI->ListCommands(newValue);
+  }
+  if(command==aliasCommand)
+  {
+    UI->SetAlias(newValue);
+  }
+  if(command==unaliasCommand)
+  {
+    UI->RemoveAlias(newValue);
+  }
+  if(command==listAliasCommand)
+  {
+    UI->ListAlias();
+  }
+  if(command==getEnvCmd)
+  {
+    if(getenv(newValue))
+    { 
+      G4String st = "/control/alias ";
+      st += newValue;
+      st += " ";
+      st += getenv(newValue);
+      UI->ApplyCommand(st);
+    }
+    else
+    { G4cerr << "<" << newValue << "> is not defined as a shell variable. Command ignored." << G4endl; }
+  }
+  if(command==echoCmd)
+  { G4cout << UI->SolveAlias(newValue) << G4endl; }
+  if(command==shellCommand)
+  {
+    system(newValue);
+  }
+  if(command==loopCommand)
+  {
+    UI->LoopS(newValue);
+  }
+  if(command==foreachCommand)
+  {
+    UI->ForeachS(newValue);
+  }
+  if(command==HTMLCommand)
+  {
+    UI->CreateHTML(newValue);
+  }
+  if(command==maxStoredHistCommand)
+  {
+    UI->SetMaxHistSize(maxStoredHistCommand->GetNewIntValue(newValue));
+  }
+
+}
+
+G4String G4UIcontrolMessenger::GetCurrentValue(G4UIcommand * command)
+{
+  G4UImanager * UI = G4UImanager::GetUIpointer();
+  G4String currentValue;
+  
+  if(command==verboseCommand)
+  {
+    currentValue = verboseCommand->ConvertToString(UI->GetVerboseLevel());
+  }
+  if(command==suppressAbortionCommand)
+  {
+    currentValue = suppressAbortionCommand->ConvertToString(G4StateManager::GetStateManager()->GetSuppressAbortion());
+  }
+  if(command==maxStoredHistCommand)
+  {
+    currentValue = maxStoredHistCommand->ConvertToString(UI->GetMaxHistSize());
+  }
+  
+  return currentValue;
+}
+
+
Index: trunk/source/intercoms/src/G4UIdirectory.cc
===================================================================
--- trunk/source/intercoms/src/G4UIdirectory.cc	(revision 821)
+++ trunk/source/intercoms/src/G4UIdirectory.cc	(revision 821)
@@ -0,0 +1,41 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIdirectory.cc,v 1.4 2006/06/29 19:09:02 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+//
+
+#include "G4UIdirectory.hh"
+
+G4UIdirectory::G4UIdirectory(char * theCommandPath)
+:G4UIcommand(theCommandPath,NULL)
+{;}
+
+G4UIdirectory::G4UIdirectory(const char * theCommandPath)
+:G4UIcommand(theCommandPath,NULL)
+{;}
+
Index: trunk/source/intercoms/src/G4UImanager.cc
===================================================================
--- trunk/source/intercoms/src/G4UImanager.cc	(revision 821)
+++ trunk/source/intercoms/src/G4UImanager.cc	(revision 821)
@@ -0,0 +1,550 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UImanager.cc,v 1.33 2007/07/16 10:14:36 kmura Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// ---------------------------------------------------------------------
+
+#include "G4UImanager.hh"
+#include "G4UIcommandTree.hh"
+#include "G4UIcommand.hh"
+#include "G4UIsession.hh"
+#include "G4UIbatch.hh"
+#include "G4UIcontrolMessenger.hh"
+#include "G4UnitsMessenger.hh"
+#include "G4ios.hh"
+#include "G4strstreambuf.hh"
+#include "G4StateManager.hh"
+#include "G4UIaliasList.hh"
+#include "G4Tokenizer.hh"
+
+#include <sstream>
+
+
+G4UImanager * G4UImanager::fUImanager = 0;
+G4bool G4UImanager::fUImanagerHasBeenKilled = false;
+
+G4UImanager * G4UImanager::GetUIpointer()
+{
+  if(!fUImanager) 
+  {
+    if(!fUImanagerHasBeenKilled)
+    {
+      fUImanager = new G4UImanager;
+      fUImanager->CreateMessenger();
+    }
+  }
+  return fUImanager;
+}
+
+G4UImanager::G4UImanager()
+:G4VStateDependent(true)
+{
+  savedCommand = 0;
+  treeTop = new G4UIcommandTree("/");
+  aliasList = new G4UIaliasList;
+  G4String nullString;
+  savedParameters = nullString;
+  verboseLevel = 0;
+  saveHistory = false;
+  session = NULL;
+  SetCoutDestination(session);
+  pauseAtBeginOfEvent = false;
+  pauseAtEndOfEvent = false;
+  maxHistSize = 20;
+}
+
+void G4UImanager::CreateMessenger()
+{
+  UImessenger = new G4UIcontrolMessenger;
+  UnitsMessenger = new G4UnitsMessenger;
+}
+
+G4UImanager::~G4UImanager()
+{
+  SetCoutDestination(NULL);
+  histVec.clear();
+  if(saveHistory) historyFile.close();
+  delete UImessenger;
+  delete UnitsMessenger;
+  delete treeTop;
+  delete aliasList;
+  fUImanagerHasBeenKilled = true;
+  fUImanager = NULL;
+}
+
+G4UImanager::G4UImanager(const G4UImanager &)
+:G4VStateDependent(true) {;}
+const G4UImanager & G4UImanager::operator=(const G4UImanager &right)
+{ return right; }
+G4int G4UImanager::operator==(const G4UImanager &right) const
+{ return (this==&right); }
+G4int G4UImanager::operator!=(const G4UImanager &right) const
+{ return (this!=&right); }
+
+G4String G4UImanager::GetCurrentValues(const char * aCommand)
+{
+  G4String theCommand = aCommand;
+  savedCommand = treeTop->FindPath( theCommand );
+  if( savedCommand == NULL ) 
+  {
+    G4cerr << "command not found" << G4endl;
+    return G4String();
+  }
+  return savedCommand->GetCurrentValue();
+}
+
+G4String G4UImanager::GetCurrentStringValue(const char * aCommand, 
+G4int parameterNumber, G4bool reGet)
+{
+  if(reGet || savedCommand == NULL)
+  {
+    savedParameters = GetCurrentValues( aCommand );
+  }
+  G4Tokenizer savedToken( savedParameters );
+  G4String token;
+  for(G4int i_thParameter=0;i_thParameter<parameterNumber;i_thParameter++)
+  {
+    token = savedToken();
+    if( token.isNull() ) return G4String();
+    if( token[(size_t)0] == '"' )
+    {
+      token.append(" ");
+      token.append(savedToken("\""));
+    }
+  }
+  return token;
+}
+
+G4String G4UImanager::GetCurrentStringValue(const char * aCommand, 
+const char * aParameterName, G4bool reGet)
+{
+  if(reGet || savedCommand == NULL)
+  {
+    G4String parameterValues = GetCurrentValues( aCommand );
+  }
+  for(G4int i=0;i<savedCommand->GetParameterEntries();i++)
+  {
+    if( aParameterName ==
+      savedCommand->GetParameter(i)->GetParameterName() )
+      return GetCurrentStringValue(aCommand,i+1,false);
+  }
+  return G4String();
+}
+
+G4int G4UImanager::GetCurrentIntValue(const char * aCommand,
+const char * aParameterName, G4bool reGet)
+{
+  G4String targetParameter = 
+     GetCurrentStringValue( aCommand, aParameterName, reGet );
+  G4int value;
+  const char* t = targetParameter;
+  std::istringstream is(t);
+  is >> value;
+  return value;
+}
+
+G4int G4UImanager::GetCurrentIntValue(const char * aCommand,
+G4int parameterNumber, G4bool reGet)
+{
+  G4String targetParameter = 
+     GetCurrentStringValue( aCommand, parameterNumber, reGet );
+  G4int value;
+  const char* t = targetParameter;
+  std::istringstream is(t);
+  is >> value;
+  return value;
+}
+
+G4double G4UImanager::GetCurrentDoubleValue(const char * aCommand,
+const char * aParameterName, G4bool reGet)
+{
+  G4String targetParameter = 
+     GetCurrentStringValue( aCommand, aParameterName, reGet );
+  G4double value;
+  const char* t = targetParameter;
+  std::istringstream is(t);
+  is >> value;
+  return value;
+}
+
+G4double G4UImanager::GetCurrentDoubleValue(const char * aCommand,
+G4int parameterNumber, G4bool reGet)
+{
+  G4String targetParameter = 
+     GetCurrentStringValue( aCommand, parameterNumber, reGet );
+  G4double value;
+  const char* t = targetParameter;
+  std::istringstream is(t);
+  is >> value;
+  return value;
+}
+
+void G4UImanager::AddNewCommand(G4UIcommand * newCommand)
+{
+  treeTop->AddNewCommand( newCommand );
+}
+
+void G4UImanager::RemoveCommand(G4UIcommand * aCommand)
+{
+  treeTop->RemoveCommand( aCommand );
+}
+
+void G4UImanager::ExecuteMacroFile(const char * fileName)
+{
+  G4UIsession* batchSession = new G4UIbatch(fileName,session);
+  session = batchSession;
+  G4UIsession* previousSession = session->SessionStart();
+  delete session;
+  session = previousSession;
+}
+
+void G4UImanager::LoopS(const char* valueList)
+{
+  G4String vl = valueList;
+  G4Tokenizer parameterToken(vl);
+  G4String mf = parameterToken();
+  G4String vn = parameterToken();
+  G4String c1 = parameterToken();
+  c1 += " ";
+  c1 += parameterToken();
+  c1 += " ";
+  c1 += parameterToken();
+  const char* t1 = c1;
+  std::istringstream is(t1);
+  G4double d1;
+  G4double d2;
+  G4double d3;
+  is >> d1 >> d2 >> d3;
+  Loop(mf,vn,d1,d2,d3);
+}
+  
+void G4UImanager::Loop(const char * macroFile,const char * variableName,
+                   G4double initialValue,G4double finalValue,G4double stepSize)
+{
+  G4String cd;
+  if (stepSize > 0) {
+    for(G4double d=initialValue;d<=finalValue;d+=stepSize)
+      {
+	std::ostringstream os;
+	os << d;
+	cd += os.str();
+	cd += " ";
+      }
+  } else {
+    for(G4double d=initialValue;d>=finalValue;d+=stepSize)
+      {
+	std::ostringstream os;
+	os << d;
+	cd += os.str();
+	cd += " ";
+      }
+  }
+  Foreach(macroFile,variableName,cd);
+}
+
+void G4UImanager::ForeachS(const char* valueList)
+{
+  G4String vl = valueList;
+  G4Tokenizer parameterToken(vl);
+  G4String mf = parameterToken();
+  G4String vn = parameterToken();
+  G4String c1 = parameterToken();
+  G4String ca;
+  while(!((ca=parameterToken()).isNull()))
+  {
+    c1 += " ";
+    c1 += ca;
+  }
+  Foreach(mf,vn,c1);
+}
+
+void G4UImanager::Foreach(const char * macroFile,const char * variableName,
+                   const char * candidates)
+{
+  G4String candidatesString = candidates;
+  G4Tokenizer parameterToken( candidatesString );
+  G4String cd;
+  while(!((cd=parameterToken()).isNull()))
+  {
+    G4String vl = variableName;
+    vl += " ";
+    vl += cd;
+    SetAlias(vl);
+    ExecuteMacroFile(macroFile);
+  }
+}
+
+
+G4String G4UImanager::SolveAlias(const char* aCmd)
+{
+  G4String aCommand = aCmd;
+  G4int ia = aCommand.index("{");
+  G4int iz = aCommand.index("#");
+  while((ia != G4int(std::string::npos))&&((iz==G4int(std::string::npos))||(ia<iz)))
+  {
+    G4int ibx = -1;
+    while(ibx<0)
+    {
+      G4int ib = aCommand.index("}");
+      if( ib == G4int(std::string::npos) )
+      {
+        G4cerr << aCommand << G4endl;
+        for(G4int iz=0;iz<ia;iz++) G4cerr << " ";
+        G4cerr << "^" << G4endl;
+        G4cerr << "Unmatched alias parenthis -- command ignored" << G4endl;
+        G4String nullStr;
+        return nullStr;
+      }
+      G4String ps = aCommand(ia+1,aCommand.length()-(ia+1));
+      G4int ic = ps.index("{");
+      G4int id = ps.index("}");
+      if(ic!=G4int(std::string::npos) && ic < id)
+      { ia+=ic+1; }
+      else
+      { ibx = ib; }
+    }
+    //--- Here ia represents the position of innermost "{"
+    //--- and ibx represents corresponding "}"
+    G4String subs;
+    if(ia>0) subs = aCommand(0,ia);
+    G4String alis = aCommand(ia+1,ibx-ia-1);
+    G4String rems = aCommand(ibx+1,aCommand.length()-ibx);
+    // G4cout << "<" << subs << "> <" << alis << "> <" << rems << ">" << G4endl;
+    G4String* alVal = aliasList->FindAlias(alis);
+    if(!alVal)
+    {
+      G4cerr << "Alias <" << alis << "> not found -- command ignored" << G4endl;
+      G4String nullStr;
+      return nullStr;
+    }
+    aCommand = subs+(*alVal)+rems;
+    ia = aCommand.index("{");
+  }
+  return aCommand;
+}
+
+G4int G4UImanager::ApplyCommand(G4String aCmd)
+{
+  return ApplyCommand(aCmd.data());
+}
+
+G4int G4UImanager::ApplyCommand(const char * aCmd)
+{
+  G4String aCommand = SolveAlias(aCmd);
+  if(aCommand.isNull()) return fAliasNotFound;
+  if(verboseLevel) G4cout << aCommand << G4endl;
+  G4String commandString;
+  G4String commandParameter;
+
+  G4int i = aCommand.index(" ");
+  if( i != G4int(std::string::npos) )
+  {
+    commandString = aCommand(0,i);
+    commandParameter = aCommand(i+1,aCommand.length()-(i+1));
+  }
+  else
+  {
+    commandString = aCommand;
+  }
+
+  // remove doubled slash
+  G4int len = commandString.length();
+  G4int ll = 0;
+  G4String a1;
+  G4String a2;
+  while(ll<len-1)
+  {
+    if(commandString(ll,2)=="//")
+    {
+      if(ll==0)
+      { commandString.remove(ll,1); }
+      else
+      {
+        a1 = commandString(0,ll);
+        a2 = commandString(ll+1,len-ll-1);
+        commandString = a1+a2;
+      }
+      len--;
+    }
+    else
+    { ll++; }
+  }
+
+  G4UIcommand * targetCommand = treeTop->FindPath( commandString );
+  if( targetCommand == NULL )
+  { return fCommandNotFound; }
+
+  if(!(targetCommand->IsAvailable())) 
+  { return fIllegalApplicationState; }
+ 
+  if(saveHistory) historyFile << aCommand << G4endl; 
+  if( G4int(histVec.size()) >= maxHistSize )
+  { histVec.erase(histVec.begin()); }
+  histVec.push_back(aCommand);
+  return targetCommand->DoIt( commandParameter );
+}
+
+void G4UImanager::StoreHistory(const char* fileName)
+{ StoreHistory(true,fileName); }
+
+void G4UImanager::StoreHistory(G4bool historySwitch,const char* fileName)
+{
+  if(historySwitch)
+  {
+    if(saveHistory)
+    { historyFile.close(); }
+    historyFile.open((char*)fileName);
+    saveHistory = true;
+  }
+  else
+  {
+    historyFile.close();
+    saveHistory = false;
+  }
+  saveHistory = historySwitch;
+}
+
+void G4UImanager::PauseSession(const char* msg)
+{
+  if(session) session->PauseSessionStart(msg); 
+}
+
+void G4UImanager::ListCommands(const char* direct)
+{
+  G4UIcommandTree* comTree = FindDirectory(direct);
+  if(comTree)
+  { comTree->List(); }
+  else
+  { G4cout << direct << " is not found." << G4endl; }
+}
+
+G4UIcommandTree* G4UImanager::FindDirectory(const char* dirName)
+{
+  G4String aDirName = dirName;
+  G4String targetDir = aDirName.strip(G4String::both);
+  if( targetDir( targetDir.length()-1 ) != '/' )
+  { targetDir += "/"; }
+  G4UIcommandTree* comTree = treeTop;
+  if( targetDir == "/" )
+  { return comTree; }
+  G4int idx = 1;
+  while( idx < G4int(targetDir.length())-1 )
+  {
+    G4int i = targetDir.index("/",idx);
+    G4String targetDirString = targetDir(0,i+1);
+    comTree = comTree->GetTree(targetDirString);
+    if( comTree == NULL )
+    { return NULL; }
+    idx = i+1;
+  }
+  return comTree;
+}
+
+G4bool G4UImanager::Notify(G4ApplicationState requestedState)
+{
+  //G4cout << G4StateManager::GetStateManager()->GetStateString(requestedState) << " <--- " << G4StateManager::GetStateManager()->GetStateString(G4StateManager::GetStateManager()->GetPreviousState()) << G4endl;
+  if(pauseAtBeginOfEvent)
+  {
+    if(requestedState==G4State_EventProc &&
+       G4StateManager::GetStateManager()->GetPreviousState()==G4State_GeomClosed)
+    { PauseSession("BeginOfEvent"); }
+  }
+  if(pauseAtEndOfEvent)
+  {
+    if(requestedState==G4State_GeomClosed &&
+       G4StateManager::GetStateManager()->GetPreviousState()==G4State_EventProc)
+    { PauseSession("EndOfEvent"); }
+  }
+  return true;
+}
+
+//void G4UImanager::Interact()
+//{
+//  Interact(G4String("G4> "));
+//}
+
+//void G4UImanager::Interact(const char * pC)
+//{
+//  G4cerr << "G4UImanager::Interact() is out of date and is not used anymore." << G4endl;
+//  G4cerr << "This method will be removed shortly!!!" << G4endl;
+//  G4cerr << "In case of main() use" << G4endl;
+//  G4cerr << "    G4UIsession * session = new G4UIterminal;" << G4endl;
+//  G4cerr << "    session->SessionStart();" << G4endl;
+//  G4cerr << "In other cases use" << G4endl;
+//  G4cerr << "    G4StateManager::GetStateManager()->Pause();" << G4endl;
+//}
+
+
+
+void G4UImanager::SetCoutDestination(G4UIsession *const value)
+{
+    G4coutbuf.SetDestination(value);
+    G4cerrbuf.SetDestination(value);
+}
+
+void G4UImanager::SetAlias(const char * aliasLine)
+{
+  G4String aLine = aliasLine;
+  G4int i = aLine.index(" ");
+  G4String aliasName = aLine(0,i);
+  G4String aliasValue = aLine(i+1,aLine.length()-(i+1));
+  if(aliasValue(0)=='"')
+  { 
+    G4String strippedValue;
+    if(aliasValue(aliasValue.length()-1)=='"')
+    { strippedValue = aliasValue(1,aliasValue.length()-2); }
+    else
+    { strippedValue = aliasValue(1,aliasValue.length()-1); }
+    aliasValue = strippedValue;
+  }
+
+  aliasList->ChangeAlias(aliasName,aliasValue);
+}
+
+void G4UImanager::RemoveAlias(const char * aliasName)
+{
+  G4String aL = aliasName;
+  G4String targetAlias = aL.strip(G4String::both);
+  aliasList->RemoveAlias(targetAlias);
+}
+
+void G4UImanager::ListAlias()
+{
+  aliasList->List();
+}
+
+void G4UImanager::CreateHTML(const char* dir)
+{ 
+  G4UIcommandTree* tr = FindDirectory(dir);
+  if(tr!=0)
+  { tr->CreateHTML(); }
+  else
+  { G4cerr << "Directory <" << dir << "> is not found." << G4endl; }
+}
+
Index: trunk/source/intercoms/src/G4UImessenger.cc
===================================================================
--- trunk/source/intercoms/src/G4UImessenger.cc	(revision 821)
+++ trunk/source/intercoms/src/G4UImessenger.cc	(revision 821)
@@ -0,0 +1,110 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UImessenger.cc,v 1.7 2006/06/29 19:09:06 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+
+#include "G4UImessenger.hh"
+#include "G4UImanager.hh"
+#include "G4UIcommand.hh"
+#include "G4ios.hh"
+#include <sstream>
+
+
+G4UImessenger::G4UImessenger() { }
+
+G4UImessenger::~G4UImessenger() { }
+
+G4String G4UImessenger::GetCurrentValue(G4UIcommand*) 
+{ 
+  G4String nullString;
+  return nullString;
+}
+
+void G4UImessenger::SetNewValue(G4UIcommand*,G4String) 
+{ ; }
+
+G4bool G4UImessenger::operator == (const G4UImessenger& messenger) const {
+  return this == &messenger;
+}
+
+G4String G4UImessenger::ItoS(G4int i)
+{
+  std::ostringstream os;
+  os << i;
+  return G4String(os.str());
+}
+
+G4String G4UImessenger::DtoS(G4double a)
+{
+  std::ostringstream os;
+  os << a;
+  return G4String(os.str());
+}
+
+G4String G4UImessenger::BtoS(G4bool b)
+{
+  G4String vl = "0";
+  if(b) vl = "true";
+  return vl;
+}
+
+G4int G4UImessenger::StoI(G4String s)
+{
+  G4int vl;
+  const char* t = s;
+  std::istringstream is(t);
+  is >> vl;
+  return vl;
+}
+
+G4double G4UImessenger::StoD(G4String s)
+{
+  G4double vl;
+  const char* t = s;
+  std::istringstream is(t);
+  is >> vl;
+  return vl;
+}
+
+G4bool G4UImessenger::StoB(G4String s)
+{
+  G4String v = s;
+  v.toUpper();
+  G4bool vl = false;
+  if( v=="Y" || v=="YES" || v=="1" || v=="T" || v=="TRUE" )
+  { vl = true; }
+  return vl;
+}
+
+
+void G4UImessenger::AddUIcommand(G4UIcommand * newCommand)
+{
+  G4cerr << "Warning : Old style definition of G4UIcommand <" 
+         << newCommand->GetCommandPath() << ">." << G4endl;
+}
+
Index: trunk/source/intercoms/src/G4UIparameter.cc
===================================================================
--- trunk/source/intercoms/src/G4UIparameter.cc	(revision 821)
+++ trunk/source/intercoms/src/G4UIparameter.cc	(revision 821)
@@ -0,0 +1,753 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIparameter.cc,v 1.14 2006/06/29 19:09:09 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+
+#include "G4UIparameter.hh"
+#include "G4UIcommandStatus.hh"
+#include "G4Tokenizer.hh"
+#include "G4ios.hh"
+#include <sstream>
+
+
+G4UIparameter::G4UIparameter():paramERR(0)
+{
+  G4String nullString;
+  parameterName = nullString;
+  parameterType = '\0';
+  omittable = false;
+  parameterGuidance = nullString;
+  defaultValue = nullString;
+  parameterRange = nullString;
+  currentAsDefaultFlag = false;
+  parameterCandidate = nullString;
+  widget = 0;
+}
+
+G4UIparameter::G4UIparameter(char theType):paramERR(0)
+{
+  G4String nullString;
+  parameterName = nullString;
+  parameterType = theType;
+  omittable = false;
+  parameterGuidance = nullString;
+  defaultValue = nullString;
+  parameterRange = nullString;
+  currentAsDefaultFlag = false;
+  parameterCandidate = nullString;
+  widget = 0;
+}
+
+G4UIparameter::G4UIparameter(const char * theName, char theType, G4bool theOmittable):paramERR(0)
+{
+  parameterName = theName;
+  parameterType = theType;
+  omittable = theOmittable;
+  G4String nullString;
+  parameterGuidance = nullString;
+  defaultValue = nullString;
+  parameterRange = nullString;
+  currentAsDefaultFlag = false;
+  parameterCandidate = nullString;
+  widget = 0;
+}
+
+G4UIparameter::~G4UIparameter()
+{ }
+
+G4int G4UIparameter::operator==(const G4UIparameter &right) const
+{
+  return ( this == &right );
+}
+
+G4int G4UIparameter::operator!=(const G4UIparameter &right) const
+{
+  return ( this != &right );
+}
+
+void G4UIparameter::List()
+{
+  G4cout << G4endl << "Parameter : " << parameterName << G4endl;
+  if( ! parameterGuidance.isNull() )
+  G4cout << parameterGuidance << G4endl ;
+  G4cout << " Parameter type  : " << parameterType << G4endl;
+  if(omittable)
+  { G4cout << " Omittable       : True" << G4endl; }
+  else
+  { G4cout << " Omittable       : False" << G4endl; }
+  if( currentAsDefaultFlag )
+  { G4cout << " Default value   : taken from the current value" << G4endl; }
+  else if( ! defaultValue.isNull() )
+  { G4cout << " Default value   : " << defaultValue << G4endl; }
+  if( ! parameterRange.isNull() )
+  G4cout << " Parameter range : " << parameterRange << G4endl;
+  if( ! parameterCandidate.isNull() )
+  G4cout << " Candidates      : " << parameterCandidate << G4endl;
+}
+
+void G4UIparameter::SetDefaultValue(G4int theDefaultValue)
+{
+  std::ostringstream os;
+  os << theDefaultValue;
+  defaultValue = os.str();
+}
+
+void G4UIparameter::SetDefaultValue(G4double theDefaultValue)
+{
+  std::ostringstream os;
+  os << theDefaultValue;
+  defaultValue = os.str();
+}
+
+
+// ---------- CheckNewValue() related routines -----------
+#include <ctype.h>
+#include "G4UItokenNum.hh"
+
+//#include "checkNewValue_debug.icc"
+//#define DEBUG 1
+
+G4int G4UIparameter::
+CheckNewValue(const char* newValue ) {
+    if( TypeCheck(newValue) == 0) return fParameterUnreadable;
+    if( ! parameterRange.isNull() )
+    { if( RangeCheck(newValue) == 0 ) return fParameterOutOfRange; }
+    if( ! parameterCandidate.isNull() )
+    { if( CandidateCheck(newValue) == 0 ) return fParameterOutOfCandidates; }
+    return 0;   // succeeded
+}
+
+G4int G4UIparameter::
+CandidateCheck(const char* newValue) {
+    G4Tokenizer candidateTokenizer(parameterCandidate);
+    G4String aToken;
+    G4int iToken = 0;
+    while( ! (aToken=candidateTokenizer()).isNull() )
+    {
+      iToken++;
+      if(aToken==newValue) return iToken;
+    } 
+    G4cerr << "parameter value is not listed in the candidate List." << G4endl;
+    return 0;
+}
+
+G4int G4UIparameter::
+RangeCheck(const char* newValue) {
+    yystype result;
+    bp = 0;                   // reset buffer pointer for G4UIpGetc()
+    std::istringstream is(newValue); 
+    char type = toupper( parameterType );
+    switch (type) {
+        case 'D': { is >> newVal.D; } break;
+        case 'I': { is >> newVal.I; } break;
+        default:   ;
+    }
+   // PrintToken();          // Print tokens (consumes all tokens)
+   token= Yylex();
+   result = Expression();
+   if( paramERR == 1 ) return 0;
+   if( result.type != CONSTINT) {
+      G4cerr << "Illegal Expression in parameter range." << G4endl;
+      return 0;
+   }
+   if ( result.I ) return 1;
+   G4cerr << "parameter out of range: "<< parameterRange << G4endl;
+   return 0;
+}
+
+
+G4int G4UIparameter::
+TypeCheck(const char* newValue)
+{
+    G4String newValueString(newValue);
+    char type = toupper( parameterType );
+    switch(type) {
+        case 'D':
+            if( IsDouble(newValueString.data())== 0) {
+                G4cerr<<newValue<<": double value expected."
+                    << G4endl;
+                return 0;
+             } break;
+        case 'I':
+            if( IsInt(newValueString.data(),20)== 0) {
+                G4cerr<<newValue<<": integer expected."
+                    << G4endl;
+                return 0;
+             } break;
+        case 'S': break;
+        case 'B':
+             newValueString.toUpper();
+             if (  newValueString == "Y" || newValueString == "N"
+                  ||newValueString == "YES" || newValueString == "NO"
+                  ||newValueString == "1"   || newValueString == "0"
+                  ||newValueString == "T" || newValueString == "F"
+                  ||newValueString == "TRUE" || newValueString == "FALSE") 
+                  return 1;
+             else {
+                    G4cerr<<newValue<<": bool expected." << G4endl;
+                    return 0; 
+             } 
+        default: ;
+    }
+    return 1;
+}
+
+
+G4int G4UIparameter::
+IsInt(const char* buf, short maxDigits)  // do not allow any std::ws
+{
+    const char* p= buf;
+    G4int length=0;
+    if( *p == '+' || *p == '-') { ++p; }
+    if( isdigit( (G4int)(*p) )) {
+        while( isdigit( (G4int)(*p) )) { ++p;  ++length; }
+        if( *p == '\0' ) {
+            if( length > maxDigits) {
+                G4cerr <<"digit length exceeds"<<G4endl;
+                return 0;
+            }
+            return 1;
+        } else {
+            // G4cerr <<"illegal character after int:"<<buf<<G4endl;
+        }
+    } else {
+        // G4cerr <<"illegal int:"<<buf<<G4endl;
+    }
+    return 0;
+}
+
+
+G4int G4UIparameter::
+ExpectExponent(const char* str)   // used only by IsDouble()
+{
+    G4int maxExplength;
+    if( IsInt( str, maxExplength=7 )) return 1;
+    else return 0;
+}
+
+G4int G4UIparameter::
+IsDouble(const char* buf)  // see state diagram for this spec.
+{
+    const char* p= buf;
+    switch( *p) {
+        case '+':  case '-': ++p;
+            if( isdigit(*p) ) {
+                 while( isdigit( (G4int)(*p) )) { ++p; }
+                 switch ( *p ) {
+                     case '\0':    return 1;  //break;
+                     case 'E':  case 'e':
+                         return ExpectExponent(++p );  //break;
+                     case '.':  ++p;
+                         if( *p == '\0' )  return 1;
+                         if( *p == 'e' || *p =='E' ) return ExpectExponent(++p );
+                         if( isdigit(*p) ) {
+                             while( isdigit( (G4int)(*p) )) { ++p; }
+                             if( *p == '\0' )  return 1;
+                             if( *p == 'e' || *p =='E') return ExpectExponent(++p);
+                         } else return 0;   break;
+                     default: return 0;
+                 }
+            }
+            if( *p == '.' ) { ++p;
+                 if( isdigit(*p) ) {
+                     while( isdigit( (G4int)(*p) )) { ++p; }
+                     if( *p == '\0' )  return 1;
+                     if( *p == 'e' || *p =='E')  return ExpectExponent(++p);
+                 }
+            }
+            break;
+        case '.':  ++p;
+            if( isdigit(*p) ) {
+                 while( isdigit( (G4int)(*p) )) { ++p; }
+                 if( *p == '\0' )  return 1;
+                 if( *p == 'e' || *p =='E' )  return ExpectExponent(++p);
+            }    break;
+        default: // digit is expected
+            if( isdigit(*p) ) {
+                 while( isdigit( (G4int)(*p) )) { ++p; }
+                 if( *p == '\0' )  return 1;
+                 if( *p == 'e' || *p =='E')  return ExpectExponent(++p);
+                 if( *p == '.' ) { ++p;
+                      if( *p == '\0' )  return 1;
+                      if( *p == 'e' || *p =='E')  return ExpectExponent(++p);
+                      if( isdigit(*p) ) {
+                          while( isdigit( (G4int)(*p) )) { ++p; }
+                          if( *p == '\0' )  return 1;
+                          if( *p == 'e' || *p =='E') return ExpectExponent(++p);
+                      }
+                 }
+            }
+     }
+     return 0;
+}
+
+
+// ------------------ syntax node functions  ------------------
+
+yystype G4UIparameter:: 
+Expression(void)
+{
+    yystype result;
+    #ifdef DEBUG
+        G4cerr << " Expression()" << G4endl;
+    #endif
+    result = LogicalORExpression();
+    return result;
+}
+
+yystype G4UIparameter:: 
+LogicalORExpression(void)
+{
+    yystype result;
+    yystype p;
+    p = LogicalANDExpression();
+    if( token != LOGICALOR)  return p;
+    if( p.type == CONSTSTRING || p.type == IDENTIFIER ) {
+        G4cerr << "Parameter range: illegal type at '||'" << G4endl;
+        paramERR = 1;
+    }
+    result.I = p.I;
+    while (token == LOGICALOR) 
+    {  
+        token = Yylex();
+        p = LogicalANDExpression();
+        if( p.type == CONSTSTRING || p.type == IDENTIFIER ) {
+            G4cerr << "Parameter range: illegal type at '||'" <<G4endl;
+            paramERR = 1;
+        }
+        switch (p.type) {
+            case CONSTINT: 
+                result.I  += p.I; 
+                result.type = CONSTINT;      break;
+            case CONSTDOUBLE:
+                result.I += (p.D != 0.0); 
+                result.type = CONSTINT;      break;
+            default: 
+                G4cerr << "Parameter range: unknown type"<<G4endl; 
+                paramERR = 1;
+        } 
+    }
+    return result;
+}
+
+yystype G4UIparameter:: 
+LogicalANDExpression(void)
+{
+    yystype result;
+    yystype p;
+    p = EqualityExpression();
+    if( token != LOGICALAND)  return p;
+    if( p.type == CONSTSTRING || p.type == IDENTIFIER ) {
+        G4cerr << "Parameter range: illegal type at '&&'" << G4endl;
+        paramERR = 1;
+    }
+    result.I = p.I;
+    while (token == LOGICALAND)
+    {
+        token = Yylex();
+        p = EqualityExpression();
+        if( p.type == CONSTSTRING || p.type == IDENTIFIER ) {
+            G4cerr << "Parameter range: illegal type at '&&'" << G4endl;
+            paramERR = 1;
+        }
+        switch (p.type) {
+            case CONSTINT:
+                result.I  *= p.I;
+                result.type = CONSTINT;      break;
+            case CONSTDOUBLE:
+                result.I *= (p.D != 0.0);
+                result.type = CONSTINT;      break;
+            default:
+                G4cerr << "Parameter range: unknown type."<< G4endl;
+                paramERR = 1;
+        } 
+    }
+    return result;
+}
+
+
+yystype G4UIparameter:: 
+EqualityExpression(void)
+{ 
+    yystype  arg1, arg2;
+    G4int operat;
+    yystype result;
+    #ifdef DEBUG
+        G4cerr << " EqualityExpression()" <<G4endl;
+    #endif
+    result = RelationalExpression();
+    if( token==EQ || token==NE ) {
+        operat = token;
+        token =  Yylex();
+        arg1 = result;
+        arg2 = RelationalExpression();
+        result.I = Eval2( arg1, operat, arg2 );   // semantic action
+        result.type = CONSTINT;
+        #ifdef DEBUG
+            G4cerr << " return code of Eval2(): " << result.I <<G4endl;
+        #endif
+    } else {
+        if (result.type != CONSTINT && result.type != CONSTDOUBLE) {  
+            G4cerr << "Parameter range: error at EqualityExpression"
+                 << G4endl;
+            paramERR = 1;
+        }
+    }
+    return  result;
+}
+
+
+yystype G4UIparameter:: 
+RelationalExpression(void)
+{ 
+    yystype  arg1, arg2;
+    G4int operat;
+    yystype result;
+    #ifdef DEBUG
+        G4cerr << " RelationalExpression()" <<G4endl;
+    #endif
+
+    arg1 = AdditiveExpression();
+    if( token==GT || token==GE || token==LT || token==LE  ) {
+        operat = token;
+        token =  Yylex();
+        arg2 = AdditiveExpression();
+        result.I = Eval2( arg1, operat, arg2 );    // semantic action
+        result.type = CONSTINT;
+        #ifdef DEBUG
+            G4cerr << " return  Eval2(): " << G4endl;
+        #endif
+    } else {
+        result = arg1;
+    }
+    #ifdef DEBUG
+       G4cerr <<" return RelationalExpression()" <<G4endl;
+    #endif
+    return  result;
+}
+
+yystype G4UIparameter::
+AdditiveExpression(void)
+{   yystype result;
+    result = MultiplicativeExpression();
+    if( token != '+' && token != '-' )  return result;
+    G4cerr << "Parameter range: operator " 
+         << (char)token 
+         << " is not supported." << G4endl;
+    paramERR = 1;
+    return  result;
+}
+
+yystype G4UIparameter::
+MultiplicativeExpression(void)
+{   yystype result;
+    result = UnaryExpression();
+    if( token != '*' && token != '/' && token != '%' ) return result;
+    G4cerr << "Parameter range: operator "
+         << (char)token
+         << " is not supported." << G4endl;
+    paramERR = 1;
+    return  result;
+}
+
+yystype G4UIparameter::
+UnaryExpression(void)
+{
+    yystype result;
+    yystype p;
+    #ifdef DEBUG
+        G4cerr <<" UnaryExpression"<< G4endl;
+    #endif
+    switch(token) {
+        case '-':
+            token = Yylex();
+            p = UnaryExpression();
+            if (p.type == CONSTINT) {
+                result.I = - p.I;
+                result.type = CONSTINT;
+            }
+            if (p.type == CONSTDOUBLE) {
+                result.D = - p.D;
+                result.type = CONSTDOUBLE;
+            }                              break;
+        case '+':
+            token = Yylex();
+            result = UnaryExpression();   break;
+        case '!':
+            token = Yylex();
+            G4cerr << "Parameter range error: "
+                 << "operator '!' is not supported (sorry)."
+                 << G4endl;
+            paramERR = 1;
+            result = UnaryExpression();   break;
+        default:
+            result = PrimaryExpression();
+    }
+    return result;
+}
+
+
+yystype G4UIparameter:: 
+PrimaryExpression(void)
+{
+     yystype result;
+     #ifdef DEBUG
+         G4cerr <<" PrimaryExpression" << G4endl;
+     #endif
+     switch (token) {
+         case IDENTIFIER:
+              result.S = yylval.S;
+              result.type =  token;
+              token = Yylex();           break;
+         case CONSTINT:
+              result.I = yylval.I;
+              result.type =  token;
+              token= Yylex();            break;
+         case CONSTDOUBLE:
+              result.D = yylval.D;
+              result.type =  token;
+              token = Yylex();           break;
+         case '(' :
+              token= Yylex();
+              result = Expression();
+              if( token !=  ')'  ) {
+                  G4cerr << " ')' expected" << G4endl;
+                  paramERR = 1;
+              }
+              token = Yylex();
+                                         break;
+         default:
+         return result;
+    }
+    return result; // never executed
+}
+
+//---------------- semantic routines ---------------------------------
+
+G4int G4UIparameter::
+Eval2(yystype arg1, G4int op, yystype arg2)
+{
+    if( (arg1.type != IDENTIFIER) && (arg2.type != IDENTIFIER)) {
+        G4cerr << parameterName
+             << ": meaningless comparison "
+             << G4int(arg1.type) << " " << G4int(arg2.type) << G4endl;
+        paramERR = 1;
+    }
+    char type = toupper( parameterType );
+    if( arg1.type == IDENTIFIER) {
+        switch (type) {
+            case 'I':
+                if ( arg2.type == CONSTINT ) {
+                    return CompareInt( newVal.I, op, arg2.I );
+                } else {
+                    G4cerr << "integer operand expected for "
+                         << parameterRange << '.' 
+                         << G4endl; 
+                }
+                 break;
+            case 'D': 
+                if ( arg2.type == CONSTDOUBLE ) {
+                    return CompareDouble( newVal.D, op, arg2.D );
+                } else
+                if ( arg2.type == CONSTINT ) { // integral promotion
+                    return CompareDouble( newVal.D, op, arg2.I );
+                } break;
+            default: ;
+        }
+    }
+    if( arg2.type == IDENTIFIER) {
+        switch (type) {
+            case 'I':
+                if ( arg1.type == CONSTINT ) {
+                    return CompareInt( arg1.I, op, newVal.I );
+                } else {
+                    G4cerr << "integer operand expected for "
+                         << parameterRange << '.' 
+                         << G4endl; 
+                }
+                 break;
+            case 'D': 
+                if ( arg1.type == CONSTDOUBLE ) {
+                    return CompareDouble( arg1.D, op, newVal.D );
+                } else
+                if ( arg1.type == CONSTINT ) { // integral promotion
+                    return CompareDouble( arg1.I, op, newVal.D );
+                } break;
+            default: ;
+        }
+    }
+    G4cerr << "no param name is specified at the param range."<<G4endl;
+    return 0;
+}
+
+G4int G4UIparameter::
+CompareInt(G4int arg1, G4int op, G4int arg2)
+{   
+    G4int result=-1;
+    G4String opr;
+    switch (op) {
+       case GT:  result = ( arg1 >  arg2); opr= ">" ;  break;
+       case GE:  result = ( arg1 >= arg2); opr= ">=";  break;
+       case LT:  result = ( arg1 <  arg2); opr= "<" ;  break;
+       case LE:  result = ( arg1 <= arg2); opr= "<=";  break;
+       case EQ:  result = ( arg1 == arg2); opr= "==";  break;
+       case NE:  result = ( arg1 != arg2); opr= "!=";  break;
+       default: 
+           G4cerr << "Parameter range: error at CompareInt" << G4endl;
+           paramERR = 1;
+    }
+    #ifdef DEBUG
+        G4cerr << "CompareInt "
+             << arg1 << " " << opr << arg2 
+             << " result: " << result
+             << G4endl;
+    #endif
+    return result;
+}
+
+G4int G4UIparameter::
+CompareDouble(G4double arg1, G4int op, G4double arg2)
+{   
+    G4int result=-1;
+    G4String opr;
+    switch (op) {
+        case GT:  result = ( arg1 >  arg2); opr= ">";   break;
+        case GE:  result = ( arg1 >= arg2); opr= ">=";  break;
+        case LT:  result = ( arg1 <  arg2); opr= "<";   break;
+        case LE:  result = ( arg1 <= arg2); opr= "<=";  break;
+        case EQ:  result = ( arg1 == arg2); opr= "==";  break;
+        case NE:  result = ( arg1 != arg2); opr= "!=";  break;
+        default:
+           G4cerr << "Parameter range: error at CompareDouble" << G4endl;
+           paramERR = 1;
+    }
+    #ifdef DEBUG
+        G4cerr << "CompareDouble " 
+             << arg1 <<" " << opr << " "<< arg2
+             << " result: " << result
+             << G4endl;
+    #endif
+    return result;
+}
+
+// --------------------- utility functions --------------------------
+
+tokenNum G4UIparameter::
+Yylex()         // reads input and returns token number KR486
+{               // (returns EOF)
+    G4int c;             
+    G4String buf;
+
+    while(( c= G4UIpGetc())==' '|| c=='\t' || c== '\n' )
+        ;
+    if (c== EOF)
+        return (tokenNum)EOF;            // KR488 
+    buf= "";
+    if (isdigit(c) || c== '.') {         // I or D
+        do {
+             buf += G4String((unsigned char)c);
+             c=G4UIpGetc();
+         }  while (c=='.' || isdigit(c) || 
+                   c=='e' || c=='E' || c=='+' || c=='-');
+         G4UIpUngetc(c);
+	 const char* t = buf;
+	 std::istringstream is(t);
+         if ( IsInt(buf.data(),20) ) {
+             is >> yylval.I;
+             return  CONSTINT;
+         } else 
+         if ( IsDouble(buf.data()) ) {
+             is >> yylval.D;
+             return  CONSTDOUBLE;
+         } else {
+             G4cerr << buf<<": numeric format error."<<G4endl;
+         }
+    }
+    buf="";
+    if (isalpha(c)|| c=='_') {           // IDENTIFIER
+        do {
+            buf += G4String((unsigned char)c); 
+        } while ((c=G4UIpGetc()) != EOF && (isalnum(c) || c=='_'));
+        G4UIpUngetc(c);
+        if( buf == parameterName ) {
+            yylval.S =buf;
+            return IDENTIFIER;
+        } else {
+            G4cerr << buf << " is not a parameter name."<< G4endl;
+            paramERR = 1;
+       }
+    }
+    switch (c) {
+      case '>':   return (tokenNum) Follow('=', GE,        GT);
+      case '<':   return (tokenNum) Follow('=', LE,        LT);
+      case '=':   return (tokenNum) Follow('=', EQ,        '=');
+      case '!':   return (tokenNum) Follow('=', NE,        '!');
+      case '|':   return (tokenNum) Follow('|', LOGICALOR, '|');
+      case '&':   return (tokenNum) Follow('&', LOGICALAND, '&');
+      default:
+          return (tokenNum) c;
+    }
+}
+
+
+G4int G4UIparameter::
+Follow(G4int expect, G4int ifyes, G4int ifno)
+{
+    G4int c = G4UIpGetc();
+    if ( c== expect)
+          return ifyes;
+    G4UIpUngetc(c);
+    return ifno;
+}
+
+//------------------ low level routines -----------------------------
+G4int G4UIparameter::
+G4UIpGetc() {                        // emulation of getc() 
+    G4int length = parameterRange.length();
+    if( bp < length)
+        return  parameterRange(bp++);
+    else 
+        return EOF;
+}
+G4int G4UIparameter::
+G4UIpUngetc(G4int c) {                 // emulation of ungetc() 
+    if (c<0) return -1;
+    if (bp >0 && c == parameterRange(bp-1)) {
+         --bp;
+    } else {
+         G4cerr << "G4UIpUngetc() failed." << G4endl;
+         G4cerr << "bp="<<bp <<" c="<<c
+              << " pR(bp-1)=" << parameterRange(bp-1)
+              << G4endl;
+         paramERR = 1;
+         return -1;
+    }
+    return 0;
+}
+// *****  end of CheckNewValue() related code  ******
+
Index: trunk/source/intercoms/src/G4UIsession.cc
===================================================================
--- trunk/source/intercoms/src/G4UIsession.cc	(revision 821)
+++ trunk/source/intercoms/src/G4UIsession.cc	(revision 821)
@@ -0,0 +1,53 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UIsession.cc,v 1.7 2006/06/29 19:09:11 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// ---------------------------------------------------------------------
+
+#include "G4UIsession.hh"
+
+G4UIsession::G4UIsession() {;}
+
+G4UIsession::~G4UIsession() {;}
+
+G4UIsession * G4UIsession::SessionStart() { return NULL; }
+
+void G4UIsession::PauseSessionStart(G4String) {;}
+
+G4int G4UIsession::ReceiveG4cout(G4String coutString)
+{
+  std::cout <<  coutString << std::flush;
+  return 0;
+}
+
+G4int G4UIsession::ReceiveG4cerr(G4String cerrString)
+{
+  std::cerr <<  cerrString << std::flush;
+  return 0;
+}                                                                       
Index: trunk/source/intercoms/src/G4UnitsMessenger.cc
===================================================================
--- trunk/source/intercoms/src/G4UnitsMessenger.cc	(revision 821)
+++ trunk/source/intercoms/src/G4UnitsMessenger.cc	(revision 821)
@@ -0,0 +1,68 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4UnitsMessenger.cc,v 1.7 2006/06/29 19:09:13 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+#include "G4UnitsMessenger.hh"
+
+#include "G4UnitsTable.hh"
+#include "G4UIdirectory.hh"
+#include "G4UIcmdWithoutParameter.hh"
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4UnitsMessenger::G4UnitsMessenger()
+{ 
+  UnitsTableDir = new G4UIdirectory("/units/");
+  UnitsTableDir->SetGuidance("Available units.");
+      
+  ListCmd = new G4UIcmdWithoutParameter("/units/list",this);
+  ListCmd->SetGuidance("full list of available units.");
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+G4UnitsMessenger::~G4UnitsMessenger()
+{
+  delete ListCmd;
+  delete UnitsTableDir;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
+
+void G4UnitsMessenger::SetNewValue(G4UIcommand* command,G4String)
+{  
+  if (command == ListCmd)
+    { G4UnitDefinition::PrintUnitsTable(); }
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Index: trunk/source/intercoms/src/G4VGlobalFastSimulationManager.cc
===================================================================
--- trunk/source/intercoms/src/G4VGlobalFastSimulationManager.cc	(revision 821)
+++ trunk/source/intercoms/src/G4VGlobalFastSimulationManager.cc	(revision 821)
@@ -0,0 +1,50 @@
+//
+// ********************************************************************
+// * License and Disclaimer                                           *
+// *                                                                  *
+// * The  Geant4 software  is  copyright of the Copyright Holders  of *
+// * the Geant4 Collaboration.  It is provided  under  the terms  and *
+// * conditions of the Geant4 Software License,  included in the file *
+// * LICENSE and available at  http://cern.ch/geant4/license .  These *
+// * include a list of copyright holders.                             *
+// *                                                                  *
+// * Neither the authors of this software system, nor their employing *
+// * institutes,nor the agencies providing financial support for this *
+// * work  make  any representation or  warranty, express or implied, *
+// * regarding  this  software system or assume any liability for its *
+// * use.  Please see the license in the file  LICENSE  and URL above *
+// * for the full disclaimer and the limitation of liability.         *
+// *                                                                  *
+// * This  code  implementation is the result of  the  scientific and *
+// * technical work of the GEANT4 collaboration.                      *
+// * By using,  copying,  modifying or  distributing the software (or *
+// * any work based  on the software)  you  agree  to acknowledge its *
+// * use  in  resulting  scientific  publications,  and indicate your *
+// * acceptance of all terms of the Geant4 Software license.          *
+// ********************************************************************
+//
+//
+// $Id: G4VGlobalFastSimulationManager.cc,v 1.5 2006/06/29 19:09:15 gunter Exp $
+// GEANT4 tag $Name:  $
+//
+// 
+// Abstract interface for GEANT4 Global Fast Simulation Manager.
+// P. Mora de Freitas & M. Verderi 14/April/1999.
+
+#include "G4VGlobalFastSimulationManager.hh"
+
+G4VGlobalFastSimulationManager* 
+G4VGlobalFastSimulationManager::fpConcreteInstance = 0;
+
+G4VGlobalFastSimulationManager* 
+G4VGlobalFastSimulationManager::GetConcreteInstance ()
+{
+  return fpConcreteInstance;
+}
+
+void
+G4VGlobalFastSimulationManager::
+SetConcreteInstance (G4VGlobalFastSimulationManager* m)
+{
+  fpConcreteInstance = m;
+}
