52 controlDirectory->
SetGuidance(
"UI control commands.");
55 macroPathCommand->
SetGuidance(
"Set macro search path"
56 " with colon-separated list.");
60 ExecuteCommand->
SetGuidance(
"Execute a macro file.");
64 loopCommand =
new G4UIcommand(
"/control/loop",
this);
65 loopCommand->
SetGuidance(
"Execute a macro file more than once.");
66 loopCommand->
SetGuidance(
"Loop counter can be used as an aliased variable.");
80 foreachCommand =
new G4UIcommand(
"/control/foreach",
this);
81 foreachCommand->
SetGuidance(
"Execute a macro file more than once.");
83 "Loop counter can be used as an aliased variable.");
84 foreachCommand->
SetGuidance(
"Values must be separated by a space.");
93 suppressAbortionCommand =
96 "Suppress the program abortion caused by G4Exception.");
98 "Suppression level = 0 : no suppression");
100 " = 1 : suppress during EventProc state");
102 " = 2 : full suppression, i.e. no abortion by "
105 "When abortion is suppressed, you will get error messages issued by "
108 "and there is NO guarantee for the correct result after the G4Exception "
111 suppressAbortionCommand->
SetRange(
"level >= 0 && level <= 2");
115 verboseCommand->
SetGuidance(
"Applied command will also be shown on screen.");
116 verboseCommand->
SetGuidance(
"This command is useful with MACRO file.");
118 verboseCommand->
SetGuidance(
" 1 : only the valid commands are shown.");
119 verboseCommand->
SetGuidance(
" 2 : comment lines are also shown (default).");
121 verboseCommand->
SetRange(
"switch >= 0 && switch <=2");
124 doublePrecCommand =
new G4UIcmdWithABool(
"/control/useDoublePrecision",
this);
126 "Use double precision for printing out the current parameter value(s).");
131 historyCommand->
SetGuidance(
"Store command history to a file.");
132 historyCommand->
SetGuidance(
"Defaul file name is G4history.macro.");
136 stopStoreHistoryCommand =
138 stopStoreHistoryCommand->
SetGuidance(
"Stop saving history file.");
140 aliasCommand =
new G4UIcommand(
"/control/alias",
this);
142 aliasCommand->
SetGuidance(
"String can be aliased by this command.");
143 aliasCommand->
SetGuidance(
"The string may contain one or more spaces,");
145 "the string must be enclosed by double quotes (\").");
146 aliasCommand->
SetGuidance(
"To use an alias, enclose the alias name with");
147 aliasCommand->
SetGuidance(
"parenthesis \"{\" and \"}\".");
162 "Get a shell environment variable and define it as an alias.");
164 getValCmd =
new G4UIcommand(
"/control/getVal",
this);
166 "Get the current value of the UI command and define it as an alias.");
168 "Command is ignored if the UI command does not support GetCurrentValue().");
169 getValCmd->
SetGuidance(
" Syntax : <alias_name> <UI_command> <iIdx>");
179 echoCmd->
SetGuidance(
"Display the aliased value.");
182 shellCommand->
SetGuidance(
"Execute a (Unix) SHELL command.");
185 ManualCommand->
SetGuidance(
"Display all of sub-directories and commands.");
186 ManualCommand->
SetGuidance(
"Directory path should be given by FULL-PATH.");
193 "Generate HTML files for all of sub-directories and commands.");
194 HTMLCommand->
SetGuidance(
"Directory path should be given by FULL-PATH.");
199 maxStoredHistCommand =
202 "Set maximum number of stored UI commands.");
207 ifCommand->
SetGuidance(
"Execute a macro file if the expression is true.");
208 ifCommand->
SetGuidance(
" Syntax : <double> <comp> <double> <macro_file>");
220 doifCommand =
new G4UIcommand(
"/control/doif",
this);
221 doifCommand->
SetGuidance(
"Execute a UI command if the expression is true.");
222 doifCommand->
SetGuidance(
" Syntax : <double> <comp> <double> <UI_command>");
234 addCommand =
new G4UIcommand(
"/control/add",
this);
235 addCommand->
SetGuidance(
"Define a new alias as the sum of two values.");
236 addCommand->
SetGuidance(
" Syntax : <new_alias> <value1> <value2>");
238 " <new_alias> may be an already existing alias. If it is the case,");
239 addCommand->
SetGuidance(
" aliased value is alternated.");
248 subtractCommand =
new G4UIcommand(
"/control/subtract",
this);
250 "Define a new alias as the subtraction of two values.");
251 subtractCommand->
SetGuidance(
" Syntax : <new_alias> <value1> <value2>");
253 " <new_alias> may be an already existing alias. If it is the case,");
254 subtractCommand->
SetGuidance(
" aliased value is alternated.");
263 multiplyCommand =
new G4UIcommand(
"/control/multiply",
this);
265 "Define a new alias as the multiplication of two values.");
266 multiplyCommand->
SetGuidance(
" Syntax : <new_alias> <value1> <value2>");
268 " <new_alias> may be an already existing alias. If it is the case,");
269 multiplyCommand->
SetGuidance(
" aliased value is alternated.");
278 divideCommand =
new G4UIcommand(
"/control/divide",
this);
280 "Define a new alias as the division of two values.");
281 divideCommand->
SetGuidance(
" Syntax : <new_alias> <value1> <value2>");
283 " <new_alias> may be an already existing alias. If it is the case,");
284 divideCommand->
SetGuidance(
" aliased value is alternated.");
294 remainderCommand =
new G4UIcommand(
"/control/remainder",
this);
296 "Define a new alias as the remainder of two values.");
297 remainderCommand->
SetGuidance(
" Syntax : <new_alias> <value1> <value2>");
299 " <new_alias> may be an already existing alias. If it is the case,");
300 remainderCommand->
SetGuidance(
" aliased value is alternated.");
310 strifCommand =
new G4UIcommand(
"/control/strif",
this);
311 strifCommand->
SetGuidance(
"Execute a macro file if the expression is true.");
312 strifCommand->
SetGuidance(
" Syntax : <string> <comp> <string> <macro_file>");
324 strdoifCommand =
new G4UIcommand(
"/control/strdoif",
this);
326 "Execute a UI command if the expression is true.");
328 " Syntax : <string> <comp> <string> <UI_command>");
343 "Execute a macro file if program is running in batch mode.");
349 "Execute a macro file if program is running in interactive mode.");
355 "Execute a UI command if program is running in batch mode.");
359 doifInteractiveCommand =
362 "Execute a UI command if program is running in interactive mode.");
370 delete macroPathCommand;
371 delete ExecuteCommand;
372 delete suppressAbortionCommand;
373 delete verboseCommand;
374 delete doublePrecCommand;
375 delete historyCommand;
376 delete stopStoreHistoryCommand;
377 delete ManualCommand;
379 delete unaliasCommand;
380 delete listAliasCommand;
386 delete foreachCommand;
388 delete maxStoredHistCommand;
392 delete subtractCommand;
393 delete multiplyCommand;
394 delete divideCommand;
395 delete remainderCommand;
397 delete strdoifCommand;
398 delete ifBatchCommand;
399 delete ifInteractiveCommand;
400 delete doifBatchCommand;
401 delete doifInteractiveCommand;
402 delete controlDirectory;
410 if(command == macroPathCommand)
415 if(command == ExecuteCommand)
426 if(command == suppressAbortionCommand)
431 if(command == verboseCommand)
435 if(command == doublePrecCommand)
440 if(command == historyCommand)
444 if(command == stopStoreHistoryCommand)
448 if(command == ManualCommand)
452 if(command == aliasCommand)
456 if(command == unaliasCommand)
460 if(command == listAliasCommand)
464 if(command == getEnvCmd)
467 if(std::getenv(newValue))
471 st += std::getenv(newValue);
477 ed <<
"<" << newValue
478 <<
"> is not defined as a shell variable. Command ignored.";
482 if(command == getValCmd)
496 for(
G4int i = 0; i <= idx; i++)
498 theValue = nextVal();
502 st += aliName +
" " + theValue;
506 if(command == echoCmd)
510 if(command == shellCommand)
513 int rc = system(newValue);
517 ed <<
"<" << newValue
518 <<
"> is not a valid shell command. Command ignored.";
522 if(command == loopCommand)
533 if(command == foreachCommand)
544 if(command == HTMLCommand)
548 if(command == maxStoredHistCommand)
552 if(command == ifCommand)
562 else if(comp ==
">=")
566 else if(comp ==
"<=")
568 else if(comp ==
"==")
570 else if(comp ==
"!=")
575 if(command == doifCommand)
584 while(!((ca = next()).isNull()))
592 if(c1(c1.length() - 1) ==
'"')
594 strippedValue = c1(1, c1.length() - 2);
598 strippedValue = c1(1, c1.length() - 1);
606 else if(comp ==
">=")
610 else if(comp ==
"<=")
612 else if(comp ==
"==")
614 else if(comp ==
"!=")
619 if(command == addCommand)
631 if(command == subtractCommand)
643 if(command == multiplyCommand)
655 if(command == divideCommand)
667 if(command == remainderCommand)
679 if(command == strifCommand)
691 else if(comp ==
"!=")
698 if(command == strdoifCommand)
707 while(!((ca = next()).isNull()))
715 if(c1(c1.length() - 1) ==
'"')
717 strippedValue = c1(1, c1.length() - 2);
721 strippedValue = c1(1, c1.length() - 1);
731 else if(comp ==
"!=")
738 if(command == ifBatchCommand)
743 if(command == ifInteractiveCommand)
748 if(command == doifBatchCommand)
753 if(command == doifInteractiveCommand)
766 if(command == macroPathCommand)
770 if(command == verboseCommand)
774 if(command == doublePrecCommand)
779 if(command == suppressAbortionCommand)
784 if(command == maxStoredHistCommand)
std::ostringstream G4ExceptionDescription
G4GLOB_DLL std::ostream G4cout
void SetSuppressAbortion(G4int i)
static G4StateManager * GetStateManager()
static G4bool GetNewBoolValue(const char *paramString)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4bool defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(const char *defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
void SetDefaultValue(G4int defVal)
void SetToBeBroadcasted(G4bool val)
static G4String ConvertToString(G4bool boolVal)
void SetParameter(G4UIparameter *const newParameter)
void SetGuidance(const char *aGuidance)
void CommandFailed(G4int errCode, G4ExceptionDescription &ed)
void SetRange(const char *rs)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
static G4bool DoublePrecisionStr()
static void UseDoublePrecisionStr(G4bool val)
const G4String & GetMacroSearchPath() const
void ForeachS(const char *valueList)
G4int ApplyCommand(const char *aCommand)
void CreateHTML(const char *dir="/")
void LoopS(const char *valueList)
void StoreHistory(const char *fileName="G4history.macro")
void ListCommands(const char *direc)
void ExecuteMacroFile(const char *fileName)
void SetMacroSearchPath(const G4String &path)
void SetMaxHistSize(G4int mx)
G4int GetVerboseLevel() const
G4int GetLastReturnCode() const
G4String GetCurrentValues(const char *aCommand)
void SetAlias(const char *aliasLine)
G4String FindMacroPath(const G4String &fname) const
void RemoveAlias(const char *aliasName)
G4String SolveAlias(const char *aCmd)
void ParseMacroSearchPath()
static G4UImanager * GetUIpointer()
G4int GetMaxHistSize() const
void SetVerboseLevel(G4int val)
G4String DtoS(G4double a)
G4double StoD(G4String s)
void SetDefaultValue(const char *theDefaultValue)
void SetParameterRange(const char *theRange)
void SetParameterCandidates(const char *theString)