Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/intercoms/src/G4UIcontrolMessenger.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /intercoms/src/G4UIcontrolMessenger.cc (Version 11.3.0) and /intercoms/src/G4UIcontrolMessenger.cc (Version 11.0.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // G4UIcontrolMessenger                            26 // G4UIcontrolMessenger
 27 //                                                 27 //
 28 // Author: Makoto Asai, SLAC - 2001                28 // Author: Makoto Asai, SLAC - 2001
 29 // -------------------------------------------     29 // --------------------------------------------------------------------
 30                                                    30 
                                                   >>  31 #include <stdlib.h>
 31 #include "G4UIcontrolMessenger.hh"                 32 #include "G4UIcontrolMessenger.hh"
 32                                                <<  33 #include "G4UImanager.hh"
 33 #include "G4StateManager.hh"                   <<  34 #include "G4UIdirectory.hh"
 34 #include "G4Tokenizer.hh"                      <<  35 #include "G4UIcommand.hh"
 35 #include "G4UIaliasList.hh"                    <<  36 #include "G4UIparameter.hh"
 36 #include "G4UIcmdWithABool.hh"                 << 
 37 #include "G4UIcmdWithAString.hh"                   37 #include "G4UIcmdWithAString.hh"
                                                   >>  38 #include "G4UIcmdWithABool.hh"
 38 #include "G4UIcmdWithAnInteger.hh"                 39 #include "G4UIcmdWithAnInteger.hh"
 39 #include "G4UIcmdWithoutParameter.hh"              40 #include "G4UIcmdWithoutParameter.hh"
 40 #include "G4UIcommand.hh"                      <<  41 #include "G4UIaliasList.hh"
 41 #include "G4UIdirectory.hh"                    <<  42 #include "G4StateManager.hh"
 42 #include "G4UImanager.hh"                      << 
 43 #include "G4UIparameter.hh"                    << 
 44 #include "G4UIsession.hh"                          43 #include "G4UIsession.hh"
 45 #include "G4ios.hh"                            <<  44 #include "G4Tokenizer.hh"
 46                                                    45 
 47 #include <cstdlib>                             <<  46 #include "G4ios.hh"
 48                                                    47 
 49 // -------------------------------------------     48 // --------------------------------------------------------------------
 50 G4UIcontrolMessenger::G4UIcontrolMessenger()       49 G4UIcontrolMessenger::G4UIcontrolMessenger()
 51 {                                                  50 {
 52   controlDirectory = new G4UIdirectory("/contr     51   controlDirectory = new G4UIdirectory("/control/");
 53   controlDirectory->SetGuidance("UI control co     52   controlDirectory->SetGuidance("UI control commands.");
 54                                                    53 
 55   macroPathCommand = new G4UIcmdWithAString("/     54   macroPathCommand = new G4UIcmdWithAString("/control/macroPath", this);
 56   macroPathCommand->SetGuidance(               <<  55   macroPathCommand->SetGuidance("Set macro search path"
 57     "Set macro search path"                    <<  56                                 " with colon-separated list.");
 58     " with colon-separated list.");            << 
 59   macroPathCommand->SetParameterName("path", f     57   macroPathCommand->SetParameterName("path", false);
 60                                                    58 
 61   ExecuteCommand = new G4UIcmdWithAString("/co     59   ExecuteCommand = new G4UIcmdWithAString("/control/execute", this);
 62   ExecuteCommand->SetGuidance("Execute a macro     60   ExecuteCommand->SetGuidance("Execute a macro file.");
 63   ExecuteCommand->SetParameterName("fileName",     61   ExecuteCommand->SetParameterName("fileName", false);
 64   ExecuteCommand->SetToBeBroadcasted(false);       62   ExecuteCommand->SetToBeBroadcasted(false);
 65                                                    63 
 66   loopCommand = new G4UIcommand("/control/loop     64   loopCommand = new G4UIcommand("/control/loop", this);
 67   loopCommand->SetGuidance("Execute a macro fi     65   loopCommand->SetGuidance("Execute a macro file more than once.");
 68   loopCommand->SetGuidance("Loop counter can b     66   loopCommand->SetGuidance("Loop counter can be used as an aliased variable.");
 69   auto* param1 = new G4UIparameter("macroFile" <<  67   G4UIparameter* param1 = new G4UIparameter("macroFile", 's', false);
 70   loopCommand->SetParameter(param1);               68   loopCommand->SetParameter(param1);
 71   auto* param2 = new G4UIparameter("counterNam <<  69   G4UIparameter* param2 = new G4UIparameter("counterName", 's', false);
 72   loopCommand->SetParameter(param2);               70   loopCommand->SetParameter(param2);
 73   auto* param3 = new G4UIparameter("initialVal <<  71   G4UIparameter* param3 = new G4UIparameter("initialValue", 'd', false);
 74   loopCommand->SetParameter(param3);               72   loopCommand->SetParameter(param3);
 75   auto* param4 = new G4UIparameter("finalValue <<  73   G4UIparameter* param4 = new G4UIparameter("finalValue", 'd', false);
 76   loopCommand->SetParameter(param4);               74   loopCommand->SetParameter(param4);
 77   auto* param5 = new G4UIparameter("stepSize", <<  75   G4UIparameter* param5 = new G4UIparameter("stepSize", 'd', true);
 78   param5->SetDefaultValue(1.0);                    76   param5->SetDefaultValue(1.0);
 79   loopCommand->SetParameter(param5);               77   loopCommand->SetParameter(param5);
 80   loopCommand->SetToBeBroadcasted(false);          78   loopCommand->SetToBeBroadcasted(false);
 81                                                    79 
 82   foreachCommand = new G4UIcommand("/control/f     80   foreachCommand = new G4UIcommand("/control/foreach", this);
 83   foreachCommand->SetGuidance("Execute a macro     81   foreachCommand->SetGuidance("Execute a macro file more than once.");
 84   foreachCommand->SetGuidance("Loop counter ca <<  82   foreachCommand->SetGuidance(
                                                   >>  83     "Loop counter can be used as an aliased variable.");
 85   foreachCommand->SetGuidance("Values must be      84   foreachCommand->SetGuidance("Values must be separated by a space.");
 86   auto* param6 = new G4UIparameter("macroFile" <<  85   G4UIparameter* param6 = new G4UIparameter("macroFile", 's', false);
 87   foreachCommand->SetParameter(param6);            86   foreachCommand->SetParameter(param6);
 88   auto* param7 = new G4UIparameter("counterNam <<  87   G4UIparameter* param7 = new G4UIparameter("counterName", 's', false);
 89   foreachCommand->SetParameter(param7);            88   foreachCommand->SetParameter(param7);
 90   auto* param8 = new G4UIparameter("valueList" <<  89   G4UIparameter* param8 = new G4UIparameter("valueList", 's', false);
 91   foreachCommand->SetParameter(param8);            90   foreachCommand->SetParameter(param8);
 92   foreachCommand->SetToBeBroadcasted(false);       91   foreachCommand->SetToBeBroadcasted(false);
 93                                                    92 
 94   suppressAbortionCommand = new G4UIcmdWithAnI <<  93   suppressAbortionCommand =
 95   suppressAbortionCommand->SetGuidance("Suppre <<  94     new G4UIcmdWithAnInteger("/control/suppressAbortion", this);
 96   suppressAbortionCommand->SetGuidance("Suppre <<  95   suppressAbortionCommand->SetGuidance(
 97   suppressAbortionCommand->SetGuidance("       <<  96     "Suppress the program abortion caused by G4Exception.");
                                                   >>  97   suppressAbortionCommand->SetGuidance(
                                                   >>  98     "Suppression level = 0 : no suppression");
                                                   >>  99   suppressAbortionCommand->SetGuidance(
                                                   >> 100     "                  = 1 : suppress during EventProc state");
 98   suppressAbortionCommand->SetGuidance(           101   suppressAbortionCommand->SetGuidance(
 99     "                  = 2 : full suppression,    102     "                  = 2 : full suppression, i.e. no abortion by "
100     "G4Exception");                               103     "G4Exception");
101   suppressAbortionCommand->SetGuidance(           104   suppressAbortionCommand->SetGuidance(
102     "When abortion is suppressed, you will get    105     "When abortion is suppressed, you will get error messages issued by "
103     "G4Exception,");                              106     "G4Exception,");
104   suppressAbortionCommand->SetGuidance(           107   suppressAbortionCommand->SetGuidance(
105     "and there is NO guarantee for the correct    108     "and there is NO guarantee for the correct result after the G4Exception "
106     "error message.");                            109     "error message.");
107   suppressAbortionCommand->SetParameterName("l    110   suppressAbortionCommand->SetParameterName("level", true);
108   suppressAbortionCommand->SetRange("level >=     111   suppressAbortionCommand->SetRange("level >= 0 && level <= 2");
109   suppressAbortionCommand->SetDefaultValue(0);    112   suppressAbortionCommand->SetDefaultValue(0);
110                                                   113 
111   verboseCommand = new G4UIcmdWithAnInteger("/    114   verboseCommand = new G4UIcmdWithAnInteger("/control/verbose", this);
112   verboseCommand->SetGuidance("Applied command    115   verboseCommand->SetGuidance("Applied command will also be shown on screen.");
113   verboseCommand->SetGuidance("This command is    116   verboseCommand->SetGuidance("This command is useful with MACRO file.");
114   verboseCommand->SetGuidance("  0 : silent");    117   verboseCommand->SetGuidance("  0 : silent");
115   verboseCommand->SetGuidance("  1 : only the     118   verboseCommand->SetGuidance("  1 : only the valid commands are shown.");
116   verboseCommand->SetGuidance("  2 : comment l    119   verboseCommand->SetGuidance("  2 : comment lines are also shown (default).");
117   verboseCommand->SetParameterName("switch", t    120   verboseCommand->SetParameterName("switch", true);
118   verboseCommand->SetRange("switch >= 0 && swi    121   verboseCommand->SetRange("switch >= 0 && switch <=2");
119   verboseCommand->SetDefaultValue(2);             122   verboseCommand->SetDefaultValue(2);
120                                                   123 
121   doublePrecCommand = new G4UIcmdWithABool("/c    124   doublePrecCommand = new G4UIcmdWithABool("/control/useDoublePrecision", this);
122   doublePrecCommand->SetGuidance(                 125   doublePrecCommand->SetGuidance(
123     "Use double precision for printing out the    126     "Use double precision for printing out the current parameter value(s).");
124   doublePrecCommand->SetParameterName("useDoub    127   doublePrecCommand->SetParameterName("useDoublePrecision", true);
125   doublePrecCommand->SetDefaultValue(true);       128   doublePrecCommand->SetDefaultValue(true);
126                                                   129 
127   historyCommand = new G4UIcmdWithAString("/co    130   historyCommand = new G4UIcmdWithAString("/control/saveHistory", this);
128   historyCommand->SetGuidance("Store command h    131   historyCommand->SetGuidance("Store command history to a file.");
129   historyCommand->SetGuidance("Defaul file nam    132   historyCommand->SetGuidance("Defaul file name is G4history.macro.");
130   historyCommand->SetParameterName("fileName",    133   historyCommand->SetParameterName("fileName", true);
131   historyCommand->SetDefaultValue("G4History.m    134   historyCommand->SetDefaultValue("G4History.macro");
132   historyCommand->SetToBeBroadcasted(false);      135   historyCommand->SetToBeBroadcasted(false);
133                                                   136 
134   stopStoreHistoryCommand = new G4UIcmdWithout << 137   stopStoreHistoryCommand =
                                                   >> 138     new G4UIcmdWithoutParameter("/control/stopSavingHistory", this);
135   stopStoreHistoryCommand->SetGuidance("Stop s    139   stopStoreHistoryCommand->SetGuidance("Stop saving history file.");
136   stopStoreHistoryCommand->SetToBeBroadcasted(    140   stopStoreHistoryCommand->SetToBeBroadcasted(false);
137                                                   141 
138   aliasCommand = new G4UIcommand("/control/ali    142   aliasCommand = new G4UIcommand("/control/alias", this);
139   aliasCommand->SetGuidance("Set an alias.");     143   aliasCommand->SetGuidance("Set an alias.");
140   aliasCommand->SetGuidance("String can be ali    144   aliasCommand->SetGuidance("String can be aliased by this command.");
141   aliasCommand->SetGuidance("The string may co    145   aliasCommand->SetGuidance("The string may contain one or more spaces,");
142   aliasCommand->SetGuidance("the string must b << 146   aliasCommand->SetGuidance(
                                                   >> 147     "the string must be enclosed by double quotes (\").");
143   aliasCommand->SetGuidance("To use an alias,     148   aliasCommand->SetGuidance("To use an alias, enclose the alias name with");
144   aliasCommand->SetGuidance("parenthesis \"{\"    149   aliasCommand->SetGuidance("parenthesis \"{\" and \"}\".");
145   auto* aliasNameParam = new G4UIparameter("al << 150   G4UIparameter* aliasNameParam = new G4UIparameter("aliasName", 's', false);
146   aliasCommand->SetParameter(aliasNameParam);     151   aliasCommand->SetParameter(aliasNameParam);
147   auto* aliasValueParam = new G4UIparameter("a << 152   G4UIparameter* aliasValueParam = new G4UIparameter("aliasValue", 's', false);
148   aliasCommand->SetParameter(aliasValueParam);    153   aliasCommand->SetParameter(aliasValueParam);
149                                                   154 
150   unaliasCommand = new G4UIcmdWithAString("/co    155   unaliasCommand = new G4UIcmdWithAString("/control/unalias", this);
151   unaliasCommand->SetGuidance("Remove an alias    156   unaliasCommand->SetGuidance("Remove an alias.");
152   unaliasCommand->SetParameterName("aliasName"    157   unaliasCommand->SetParameterName("aliasName", false);
153                                                   158 
154   listAliasCommand = new G4UIcmdWithoutParamet    159   listAliasCommand = new G4UIcmdWithoutParameter("/control/listAlias", this);
155   listAliasCommand->SetGuidance("List aliases.    160   listAliasCommand->SetGuidance("List aliases.");
156                                                   161 
157   getEnvCmd = new G4UIcmdWithAString("/control    162   getEnvCmd = new G4UIcmdWithAString("/control/getEnv", this);
158   getEnvCmd->SetGuidance("Get a shell environm << 163   getEnvCmd->SetGuidance(
                                                   >> 164     "Get a shell environment variable and define it as an alias.");
159   getEnvCmd->SetToBeBroadcasted(false);           165   getEnvCmd->SetToBeBroadcasted(false);
160                                                   166 
161   getValCmd = new G4UIcommand("/control/getVal    167   getValCmd = new G4UIcommand("/control/getVal", this);
162   getValCmd->SetGuidance("Get the current valu << 168   getValCmd->SetGuidance(
                                                   >> 169     "Get the current value of the UI command and define it as an alias.");
163   getValCmd->SetGuidance(                         170   getValCmd->SetGuidance(
164     "Command is ignored if the UI command does    171     "Command is ignored if the UI command does not support GetCurrentValue().");
165   getValCmd->SetGuidance(" Syntax : <alias_nam    172   getValCmd->SetGuidance(" Syntax : <alias_name> <UI_command> <iIdx>");
166   auto* aliName = new G4UIparameter("alias_nam << 173   G4UIparameter* aliName = new G4UIparameter("alias_name", 's', false);
167   getValCmd->SetParameter(aliName);               174   getValCmd->SetParameter(aliName);
168   auto* comName = new G4UIparameter("UI_comman << 175   G4UIparameter* comName = new G4UIparameter("UI_command", 's', false);
169   getValCmd->SetParameter(comName);               176   getValCmd->SetParameter(comName);
170   auto* iIdxParam = new G4UIparameter("iIdx",  << 177   G4UIparameter* iIdxParam = new G4UIparameter("iIdx", 'i', true);
171   iIdxParam->SetDefaultValue(0);                  178   iIdxParam->SetDefaultValue(0);
172   getValCmd->SetParameter(iIdxParam);             179   getValCmd->SetParameter(iIdxParam);
173   getValCmd->SetToBeBroadcasted(false);           180   getValCmd->SetToBeBroadcasted(false);
174                                                   181 
175   echoCmd = new G4UIcmdWithAString("/control/e    182   echoCmd = new G4UIcmdWithAString("/control/echo", this);
176   echoCmd->SetGuidance("Display the valueramet    183   echoCmd->SetGuidance("Display the valuerameter string.");
177   echoCmd->SetGuidance("If alias is contained,    184   echoCmd->SetGuidance("If alias is contained, it is converted to the aliased value.");
178                                                   185 
179   shellCommand = new G4UIcmdWithAString("/cont    186   shellCommand = new G4UIcmdWithAString("/control/shell", this);
180   shellCommand->SetGuidance("Execute a (Unix)     187   shellCommand->SetGuidance("Execute a (Unix) SHELL command.");
181   shellCommand->SetToBeBroadcasted(false);        188   shellCommand->SetToBeBroadcasted(false);
182                                                   189 
183   ManualCommand = new G4UIcmdWithAString("/con    190   ManualCommand = new G4UIcmdWithAString("/control/manual", this);
184   ManualCommand->SetGuidance("Display all of s    191   ManualCommand->SetGuidance("Display all of sub-directories and commands.");
185   ManualCommand->SetGuidance("Directory path s    192   ManualCommand->SetGuidance("Directory path should be given by FULL-PATH.");
186   ManualCommand->SetParameterName("dirPath", t    193   ManualCommand->SetParameterName("dirPath", true);
187   ManualCommand->SetDefaultValue("/");            194   ManualCommand->SetDefaultValue("/");
188   ManualCommand->SetToBeBroadcasted(false);       195   ManualCommand->SetToBeBroadcasted(false);
189                                                   196 
190   HTMLCommand = new G4UIcmdWithAString("/contr    197   HTMLCommand = new G4UIcmdWithAString("/control/createHTML", this);
191   HTMLCommand->SetGuidance("Generate HTML file << 198   HTMLCommand->SetGuidance(
                                                   >> 199     "Generate HTML files for all of sub-directories and commands.");
192   HTMLCommand->SetGuidance("Directory path sho    200   HTMLCommand->SetGuidance("Directory path should be given by FULL-PATH.");
193   HTMLCommand->SetParameterName("dirPath", tru    201   HTMLCommand->SetParameterName("dirPath", true);
194   HTMLCommand->SetDefaultValue("/");              202   HTMLCommand->SetDefaultValue("/");
195   HTMLCommand->SetToBeBroadcasted(false);         203   HTMLCommand->SetToBeBroadcasted(false);
196                                                   204 
197   maxStoredHistCommand = new G4UIcmdWithAnInte << 205   maxStoredHistCommand =
198   maxStoredHistCommand->SetGuidance("Set maxim << 206     new G4UIcmdWithAnInteger("/control/maximumStoredHistory", this);
                                                   >> 207   maxStoredHistCommand->SetGuidance(
                                                   >> 208     "Set maximum number of stored UI commands.");
199   maxStoredHistCommand->SetParameterName("max"    209   maxStoredHistCommand->SetParameterName("max", true);
200   maxStoredHistCommand->SetDefaultValue(20);      210   maxStoredHistCommand->SetDefaultValue(20);
201                                                   211 
202   ifCommand = new G4UIcommand("/control/if", t    212   ifCommand = new G4UIcommand("/control/if", this);
203   ifCommand->SetGuidance("Execute a macro file    213   ifCommand->SetGuidance("Execute a macro file if the expression is true.");
204   ifCommand->SetGuidance(" Syntax : <double> <    214   ifCommand->SetGuidance(" Syntax : <double> <comp> <double> <macro_file>");
205   auto* leftParam = new G4UIparameter("left",  << 215   G4UIparameter* leftParam = new G4UIparameter("left", 'd', false);
206   ifCommand->SetParameter(leftParam);             216   ifCommand->SetParameter(leftParam);
207   auto* compParam = new G4UIparameter("comp",  << 217   G4UIparameter* compParam = new G4UIparameter("comp", 's', false);
208   compParam->SetParameterCandidates("> >= < <=    218   compParam->SetParameterCandidates("> >= < <= == !=");
209   ifCommand->SetParameter(compParam);             219   ifCommand->SetParameter(compParam);
210   auto* rightParam = new G4UIparameter("right" << 220   G4UIparameter* rightParam = new G4UIparameter("right", 'd', false);
211   ifCommand->SetParameter(rightParam);            221   ifCommand->SetParameter(rightParam);
212   auto* macroFileParam = new G4UIparameter("ma << 222   G4UIparameter* macroFileParam = new G4UIparameter("macroFile", 's', false);
213   ifCommand->SetParameter(macroFileParam);        223   ifCommand->SetParameter(macroFileParam);
214   ifCommand->SetToBeBroadcasted(false);           224   ifCommand->SetToBeBroadcasted(false);
215                                                   225 
216   doifCommand = new G4UIcommand("/control/doif    226   doifCommand = new G4UIcommand("/control/doif", this);
217   doifCommand->SetGuidance("Execute a UI comma    227   doifCommand->SetGuidance("Execute a UI command if the expression is true.");
218   doifCommand->SetGuidance(" Syntax : <double>    228   doifCommand->SetGuidance(" Syntax : <double> <comp> <double> <UI_command>");
219   auto* doleftParam = new G4UIparameter("left" << 229   G4UIparameter* doleftParam = new G4UIparameter("left", 'd', false);
220   doifCommand->SetParameter(doleftParam);         230   doifCommand->SetParameter(doleftParam);
221   auto* docompParam = new G4UIparameter("comp" << 231   G4UIparameter* docompParam = new G4UIparameter("comp", 's', false);
222   docompParam->SetParameterCandidates("> >= <     232   docompParam->SetParameterCandidates("> >= < <= == !=");
223   doifCommand->SetParameter(docompParam);         233   doifCommand->SetParameter(docompParam);
224   auto* dorightParam = new G4UIparameter("righ << 234   G4UIparameter* dorightParam = new G4UIparameter("right", 'd', false);
225   doifCommand->SetParameter(dorightParam);        235   doifCommand->SetParameter(dorightParam);
226   auto* comParam = new G4UIparameter("UI_comma << 236   G4UIparameter* comParam = new G4UIparameter("UI_command", 's', false);
227   doifCommand->SetParameter(comParam);            237   doifCommand->SetParameter(comParam);
228   doifCommand->SetToBeBroadcasted(false);         238   doifCommand->SetToBeBroadcasted(false);
229                                                   239 
230   addCommand = new G4UIcommand("/control/add",    240   addCommand = new G4UIcommand("/control/add", this);
231   addCommand->SetGuidance("Define a new alias     241   addCommand->SetGuidance("Define a new alias as the sum of two values.");
232   addCommand->SetGuidance(" Syntax : <new_alia    242   addCommand->SetGuidance(" Syntax : <new_alias> <value1> <value2>");
233   addCommand->SetGuidance(" <new_alias> may be << 243   addCommand->SetGuidance(
                                                   >> 244     " <new_alias> may be an already existing alias. If it is the case,");
234   addCommand->SetGuidance(" aliased value is a    245   addCommand->SetGuidance(" aliased value is alternated.");
235   auto* newAlias1 = new G4UIparameter("new_ali << 246   G4UIparameter* newAlias1 = new G4UIparameter("new_alias", 's', false);
236   addCommand->SetParameter(newAlias1);            247   addCommand->SetParameter(newAlias1);
237   auto* val1a = new G4UIparameter("value1", 'd << 248   G4UIparameter* val1a = new G4UIparameter("value1", 'd', false);
238   addCommand->SetParameter(val1a);                249   addCommand->SetParameter(val1a);
239   auto* val1b = new G4UIparameter("value2", 'd << 250   G4UIparameter* val1b = new G4UIparameter("value2", 'd', false);
240   addCommand->SetParameter(val1b);                251   addCommand->SetParameter(val1b);
241   addCommand->SetToBeBroadcasted(false);          252   addCommand->SetToBeBroadcasted(false);
242                                                   253 
243   subtractCommand = new G4UIcommand("/control/    254   subtractCommand = new G4UIcommand("/control/subtract", this);
244   subtractCommand->SetGuidance("Define a new a << 255   subtractCommand->SetGuidance(
                                                   >> 256     "Define a new alias as the subtraction of two values.");
245   subtractCommand->SetGuidance(" Syntax : <new    257   subtractCommand->SetGuidance(" Syntax : <new_alias> <value1> <value2>");
246   subtractCommand->SetGuidance(" <new_alias> m << 258   subtractCommand->SetGuidance(
                                                   >> 259     " <new_alias> may be an already existing alias. If it is the case,");
247   subtractCommand->SetGuidance(" aliased value    260   subtractCommand->SetGuidance(" aliased value is alternated.");
248   auto* newAlias2 = new G4UIparameter("new_ali << 261   G4UIparameter* newAlias2 = new G4UIparameter("new_alias", 's', false);
249   subtractCommand->SetParameter(newAlias2);       262   subtractCommand->SetParameter(newAlias2);
250   auto* val2a = new G4UIparameter("value1", 'd << 263   G4UIparameter* val2a = new G4UIparameter("value1", 'd', false);
251   subtractCommand->SetParameter(val2a);           264   subtractCommand->SetParameter(val2a);
252   auto* val2b = new G4UIparameter("value2", 'd << 265   G4UIparameter* val2b = new G4UIparameter("value2", 'd', false);
253   subtractCommand->SetParameter(val2b);           266   subtractCommand->SetParameter(val2b);
254   subtractCommand->SetToBeBroadcasted(false);     267   subtractCommand->SetToBeBroadcasted(false);
255                                                   268 
256   multiplyCommand = new G4UIcommand("/control/    269   multiplyCommand = new G4UIcommand("/control/multiply", this);
257   multiplyCommand->SetGuidance("Define a new a << 270   multiplyCommand->SetGuidance(
                                                   >> 271     "Define a new alias as the multiplication of two values.");
258   multiplyCommand->SetGuidance(" Syntax : <new    272   multiplyCommand->SetGuidance(" Syntax : <new_alias> <value1> <value2>");
259   multiplyCommand->SetGuidance(" <new_alias> m << 273   multiplyCommand->SetGuidance(
                                                   >> 274     " <new_alias> may be an already existing alias. If it is the case,");
260   multiplyCommand->SetGuidance(" aliased value    275   multiplyCommand->SetGuidance(" aliased value is alternated.");
261   auto* newAlias3 = new G4UIparameter("new_ali << 276   G4UIparameter* newAlias3 = new G4UIparameter("new_alias", 's', false);
262   multiplyCommand->SetParameter(newAlias3);       277   multiplyCommand->SetParameter(newAlias3);
263   auto* val3a = new G4UIparameter("value1", 'd << 278   G4UIparameter* val3a = new G4UIparameter("value1", 'd', false);
264   multiplyCommand->SetParameter(val3a);           279   multiplyCommand->SetParameter(val3a);
265   auto* val3b = new G4UIparameter("value2", 'd << 280   G4UIparameter* val3b = new G4UIparameter("value2", 'd', false);
266   multiplyCommand->SetParameter(val3b);           281   multiplyCommand->SetParameter(val3b);
267   multiplyCommand->SetToBeBroadcasted(false);     282   multiplyCommand->SetToBeBroadcasted(false);
268                                                   283 
269   divideCommand = new G4UIcommand("/control/di    284   divideCommand = new G4UIcommand("/control/divide", this);
270   divideCommand->SetGuidance("Define a new ali << 285   divideCommand->SetGuidance(
                                                   >> 286     "Define a new alias as the division of two values.");
271   divideCommand->SetGuidance(" Syntax : <new_a    287   divideCommand->SetGuidance(" Syntax : <new_alias> <value1> <value2>");
272   divideCommand->SetGuidance(" <new_alias> may << 288   divideCommand->SetGuidance(
                                                   >> 289     " <new_alias> may be an already existing alias. If it is the case,");
273   divideCommand->SetGuidance(" aliased value i    290   divideCommand->SetGuidance(" aliased value is alternated.");
274   auto* newAlias4 = new G4UIparameter("new_ali << 291   G4UIparameter* newAlias4 = new G4UIparameter("new_alias", 's', false);
275   divideCommand->SetParameter(newAlias4);         292   divideCommand->SetParameter(newAlias4);
276   auto* val4a = new G4UIparameter("value1", 'd << 293   G4UIparameter* val4a = new G4UIparameter("value1", 'd', false);
277   divideCommand->SetParameter(val4a);             294   divideCommand->SetParameter(val4a);
278   auto* val4b = new G4UIparameter("value2", 'd << 295   G4UIparameter* val4b = new G4UIparameter("value2", 'd', false);
279   val4b->SetParameterRange("value2 != 0.");       296   val4b->SetParameterRange("value2 != 0.");
280   divideCommand->SetParameter(val4b);             297   divideCommand->SetParameter(val4b);
281   divideCommand->SetToBeBroadcasted(false);       298   divideCommand->SetToBeBroadcasted(false);
282                                                   299 
283   remainderCommand = new G4UIcommand("/control    300   remainderCommand = new G4UIcommand("/control/remainder", this);
284   remainderCommand->SetGuidance("Define a new  << 301   remainderCommand->SetGuidance(
                                                   >> 302     "Define a new alias as the remainder of two values.");
285   remainderCommand->SetGuidance(" Syntax : <ne    303   remainderCommand->SetGuidance(" Syntax : <new_alias> <value1> <value2>");
286   remainderCommand->SetGuidance(                  304   remainderCommand->SetGuidance(
287     " <new_alias> may be an already existing a    305     " <new_alias> may be an already existing alias. If it is the case,");
288   remainderCommand->SetGuidance(" aliased valu    306   remainderCommand->SetGuidance(" aliased value is alternated.");
289   auto* newAlias5 = new G4UIparameter("new_ali << 307   G4UIparameter* newAlias5 = new G4UIparameter("new_alias", 's', false);
290   remainderCommand->SetParameter(newAlias5);      308   remainderCommand->SetParameter(newAlias5);
291   auto* val5a = new G4UIparameter("value1", 'i << 309   G4UIparameter* val5a = new G4UIparameter("value1", 'i', false);
292   remainderCommand->SetParameter(val5a);          310   remainderCommand->SetParameter(val5a);
293   auto* val5b = new G4UIparameter("value2", 'i << 311   G4UIparameter* val5b = new G4UIparameter("value2", 'i', false);
294   val4b->SetParameterRange("value2 != 0");        312   val4b->SetParameterRange("value2 != 0");
295   remainderCommand->SetParameter(val5b);          313   remainderCommand->SetParameter(val5b);
296   remainderCommand->SetToBeBroadcasted(false);    314   remainderCommand->SetToBeBroadcasted(false);
297                                                   315 
298   strifCommand = new G4UIcommand("/control/str    316   strifCommand = new G4UIcommand("/control/strif", this);
299   strifCommand->SetGuidance("Execute a macro f    317   strifCommand->SetGuidance("Execute a macro file if the expression is true.");
300   strifCommand->SetGuidance(" Syntax : <string    318   strifCommand->SetGuidance(" Syntax : <string> <comp> <string> <macro_file>");
301   auto* strleftParam = new G4UIparameter("left << 319   G4UIparameter* strleftParam = new G4UIparameter("left", 's', false);
302   strifCommand->SetParameter(strleftParam);       320   strifCommand->SetParameter(strleftParam);
303   auto* strcompParam = new G4UIparameter("comp << 321   G4UIparameter* strcompParam = new G4UIparameter("comp", 's', false);
304   strcompParam->SetParameterCandidates("== !="    322   strcompParam->SetParameterCandidates("== !=");
305   strifCommand->SetParameter(strcompParam);       323   strifCommand->SetParameter(strcompParam);
306   auto* strrightParam = new G4UIparameter("rig << 324   G4UIparameter* strrightParam = new G4UIparameter("right", 's', false);
307   strifCommand->SetParameter(strrightParam);      325   strifCommand->SetParameter(strrightParam);
308   auto* strmacroFileParam = new G4UIparameter( << 326   G4UIparameter* strmacroFileParam = new G4UIparameter("macroFile", 's', false);
309   strifCommand->SetParameter(strmacroFileParam    327   strifCommand->SetParameter(strmacroFileParam);
310   strifCommand->SetToBeBroadcasted(false);        328   strifCommand->SetToBeBroadcasted(false);
311                                                   329 
312   strdoifCommand = new G4UIcommand("/control/s    330   strdoifCommand = new G4UIcommand("/control/strdoif", this);
313   strdoifCommand->SetGuidance("Execute a UI co << 331   strdoifCommand->SetGuidance(
314   strdoifCommand->SetGuidance(" Syntax : <stri << 332     "Execute a UI command if the expression is true.");
315   auto* strdoleftParam = new G4UIparameter("le << 333   strdoifCommand->SetGuidance(
                                                   >> 334     " Syntax : <string> <comp> <string> <UI_command>");
                                                   >> 335   G4UIparameter* strdoleftParam = new G4UIparameter("left", 's', false);
316   strdoifCommand->SetParameter(strdoleftParam)    336   strdoifCommand->SetParameter(strdoleftParam);
317   auto* strdocompParam = new G4UIparameter("co << 337   G4UIparameter* strdocompParam = new G4UIparameter("comp", 's', false);
318   strdocompParam->SetParameterCandidates("== !    338   strdocompParam->SetParameterCandidates("== !=");
319   strdoifCommand->SetParameter(strdocompParam)    339   strdoifCommand->SetParameter(strdocompParam);
320   auto* strdorightParam = new G4UIparameter("r << 340   G4UIparameter* strdorightParam = new G4UIparameter("right", 's', false);
321   strdoifCommand->SetParameter(strdorightParam    341   strdoifCommand->SetParameter(strdorightParam);
322   auto* strdomacroFileParam = new G4UIparamete << 342   G4UIparameter* strdomacroFileParam =
                                                   >> 343     new G4UIparameter("UI_command", 's', false);
323   strdoifCommand->SetParameter(strdomacroFileP    344   strdoifCommand->SetParameter(strdomacroFileParam);
324   strdoifCommand->SetToBeBroadcasted(false);      345   strdoifCommand->SetToBeBroadcasted(false);
325                                                   346 
326   ifBatchCommand = new G4UIcmdWithAString("/co    347   ifBatchCommand = new G4UIcmdWithAString("/control/ifBatch", this);
327   ifBatchCommand->SetGuidance("Execute a macro << 348   ifBatchCommand->SetGuidance(
                                                   >> 349     "Execute a macro file if program is running in batch mode.");
328   ifBatchCommand->SetParameterName("macroFile"    350   ifBatchCommand->SetParameterName("macroFile", false);
329   ifBatchCommand->SetToBeBroadcasted(false);      351   ifBatchCommand->SetToBeBroadcasted(false);
330                                                   352 
331   ifInteractiveCommand = new G4UIcmdWithAStrin    353   ifInteractiveCommand = new G4UIcmdWithAString("/control/ifInteractive", this);
332   ifInteractiveCommand->SetGuidance(              354   ifInteractiveCommand->SetGuidance(
333     "Execute a macro file if program is runnin    355     "Execute a macro file if program is running in interactive mode.");
334   ifInteractiveCommand->SetParameterName("macr    356   ifInteractiveCommand->SetParameterName("macroFile", false);
335   ifInteractiveCommand->SetToBeBroadcasted(fal    357   ifInteractiveCommand->SetToBeBroadcasted(false);
336                                                   358 
337   doifBatchCommand = new G4UIcmdWithAString("/    359   doifBatchCommand = new G4UIcmdWithAString("/control/doifBatch", this);
338   doifBatchCommand->SetGuidance("Execute a UI  << 360   doifBatchCommand->SetGuidance(
                                                   >> 361     "Execute a UI command if program is running in batch mode.");
339   doifBatchCommand->SetParameterName("UIcomman    362   doifBatchCommand->SetParameterName("UIcommand", false);
340   doifBatchCommand->SetToBeBroadcasted(false);    363   doifBatchCommand->SetToBeBroadcasted(false);
341                                                   364 
342   doifInteractiveCommand = new G4UIcmdWithAStr << 365   doifInteractiveCommand =
                                                   >> 366     new G4UIcmdWithAString("/control/doifInteractive", this);
343   doifInteractiveCommand->SetGuidance(            367   doifInteractiveCommand->SetGuidance(
344     "Execute a UI command if program is runnin    368     "Execute a UI command if program is running in interactive mode.");
345   doifInteractiveCommand->SetParameterName("UI    369   doifInteractiveCommand->SetParameterName("UIcommand", false);
346   doifInteractiveCommand->SetToBeBroadcasted(f    370   doifInteractiveCommand->SetToBeBroadcasted(false);
347 }                                                 371 }
348                                                   372 
349 // -------------------------------------------    373 // --------------------------------------------------------------------
350 G4UIcontrolMessenger::~G4UIcontrolMessenger()     374 G4UIcontrolMessenger::~G4UIcontrolMessenger()
351 {                                                 375 {
352   delete macroPathCommand;                        376   delete macroPathCommand;
353   delete ExecuteCommand;                          377   delete ExecuteCommand;
354   delete suppressAbortionCommand;                 378   delete suppressAbortionCommand;
355   delete verboseCommand;                          379   delete verboseCommand;
356   delete doublePrecCommand;                       380   delete doublePrecCommand;
357   delete historyCommand;                          381   delete historyCommand;
358   delete stopStoreHistoryCommand;                 382   delete stopStoreHistoryCommand;
359   delete ManualCommand;                           383   delete ManualCommand;
360   delete aliasCommand;                            384   delete aliasCommand;
361   delete unaliasCommand;                          385   delete unaliasCommand;
362   delete listAliasCommand;                        386   delete listAliasCommand;
363   delete getEnvCmd;                               387   delete getEnvCmd;
364   delete getValCmd;                               388   delete getValCmd;
365   delete echoCmd;                                 389   delete echoCmd;
366   delete shellCommand;                            390   delete shellCommand;
367   delete loopCommand;                             391   delete loopCommand;
368   delete foreachCommand;                          392   delete foreachCommand;
369   delete HTMLCommand;                             393   delete HTMLCommand;
370   delete maxStoredHistCommand;                    394   delete maxStoredHistCommand;
371   delete ifCommand;                               395   delete ifCommand;
372   delete doifCommand;                             396   delete doifCommand;
373   delete addCommand;                              397   delete addCommand;
374   delete subtractCommand;                         398   delete subtractCommand;
375   delete multiplyCommand;                         399   delete multiplyCommand;
376   delete divideCommand;                           400   delete divideCommand;
377   delete remainderCommand;                        401   delete remainderCommand;
378   delete strifCommand;                            402   delete strifCommand;
379   delete strdoifCommand;                          403   delete strdoifCommand;
380   delete ifBatchCommand;                          404   delete ifBatchCommand;
381   delete ifInteractiveCommand;                    405   delete ifInteractiveCommand;
382   delete doifBatchCommand;                        406   delete doifBatchCommand;
383   delete doifInteractiveCommand;                  407   delete doifInteractiveCommand;
384   delete controlDirectory;                        408   delete controlDirectory;
385 }                                                 409 }
386                                                   410 
387 // -------------------------------------------    411 // --------------------------------------------------------------------
388 void G4UIcontrolMessenger::SetNewValue(G4UIcom    412 void G4UIcontrolMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
389 {                                                 413 {
390   G4UImanager* UI = G4UImanager::GetUIpointer(    414   G4UImanager* UI = G4UImanager::GetUIpointer();
391                                                   415 
392   if (command == macroPathCommand) {           << 416   if(command == macroPathCommand)
                                                   >> 417   {
393     UI->SetMacroSearchPath(newValue);             418     UI->SetMacroSearchPath(newValue);
394     UI->ParseMacroSearchPath();                   419     UI->ParseMacroSearchPath();
395   }                                               420   }
396   if (command == ExecuteCommand) {             << 421   if(command == ExecuteCommand)
                                                   >> 422   {
397     command->ResetFailure();                      423     command->ResetFailure();
398     UI->ExecuteMacroFile(UI->FindMacroPath(new    424     UI->ExecuteMacroFile(UI->FindMacroPath(newValue));
399     if (UI->GetLastReturnCode() != 0) {        << 425     if(UI->GetLastReturnCode() != 0)
                                                   >> 426     {
400       G4ExceptionDescription ed;                  427       G4ExceptionDescription ed;
401       ed << "Command aborted (" << UI->GetLast    428       ed << "Command aborted (" << UI->GetLastReturnCode() << ")";
402       command->CommandFailed(UI->GetLastReturn    429       command->CommandFailed(UI->GetLastReturnCode(), ed);
403     }                                             430     }
404   }                                               431   }
405   if (command == suppressAbortionCommand) {    << 432   if(command == suppressAbortionCommand)
                                                   >> 433   {
406     G4StateManager::GetStateManager()->SetSupp    434     G4StateManager::GetStateManager()->SetSuppressAbortion(
407       suppressAbortionCommand->GetNewIntValue(    435       suppressAbortionCommand->GetNewIntValue(newValue));
408   }                                               436   }
409   if (command == verboseCommand) {             << 437   if(command == verboseCommand)
                                                   >> 438   {
410     UI->SetVerboseLevel(verboseCommand->GetNew    439     UI->SetVerboseLevel(verboseCommand->GetNewIntValue(newValue));
411   }                                               440   }
412   if (command == doublePrecCommand) {          << 441   if(command == doublePrecCommand)
413     G4UImanager::UseDoublePrecisionStr(doubleP << 442   {
                                                   >> 443     G4UImanager::UseDoublePrecisionStr(
                                                   >> 444       doublePrecCommand->GetNewBoolValue(newValue));
414   }                                               445   }
415   if (command == historyCommand) {             << 446   if(command == historyCommand)
                                                   >> 447   {
416     UI->StoreHistory(newValue);                   448     UI->StoreHistory(newValue);
417   }                                               449   }
418   if (command == stopStoreHistoryCommand) {    << 450   if(command == stopStoreHistoryCommand)
                                                   >> 451   {
419     UI->StoreHistory(false);                      452     UI->StoreHistory(false);
420   }                                               453   }
421   if (command == ManualCommand) {              << 454   if(command == ManualCommand)
                                                   >> 455   {
422     UI->ListCommands(newValue);                   456     UI->ListCommands(newValue);
423   }                                               457   }
424   if (command == aliasCommand) {               << 458   if(command == aliasCommand)
                                                   >> 459   {
425     UI->SetAlias(newValue);                       460     UI->SetAlias(newValue);
426   }                                               461   }
427   if (command == unaliasCommand) {             << 462   if(command == unaliasCommand)
                                                   >> 463   {
428     UI->RemoveAlias(newValue);                    464     UI->RemoveAlias(newValue);
429   }                                               465   }
430   if (command == listAliasCommand) {           << 466   if(command == listAliasCommand)
                                                   >> 467   {
431     UI->ListAlias();                              468     UI->ListAlias();
432   }                                               469   }
433   if (command == getEnvCmd) {                  << 470   if(command == getEnvCmd)
                                                   >> 471   {
434     command->ResetFailure();                      472     command->ResetFailure();
435     if (std::getenv(newValue) != nullptr) {    << 473     if(std::getenv(newValue))
                                                   >> 474     {
436       G4String st = newValue;                     475       G4String st = newValue;
437       st += " ";                                  476       st += " ";
438       st += std::getenv(newValue);                477       st += std::getenv(newValue);
439       UI->SetAlias(st.c_str());                   478       UI->SetAlias(st.c_str());
440     }                                             479     }
441     else {                                     << 480     else
                                                   >> 481     {
442       G4ExceptionDescription ed;                  482       G4ExceptionDescription ed;
443       ed << "<" << newValue << "> is not defin << 483       ed << "<" << newValue
                                                   >> 484          << "> is not defined as a shell variable. Command ignored.";
444       command->CommandFailed(ed);                 485       command->CommandFailed(ed);
445     }                                             486     }
446   }                                               487   }
447   if (command == getValCmd) {                  << 488   if(command == getValCmd)
                                                   >> 489   {
448     G4Tokenizer next(newValue);                   490     G4Tokenizer next(newValue);
449     const G4String& aliName = next();          << 491     G4String aliName = next();
450     const G4String& com = next();              << 492     G4String com     = next();
451     const G4String& curVal = UI->GetCurrentVal << 493     G4String curVal  = UI->GetCurrentValues(com);
452     if (!(curVal.empty())) {                   << 494     if(!(curVal.empty()))
                                                   >> 495     {
453       G4String theValue = curVal;                 496       G4String theValue = curVal;
454       G4String iIdx = next();                  << 497       G4String iIdx     = next();
455       if (!(iIdx.empty())) {                   << 498       if(!(iIdx.empty()))
                                                   >> 499       {
456         G4int idx = StoI(iIdx);                   500         G4int idx = StoI(iIdx);
457         G4Tokenizer nextVal(curVal);              501         G4Tokenizer nextVal(curVal);
458         for (G4int i = 0; i <= idx; i++) {     << 502         for(G4int i = 0; i <= idx; i++)
                                                   >> 503         {
459           theValue = nextVal();                   504           theValue = nextVal();
460         }                                         505         }
461       }                                           506       }
462       G4String st = "/control/alias ";            507       G4String st = "/control/alias ";
463       st += aliName + " " + theValue;             508       st += aliName + " " + theValue;
464       UI->ApplyCommand(st);                       509       UI->ApplyCommand(st);
465     }                                             510     }
466   }                                               511   }
467   if (command == echoCmd) {                    << 512   if(command == echoCmd)
                                                   >> 513   {
468     G4cout << UI->SolveAlias(newValue) << G4en    514     G4cout << UI->SolveAlias(newValue) << G4endl;
469   }                                               515   }
470   if (command == shellCommand) {               << 516   if(command == shellCommand)
                                                   >> 517   {
471     command->ResetFailure();                      518     command->ResetFailure();
472     G4int rc = system(newValue);               << 519     int rc = system(newValue);
473     if (rc < 0) {                              << 520     if(rc < 0)
                                                   >> 521     {
474       G4ExceptionDescription ed;                  522       G4ExceptionDescription ed;
475       ed << "<" << newValue << "> is not a val << 523       ed << "<" << newValue
                                                   >> 524          << "> is not a valid shell command. Command ignored.";
476       command->CommandFailed(ed);                 525       command->CommandFailed(ed);
477     }                                             526     }
478   }                                               527   }
479   if (command == loopCommand) {                << 528   if(command == loopCommand)
                                                   >> 529   {
480     command->ResetFailure();                      530     command->ResetFailure();
481     UI->LoopS(newValue);                          531     UI->LoopS(newValue);
482     if (UI->GetLastReturnCode() != 0) {        << 532     if(UI->GetLastReturnCode() != 0)
                                                   >> 533     {
483       G4ExceptionDescription ed;                  534       G4ExceptionDescription ed;
484       ed << "Command aborted (" << UI->GetLast    535       ed << "Command aborted (" << UI->GetLastReturnCode() << ")";
485       command->CommandFailed(UI->GetLastReturn    536       command->CommandFailed(UI->GetLastReturnCode(), ed);
486     }                                             537     }
487   }                                               538   }
488   if (command == foreachCommand) {             << 539   if(command == foreachCommand)
                                                   >> 540   {
489     command->ResetFailure();                      541     command->ResetFailure();
490     UI->ForeachS(newValue);                       542     UI->ForeachS(newValue);
491     if (UI->GetLastReturnCode() != 0) {        << 543     if(UI->GetLastReturnCode() != 0)
                                                   >> 544     {
492       G4ExceptionDescription ed;                  545       G4ExceptionDescription ed;
493       ed << "Command aborted (" << UI->GetLast    546       ed << "Command aborted (" << UI->GetLastReturnCode() << ")";
494       command->CommandFailed(UI->GetLastReturn    547       command->CommandFailed(UI->GetLastReturnCode(), ed);
495     }                                             548     }
496   }                                               549   }
497   if (command == HTMLCommand) {                << 550   if(command == HTMLCommand)
                                                   >> 551   {
498     UI->CreateHTML(newValue);                     552     UI->CreateHTML(newValue);
499   }                                               553   }
500   if (command == maxStoredHistCommand) {       << 554   if(command == maxStoredHistCommand)
                                                   >> 555   {
501     UI->SetMaxHistSize(maxStoredHistCommand->G    556     UI->SetMaxHistSize(maxStoredHistCommand->GetNewIntValue(newValue));
502   }                                               557   }
503   if (command == ifCommand) {                  << 558   if(command == ifCommand)
                                                   >> 559   {
504     G4Tokenizer next(newValue);                   560     G4Tokenizer next(newValue);
505     G4double l = StoD(next());                 << 561     G4double l    = StoD(next());
506     const G4String& comp = next();             << 562     G4String comp = next();
507     G4double r = StoD(next());                 << 563     G4double r    = StoD(next());
508     const G4String& mac = next();              << 564     G4String mac  = next();
509     G4bool x = false;                          << 565     G4bool x      = false;
510     if (comp == ">") {                         << 566     if(comp == ">")
511       x = (l > r);                                567       x = (l > r);
512     }                                          << 568     else if(comp == ">=")
513     else if (comp == ">=") {                   << 
514       x = (l >= r);                               569       x = (l >= r);
515     }                                          << 570     else if(comp == "<")
516     else if (comp == "<") {                    << 
517       x = (l < r);                                571       x = (l < r);
518     }                                          << 572     else if(comp == "<=")
519     else if (comp == "<=") {                   << 
520       x = (l <= r);                               573       x = (l <= r);
521     }                                          << 574     else if(comp == "==")
522     else if (comp == "==") {                   << 
523       x = (l == r);                               575       x = (l == r);
524     }                                          << 576     else if(comp == "!=")
525     else if (comp == "!=") {                   << 
526       x = (l != r);                               577       x = (l != r);
527     }                                          << 578     if(x)
528     if (x) {                                   << 579       UI->ExecuteMacroFile(mac);
529       UI->ExecuteMacroFile(UI->FindMacroPath(m << 
530     }                                          << 
531   }                                               580   }
532   if (command == doifCommand) {                << 581   if(command == doifCommand)
                                                   >> 582   {
533     G4Tokenizer next(newValue);                   583     G4Tokenizer next(newValue);
534     G4double l = StoD(next());                 << 584     G4double l    = StoD(next());
535     const G4String& comp = next();             << 585     G4String comp = next();
536     G4double r = StoD(next());                 << 586     G4double r    = StoD(next());
537                                                   587 
538     G4String c1 = next();                         588     G4String c1 = next();
539     G4String ca;                                  589     G4String ca;
540     while (!((ca = next()).empty())) {         << 590     while(!((ca = next()).empty()))
                                                   >> 591     {
541       c1 += " ";                                  592       c1 += " ";
542       c1 += ca;                                   593       c1 += ca;
543     }                                             594     }
544     if (c1[0] == '"') {                        << 595     if(c1[0] == '"')
                                                   >> 596     {
545       G4String strippedValue;                     597       G4String strippedValue;
546       if (c1.back() == '"') {                  << 598       if(c1.back() == '"')
                                                   >> 599       {
547         strippedValue = c1.substr(1, c1.length    600         strippedValue = c1.substr(1, c1.length() - 2);
548       }                                           601       }
549       else {                                   << 602       else
                                                   >> 603       {
550         strippedValue = c1.substr(1, c1.length    604         strippedValue = c1.substr(1, c1.length() - 1);
551       }                                           605       }
552       c1 = std::move(strippedValue);           << 606       c1 = strippedValue;
553     }                                             607     }
554                                                   608 
555     G4bool x = false;                             609     G4bool x = false;
556     if (comp == ">") {                         << 610     if(comp == ">")
557       x = (l > r);                                611       x = (l > r);
558     }                                          << 612     else if(comp == ">=")
559     else if (comp == ">=") {                   << 
560       x = (l >= r);                               613       x = (l >= r);
561     }                                          << 614     else if(comp == "<")
562     else if (comp == "<") {                    << 
563       x = (l < r);                                615       x = (l < r);
564     }                                          << 616     else if(comp == "<=")
565     else if (comp == "<=") {                   << 
566       x = (l <= r);                               617       x = (l <= r);
567     }                                          << 618     else if(comp == "==")
568     else if (comp == "==") {                   << 
569       x = (l == r);                               619       x = (l == r);
570     }                                          << 620     else if(comp == "!=")
571     else if (comp == "!=") {                   << 
572       x = (l != r);                               621       x = (l != r);
573     }                                          << 622     if(x)
574     if (x) {                                   << 
575       UI->ApplyCommand(c1);                       623       UI->ApplyCommand(c1);
576     }                                          << 
577   }                                               624   }
578   if (command == addCommand) {                 << 625   if(command == addCommand)
                                                   >> 626   {
579     G4Tokenizer next(newValue);                   627     G4Tokenizer next(newValue);
580     const G4String& newA = next();             << 628     G4String newA = next();
581     G4double l = StoD(next());                 << 629     G4double l    = StoD(next());
582     G4double r = StoD(next());                 << 630     G4double r    = StoD(next());
583     G4String st = "/control/alias ";           << 631     G4String st   = "/control/alias ";
584     st += newA;                                   632     st += newA;
585     st += " ";                                    633     st += " ";
586     st += DtoS(l + r);                            634     st += DtoS(l + r);
587     UI->ApplyCommand(st);                         635     UI->ApplyCommand(st);
588   }                                               636   }
589   if (command == subtractCommand) {            << 637   if(command == subtractCommand)
                                                   >> 638   {
590     G4Tokenizer next(newValue);                   639     G4Tokenizer next(newValue);
591     const G4String& newA = next();             << 640     G4String newA = next();
592     G4double l = StoD(next());                 << 641     G4double l    = StoD(next());
593     G4double r = StoD(next());                 << 642     G4double r    = StoD(next());
594     G4String st = "/control/alias ";           << 643     G4String st   = "/control/alias ";
595     st += newA;                                   644     st += newA;
596     st += " ";                                    645     st += " ";
597     st += DtoS(l - r);                            646     st += DtoS(l - r);
598     UI->ApplyCommand(st);                         647     UI->ApplyCommand(st);
599   }                                               648   }
600   if (command == multiplyCommand) {            << 649   if(command == multiplyCommand)
                                                   >> 650   {
601     G4Tokenizer next(newValue);                   651     G4Tokenizer next(newValue);
602     const G4String& newA = next();             << 652     G4String newA = next();
603     G4double l = StoD(next());                 << 653     G4double l    = StoD(next());
604     G4double r = StoD(next());                 << 654     G4double r    = StoD(next());
605     G4String st = "/control/alias ";           << 655     G4String st   = "/control/alias ";
606     st += newA;                                   656     st += newA;
607     st += " ";                                    657     st += " ";
608     st += DtoS(l * r);                            658     st += DtoS(l * r);
609     UI->ApplyCommand(st);                         659     UI->ApplyCommand(st);
610   }                                               660   }
611   if (command == divideCommand) {              << 661   if(command == divideCommand)
                                                   >> 662   {
612     G4Tokenizer next(newValue);                   663     G4Tokenizer next(newValue);
613     const G4String& newA = next();             << 664     G4String newA = next();
614     G4double l = StoD(next());                 << 665     G4double l    = StoD(next());
615     G4double r = StoD(next());                 << 666     G4double r    = StoD(next());
616     G4String st = "/control/alias ";           << 667     G4String st   = "/control/alias ";
617     st += newA;                                   668     st += newA;
618     st += " ";                                    669     st += " ";
619     st += DtoS(l / r);                            670     st += DtoS(l / r);
620     UI->ApplyCommand(st);                         671     UI->ApplyCommand(st);
621   }                                               672   }
622   if (command == remainderCommand) {           << 673   if(command == remainderCommand)
                                                   >> 674   {
623     G4Tokenizer next(newValue);                   675     G4Tokenizer next(newValue);
624     const G4String& newA = next();             << 676     G4String newA = next();
625     G4int l = StoI(next());                    << 677     G4int l       = StoI(next());
626     G4int r = StoI(next());                    << 678     G4int r       = StoI(next());
627     G4String st = "/control/alias ";           << 679     G4String st   = "/control/alias ";
628     st += newA;                                   680     st += newA;
629     st += " ";                                    681     st += " ";
630     st += DtoS(l % r);                            682     st += DtoS(l % r);
631     UI->ApplyCommand(st);                         683     UI->ApplyCommand(st);
632   }                                               684   }
633   if (command == strifCommand) {               << 685   if(command == strifCommand)
                                                   >> 686   {
634     G4Tokenizer next(newValue);                   687     G4Tokenizer next(newValue);
635     const G4String& l = next();                << 688     G4String l    = next();
636     const G4String& comp = next();             << 689     G4String comp = next();
637     const G4String& r = next();                << 690     G4String r    = next();
638     const G4String& mac = next();              << 691     G4String mac  = next();
639     G4bool x = false;                          << 692     G4bool x      = false;
640     if (comp == "==") {                        << 693     if(comp == "==")
                                                   >> 694     {
641       x = (l == r);                               695       x = (l == r);
642     }                                             696     }
643     else if (comp == "!=") {                   << 697     else if(comp == "!=")
                                                   >> 698     {
644       x = (l != r);                               699       x = (l != r);
645     }                                             700     }
646     if (x) {                                   << 701     if(x)
647       UI->ExecuteMacroFile(UI->FindMacroPath(m << 702       UI->ExecuteMacroFile(mac);
648     }                                          << 
649   }                                               703   }
650   if (command == strdoifCommand) {             << 704   if(command == strdoifCommand)
                                                   >> 705   {
651     G4Tokenizer next(newValue);                   706     G4Tokenizer next(newValue);
652     const G4String& l = next();                << 707     G4String l    = next();
653     const G4String& comp = next();             << 708     G4String comp = next();
654     const G4String& r = next();                << 709     G4String r    = next();
655                                                   710 
656     G4String c1 = next();                         711     G4String c1 = next();
657     G4String ca;                                  712     G4String ca;
658     while (!((ca = next()).empty())) {         << 713     while(!((ca = next()).empty()))
                                                   >> 714     {
659       c1 += " ";                                  715       c1 += " ";
660       c1 += ca;                                   716       c1 += ca;
661     }                                             717     }
662     if (c1[0] == '"') {                        << 718     if(c1[0] == '"')
                                                   >> 719     {
663       G4String strippedValue;                     720       G4String strippedValue;
664       if (c1.back() == '"') {                  << 721       if(c1.back() == '"')
                                                   >> 722       {
665         strippedValue = c1.substr(1, c1.length    723         strippedValue = c1.substr(1, c1.length() - 2);
666       }                                           724       }
667       else {                                   << 725       else
                                                   >> 726       {
668         strippedValue = c1.substr(1, c1.length    727         strippedValue = c1.substr(1, c1.length() - 1);
669       }                                           728       }
670       c1 = std::move(strippedValue);           << 729       c1 = strippedValue;
671     }                                             730     }
672                                                   731 
673     G4bool x = false;                             732     G4bool x = false;
674     if (comp == "==") {                        << 733     if(comp == "==")
                                                   >> 734     {
675       x = (l == r);                               735       x = (l == r);
676     }                                             736     }
677     else if (comp == "!=") {                   << 737     else if(comp == "!=")
                                                   >> 738     {
678       x = (l != r);                               739       x = (l != r);
679     }                                             740     }
680     if (x) {                                   << 741     if(x)
681       UI->ApplyCommand(c1);                       742       UI->ApplyCommand(c1);
682     }                                          << 
683   }                                               743   }
684   if (command == ifBatchCommand) {             << 744   if(command == ifBatchCommand)
685     if (G4UIsession::InSession() == 0) {       << 745   {
                                                   >> 746     if(G4UIsession::InSession() == 0)
686       UI->ExecuteMacroFile(UI->FindMacroPath(n    747       UI->ExecuteMacroFile(UI->FindMacroPath(newValue));
687     }                                          << 
688   }                                               748   }
689   if (command == ifInteractiveCommand) {       << 749   if(command == ifInteractiveCommand)
690     if (G4UIsession::InSession() > 0) {        << 750   {
                                                   >> 751     if(G4UIsession::InSession() > 0)
691       UI->ExecuteMacroFile(UI->FindMacroPath(n    752       UI->ExecuteMacroFile(UI->FindMacroPath(newValue));
692     }                                          << 
693   }                                               753   }
694   if (command == doifBatchCommand) {           << 754   if(command == doifBatchCommand)
695     if (G4UIsession::InSession() == 0) {       << 755   {
                                                   >> 756     if(G4UIsession::InSession() == 0)
696       UI->ApplyCommand(newValue);                 757       UI->ApplyCommand(newValue);
697     }                                          << 
698   }                                               758   }
699   if (command == doifInteractiveCommand) {     << 759   if(command == doifInteractiveCommand)
700     if (G4UIsession::InSession() > 0) {        << 760   {
                                                   >> 761     if(G4UIsession::InSession() > 0)
701       UI->ApplyCommand(newValue);                 762       UI->ApplyCommand(newValue);
702     }                                          << 
703   }                                               763   }
704 }                                                 764 }
705                                                   765 
706 // -------------------------------------------    766 // --------------------------------------------------------------------
707 G4String G4UIcontrolMessenger::GetCurrentValue    767 G4String G4UIcontrolMessenger::GetCurrentValue(G4UIcommand* command)
708 {                                                 768 {
709   G4UImanager* UI = G4UImanager::GetUIpointer(    769   G4UImanager* UI = G4UImanager::GetUIpointer();
710   G4String currentValue;                          770   G4String currentValue;
711                                                   771 
712   if (command == macroPathCommand) {           << 772   if(command == macroPathCommand)
                                                   >> 773   {
713     currentValue = UI->GetMacroSearchPath();      774     currentValue = UI->GetMacroSearchPath();
714   }                                               775   }
715   if (command == verboseCommand) {             << 776   if(command == verboseCommand)
                                                   >> 777   {
716     currentValue = verboseCommand->ConvertToSt    778     currentValue = verboseCommand->ConvertToString(UI->GetVerboseLevel());
717   }                                               779   }
718   if (command == doublePrecCommand) {          << 780   if(command == doublePrecCommand)
719     currentValue = doublePrecCommand->ConvertT << 781   {
                                                   >> 782     currentValue =
                                                   >> 783       doublePrecCommand->ConvertToString(G4UImanager::DoublePrecisionStr());
720   }                                               784   }
721   if (command == suppressAbortionCommand) {    << 785   if(command == suppressAbortionCommand)
                                                   >> 786   {
722     currentValue = suppressAbortionCommand->Co    787     currentValue = suppressAbortionCommand->ConvertToString(
723       G4StateManager::GetStateManager()->GetSu    788       G4StateManager::GetStateManager()->GetSuppressAbortion());
724   }                                               789   }
725   if (command == maxStoredHistCommand) {       << 790   if(command == maxStoredHistCommand)
                                                   >> 791   {
726     currentValue = maxStoredHistCommand->Conve    792     currentValue = maxStoredHistCommand->ConvertToString(UI->GetMaxHistSize());
727   }                                               793   }
728                                                   794 
729   return currentValue;                            795   return currentValue;
730 }                                                 796 }
731                                                   797